Magento Asynchronous Customer REST endpoints - All inclusive
PUT
amazon-billing-address-{amazonOrderReferenceId}
{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId
QUERY PARAMS
amazonOrderReferenceId
BODY json
{
"addressConsentToken": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId");
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 \"addressConsentToken\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId" {:content-type :json
:form-params {:addressConsentToken ""}})
require "http/client"
url = "{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"addressConsentToken\": \"\"\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}}/async/V1/amazon-billing-address/:amazonOrderReferenceId"),
Content = new StringContent("{\n \"addressConsentToken\": \"\"\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}}/async/V1/amazon-billing-address/:amazonOrderReferenceId");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"addressConsentToken\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId"
payload := strings.NewReader("{\n \"addressConsentToken\": \"\"\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/async/V1/amazon-billing-address/:amazonOrderReferenceId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 31
{
"addressConsentToken": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId")
.setHeader("content-type", "application/json")
.setBody("{\n \"addressConsentToken\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"addressConsentToken\": \"\"\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 \"addressConsentToken\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId")
.header("content-type", "application/json")
.body("{\n \"addressConsentToken\": \"\"\n}")
.asString();
const data = JSON.stringify({
addressConsentToken: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId',
headers: {'content-type': 'application/json'},
data: {addressConsentToken: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"addressConsentToken":""}'
};
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}}/async/V1/amazon-billing-address/:amazonOrderReferenceId',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "addressConsentToken": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"addressConsentToken\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId")
.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/async/V1/amazon-billing-address/:amazonOrderReferenceId',
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({addressConsentToken: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId',
headers: {'content-type': 'application/json'},
body: {addressConsentToken: ''},
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}}/async/V1/amazon-billing-address/:amazonOrderReferenceId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
addressConsentToken: ''
});
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}}/async/V1/amazon-billing-address/:amazonOrderReferenceId',
headers: {'content-type': 'application/json'},
data: {addressConsentToken: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"addressConsentToken":""}'
};
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 = @{ @"addressConsentToken": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId"]
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}}/async/V1/amazon-billing-address/:amazonOrderReferenceId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"addressConsentToken\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId",
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([
'addressConsentToken' => ''
]),
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}}/async/V1/amazon-billing-address/:amazonOrderReferenceId', [
'body' => '{
"addressConsentToken": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'addressConsentToken' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'addressConsentToken' => ''
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId');
$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}}/async/V1/amazon-billing-address/:amazonOrderReferenceId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"addressConsentToken": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"addressConsentToken": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"addressConsentToken\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/async/V1/amazon-billing-address/:amazonOrderReferenceId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId"
payload = { "addressConsentToken": "" }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId"
payload <- "{\n \"addressConsentToken\": \"\"\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}}/async/V1/amazon-billing-address/:amazonOrderReferenceId")
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 \"addressConsentToken\": \"\"\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/async/V1/amazon-billing-address/:amazonOrderReferenceId') do |req|
req.body = "{\n \"addressConsentToken\": \"\"\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}}/async/V1/amazon-billing-address/:amazonOrderReferenceId";
let payload = json!({"addressConsentToken": ""});
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}}/async/V1/amazon-billing-address/:amazonOrderReferenceId \
--header 'content-type: application/json' \
--data '{
"addressConsentToken": ""
}'
echo '{
"addressConsentToken": ""
}' | \
http PUT {{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "addressConsentToken": ""\n}' \
--output-document \
- {{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["addressConsentToken": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/amazon-billing-address/:amazonOrderReferenceId")! 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()
DELETE
amazon-order-ref
{{baseUrl}}/async/V1/amazon/order-ref
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/amazon/order-ref");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/async/V1/amazon/order-ref")
require "http/client"
url = "{{baseUrl}}/async/V1/amazon/order-ref"
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}}/async/V1/amazon/order-ref"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/async/V1/amazon/order-ref");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/amazon/order-ref"
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/async/V1/amazon/order-ref HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/async/V1/amazon/order-ref")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/amazon/order-ref"))
.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}}/async/V1/amazon/order-ref")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/async/V1/amazon/order-ref")
.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}}/async/V1/amazon/order-ref');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/async/V1/amazon/order-ref'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/amazon/order-ref';
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}}/async/V1/amazon/order-ref',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/amazon/order-ref")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/async/V1/amazon/order-ref',
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}}/async/V1/amazon/order-ref'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/async/V1/amazon/order-ref');
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}}/async/V1/amazon/order-ref'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/amazon/order-ref';
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}}/async/V1/amazon/order-ref"]
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}}/async/V1/amazon/order-ref" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/amazon/order-ref",
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}}/async/V1/amazon/order-ref');
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/amazon/order-ref');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/async/V1/amazon/order-ref');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/async/V1/amazon/order-ref' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/amazon/order-ref' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/async/V1/amazon/order-ref")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/amazon/order-ref"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/amazon/order-ref"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/async/V1/amazon/order-ref")
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/async/V1/amazon/order-ref') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/amazon/order-ref";
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}}/async/V1/amazon/order-ref
http DELETE {{baseUrl}}/async/V1/amazon/order-ref
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/async/V1/amazon/order-ref
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/amazon/order-ref")! 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()
PUT
amazon-shipping-address-{amazonOrderReferenceId}
{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId
QUERY PARAMS
amazonOrderReferenceId
BODY json
{
"addressConsentToken": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId");
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 \"addressConsentToken\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId" {:content-type :json
:form-params {:addressConsentToken ""}})
require "http/client"
url = "{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"addressConsentToken\": \"\"\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}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId"),
Content = new StringContent("{\n \"addressConsentToken\": \"\"\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}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"addressConsentToken\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId"
payload := strings.NewReader("{\n \"addressConsentToken\": \"\"\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/async/V1/amazon-shipping-address/:amazonOrderReferenceId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 31
{
"addressConsentToken": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId")
.setHeader("content-type", "application/json")
.setBody("{\n \"addressConsentToken\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"addressConsentToken\": \"\"\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 \"addressConsentToken\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId")
.header("content-type", "application/json")
.body("{\n \"addressConsentToken\": \"\"\n}")
.asString();
const data = JSON.stringify({
addressConsentToken: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId',
headers: {'content-type': 'application/json'},
data: {addressConsentToken: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"addressConsentToken":""}'
};
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}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "addressConsentToken": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"addressConsentToken\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId")
.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/async/V1/amazon-shipping-address/:amazonOrderReferenceId',
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({addressConsentToken: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId',
headers: {'content-type': 'application/json'},
body: {addressConsentToken: ''},
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}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
addressConsentToken: ''
});
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}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId',
headers: {'content-type': 'application/json'},
data: {addressConsentToken: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"addressConsentToken":""}'
};
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 = @{ @"addressConsentToken": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId"]
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}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"addressConsentToken\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId",
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([
'addressConsentToken' => ''
]),
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}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId', [
'body' => '{
"addressConsentToken": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'addressConsentToken' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'addressConsentToken' => ''
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId');
$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}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"addressConsentToken": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"addressConsentToken": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"addressConsentToken\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/async/V1/amazon-shipping-address/:amazonOrderReferenceId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId"
payload = { "addressConsentToken": "" }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId"
payload <- "{\n \"addressConsentToken\": \"\"\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}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId")
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 \"addressConsentToken\": \"\"\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/async/V1/amazon-shipping-address/:amazonOrderReferenceId') do |req|
req.body = "{\n \"addressConsentToken\": \"\"\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}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId";
let payload = json!({"addressConsentToken": ""});
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}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId \
--header 'content-type: application/json' \
--data '{
"addressConsentToken": ""
}'
echo '{
"addressConsentToken": ""
}' | \
http PUT {{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "addressConsentToken": ""\n}' \
--output-document \
- {{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["addressConsentToken": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/amazon-shipping-address/:amazonOrderReferenceId")! 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
carts-guest-carts-{cartId}-giftCards
{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards
QUERY PARAMS
cartId
BODY json
{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards");
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 \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards" {:content-type :json
:form-params {:giftCardAccountData {:gift_cards []
:gift_cards_amount ""
:base_gift_cards_amount ""
:gift_cards_amount_used ""
:base_gift_cards_amount_used ""
:extension_attributes {}}}})
require "http/client"
url = "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\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}}/async/V1/carts/guest-carts/:cartId/giftCards"),
Content = new StringContent("{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\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}}/async/V1/carts/guest-carts/:cartId/giftCards");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards"
payload := strings.NewReader("{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\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/async/V1/carts/guest-carts/:cartId/giftCards HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 223
{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards")
.setHeader("content-type", "application/json")
.setBody("{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\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 \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards")
.header("content-type", "application/json")
.body("{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}")
.asString();
const data = JSON.stringify({
giftCardAccountData: {
gift_cards: [],
gift_cards_amount: '',
base_gift_cards_amount: '',
gift_cards_amount_used: '',
base_gift_cards_amount_used: '',
extension_attributes: {}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards',
headers: {'content-type': 'application/json'},
data: {
giftCardAccountData: {
gift_cards: [],
gift_cards_amount: '',
base_gift_cards_amount: '',
gift_cards_amount_used: '',
base_gift_cards_amount_used: '',
extension_attributes: {}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"giftCardAccountData":{"gift_cards":[],"gift_cards_amount":"","base_gift_cards_amount":"","gift_cards_amount_used":"","base_gift_cards_amount_used":"","extension_attributes":{}}}'
};
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}}/async/V1/carts/guest-carts/:cartId/giftCards',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "giftCardAccountData": {\n "gift_cards": [],\n "gift_cards_amount": "",\n "base_gift_cards_amount": "",\n "gift_cards_amount_used": "",\n "base_gift_cards_amount_used": "",\n "extension_attributes": {}\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 \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards")
.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/async/V1/carts/guest-carts/:cartId/giftCards',
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({
giftCardAccountData: {
gift_cards: [],
gift_cards_amount: '',
base_gift_cards_amount: '',
gift_cards_amount_used: '',
base_gift_cards_amount_used: '',
extension_attributes: {}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards',
headers: {'content-type': 'application/json'},
body: {
giftCardAccountData: {
gift_cards: [],
gift_cards_amount: '',
base_gift_cards_amount: '',
gift_cards_amount_used: '',
base_gift_cards_amount_used: '',
extension_attributes: {}
}
},
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}}/async/V1/carts/guest-carts/:cartId/giftCards');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
giftCardAccountData: {
gift_cards: [],
gift_cards_amount: '',
base_gift_cards_amount: '',
gift_cards_amount_used: '',
base_gift_cards_amount_used: '',
extension_attributes: {}
}
});
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}}/async/V1/carts/guest-carts/:cartId/giftCards',
headers: {'content-type': 'application/json'},
data: {
giftCardAccountData: {
gift_cards: [],
gift_cards_amount: '',
base_gift_cards_amount: '',
gift_cards_amount_used: '',
base_gift_cards_amount_used: '',
extension_attributes: {}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"giftCardAccountData":{"gift_cards":[],"gift_cards_amount":"","base_gift_cards_amount":"","gift_cards_amount_used":"","base_gift_cards_amount_used":"","extension_attributes":{}}}'
};
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 = @{ @"giftCardAccountData": @{ @"gift_cards": @[ ], @"gift_cards_amount": @"", @"base_gift_cards_amount": @"", @"gift_cards_amount_used": @"", @"base_gift_cards_amount_used": @"", @"extension_attributes": @{ } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards"]
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}}/async/V1/carts/guest-carts/:cartId/giftCards" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards",
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([
'giftCardAccountData' => [
'gift_cards' => [
],
'gift_cards_amount' => '',
'base_gift_cards_amount' => '',
'gift_cards_amount_used' => '',
'base_gift_cards_amount_used' => '',
'extension_attributes' => [
]
]
]),
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}}/async/V1/carts/guest-carts/:cartId/giftCards', [
'body' => '{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'giftCardAccountData' => [
'gift_cards' => [
],
'gift_cards_amount' => '',
'base_gift_cards_amount' => '',
'gift_cards_amount_used' => '',
'base_gift_cards_amount_used' => '',
'extension_attributes' => [
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'giftCardAccountData' => [
'gift_cards' => [
],
'gift_cards_amount' => '',
'base_gift_cards_amount' => '',
'gift_cards_amount_used' => '',
'base_gift_cards_amount_used' => '',
'extension_attributes' => [
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards');
$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}}/async/V1/carts/guest-carts/:cartId/giftCards' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/carts/guest-carts/:cartId/giftCards", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards"
payload = { "giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards"
payload <- "{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\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}}/async/V1/carts/guest-carts/:cartId/giftCards")
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 \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\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/async/V1/carts/guest-carts/:cartId/giftCards') do |req|
req.body = "{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards";
let payload = json!({"giftCardAccountData": json!({
"gift_cards": (),
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": 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}}/async/V1/carts/guest-carts/:cartId/giftCards \
--header 'content-type: application/json' \
--data '{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}'
echo '{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}' | \
http POST {{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "giftCardAccountData": {\n "gift_cards": [],\n "gift_cards_amount": "",\n "base_gift_cards_amount": "",\n "gift_cards_amount_used": "",\n "base_gift_cards_amount_used": "",\n "extension_attributes": {}\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["giftCardAccountData": [
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": []
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards")! 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()
DELETE
carts-guest-carts-{cartId}-giftCards-{giftCardCode}
{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode
QUERY PARAMS
cartId
giftCardCode
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode")
require "http/client"
url = "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode"
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}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode"
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/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode"))
.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}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode")
.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}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode';
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}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode',
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}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode');
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}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode';
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}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode"]
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}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode",
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}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode');
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode")
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/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode";
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}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode
http DELETE {{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode")! 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()
PUT
carts-mine
{{baseUrl}}/async/V1/carts/mine
BODY json
{
"quote": {
"id": 0,
"created_at": "",
"updated_at": "",
"converted_at": "",
"is_active": false,
"is_virtual": false,
"items": [
{
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
],
"items_count": 0,
"items_qty": "",
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"billing_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{}
],
"gift_registry_id": 0
},
"custom_attributes": [
{}
]
},
"reserved_order_id": "",
"orig_order_id": 0,
"currency": {
"global_currency_code": "",
"base_currency_code": "",
"store_currency_code": "",
"quote_currency_code": "",
"store_to_base_rate": "",
"store_to_quote_rate": "",
"base_to_global_rate": "",
"base_to_quote_rate": "",
"extension_attributes": {}
},
"customer_is_guest": false,
"customer_note": "",
"customer_note_notify": false,
"customer_tax_class_id": 0,
"store_id": 0,
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {},
"method": "",
"extension_attributes": {}
},
"items": [
{}
],
"extension_attributes": {}
}
],
"negotiable_quote": {
"quote_id": 0,
"is_regular_quote": false,
"status": "",
"negotiated_price_type": 0,
"negotiated_price_value": "",
"shipping_price": "",
"quote_name": "",
"expiration_period": "",
"email_notification_status": 0,
"has_unconfirmed_changes": false,
"is_shipping_tax_changed": false,
"is_customer_price_changed": false,
"notifications": 0,
"applied_rule_ids": "",
"is_address_draft": false,
"deleted_sku": "",
"creator_id": 0,
"creator_type": 0,
"original_total_price": "",
"base_original_total_price": "",
"negotiated_total_price": "",
"base_negotiated_total_price": "",
"extension_attributes": {}
},
"amazon_order_reference_id": {
"id": "",
"amazon_order_reference_id": "",
"quote_id": 0,
"sandbox_simulation_reference": "",
"confirmed": false
}
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/carts/mine");
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 \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\n }\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/carts/mine" {:content-type :json
:form-params {:quote {:id 0
:created_at ""
:updated_at ""
:converted_at ""
:is_active false
:is_virtual false
:items [{:item_id 0
:sku ""
:qty ""
:name ""
:price ""
:product_type ""
:quote_id ""
:product_option {:extension_attributes {:custom_options [{:option_id ""
:option_value ""
:extension_attributes {:file_info {:base64_encoded_data ""
:type ""
:name ""}}}]
:bundle_options [{:option_id 0
:option_qty 0
:option_selections []
:extension_attributes {}}]
:configurable_item_options [{:option_id ""
:option_value 0
:extension_attributes {}}]
:downloadable_option {:downloadable_links []}
:giftcard_item_option {:giftcard_amount ""
:custom_giftcard_amount ""
:giftcard_sender_name ""
:giftcard_recipient_name ""
:giftcard_sender_email ""
:giftcard_recipient_email ""
:giftcard_message ""
:extension_attributes {:giftcard_created_codes []}}}}
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:negotiable_quote_item {:item_id 0
:original_price ""
:original_tax_amount ""
:original_discount_amount ""
:extension_attributes {}}}}]
:items_count 0
:items_qty ""
:customer {:id 0
:group_id 0
:default_billing ""
:default_shipping ""
:confirmation ""
:created_at ""
:updated_at ""
:created_in ""
:dob ""
:email ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:gender 0
:store_id 0
:taxvat ""
:website_id 0
:addresses [{:id 0
:customer_id 0
:region {:region_code ""
:region ""
:region_id 0
:extension_attributes {}}
:region_id 0
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:default_shipping false
:default_billing false
:extension_attributes {}
:custom_attributes [{:attribute_code ""
:value ""}]}]
:disable_auto_group_change 0
:extension_attributes {:company_attributes {:customer_id 0
:company_id 0
:job_title ""
:status 0
:telephone ""
:extension_attributes {}}
:is_subscribed false
:amazon_id ""
:vertex_customer_code ""}
:custom_attributes [{}]}
:billing_address {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{}]
:gift_registry_id 0}
:custom_attributes [{}]}
:reserved_order_id ""
:orig_order_id 0
:currency {:global_currency_code ""
:base_currency_code ""
:store_currency_code ""
:quote_currency_code ""
:store_to_base_rate ""
:store_to_quote_rate ""
:base_to_global_rate ""
:base_to_quote_rate ""
:extension_attributes {}}
:customer_is_guest false
:customer_note ""
:customer_note_notify false
:customer_tax_class_id 0
:store_id 0
:extension_attributes {:shipping_assignments [{:shipping {:address {}
:method ""
:extension_attributes {}}
:items [{}]
:extension_attributes {}}]
:negotiable_quote {:quote_id 0
:is_regular_quote false
:status ""
:negotiated_price_type 0
:negotiated_price_value ""
:shipping_price ""
:quote_name ""
:expiration_period ""
:email_notification_status 0
:has_unconfirmed_changes false
:is_shipping_tax_changed false
:is_customer_price_changed false
:notifications 0
:applied_rule_ids ""
:is_address_draft false
:deleted_sku ""
:creator_id 0
:creator_type 0
:original_total_price ""
:base_original_total_price ""
:negotiated_total_price ""
:base_negotiated_total_price ""
:extension_attributes {}}
:amazon_order_reference_id {:id ""
:amazon_order_reference_id ""
:quote_id 0
:sandbox_simulation_reference ""
:confirmed false}}}}})
require "http/client"
url = "{{baseUrl}}/async/V1/carts/mine"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\n }\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}}/async/V1/carts/mine"),
Content = new StringContent("{\n \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\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}}/async/V1/carts/mine");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\n }\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/carts/mine"
payload := strings.NewReader("{\n \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\n }\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/async/V1/carts/mine HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 6669
{
"quote": {
"id": 0,
"created_at": "",
"updated_at": "",
"converted_at": "",
"is_active": false,
"is_virtual": false,
"items": [
{
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
],
"items_count": 0,
"items_qty": "",
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"billing_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{}
],
"gift_registry_id": 0
},
"custom_attributes": [
{}
]
},
"reserved_order_id": "",
"orig_order_id": 0,
"currency": {
"global_currency_code": "",
"base_currency_code": "",
"store_currency_code": "",
"quote_currency_code": "",
"store_to_base_rate": "",
"store_to_quote_rate": "",
"base_to_global_rate": "",
"base_to_quote_rate": "",
"extension_attributes": {}
},
"customer_is_guest": false,
"customer_note": "",
"customer_note_notify": false,
"customer_tax_class_id": 0,
"store_id": 0,
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {},
"method": "",
"extension_attributes": {}
},
"items": [
{}
],
"extension_attributes": {}
}
],
"negotiable_quote": {
"quote_id": 0,
"is_regular_quote": false,
"status": "",
"negotiated_price_type": 0,
"negotiated_price_value": "",
"shipping_price": "",
"quote_name": "",
"expiration_period": "",
"email_notification_status": 0,
"has_unconfirmed_changes": false,
"is_shipping_tax_changed": false,
"is_customer_price_changed": false,
"notifications": 0,
"applied_rule_ids": "",
"is_address_draft": false,
"deleted_sku": "",
"creator_id": 0,
"creator_type": 0,
"original_total_price": "",
"base_original_total_price": "",
"negotiated_total_price": "",
"base_negotiated_total_price": "",
"extension_attributes": {}
},
"amazon_order_reference_id": {
"id": "",
"amazon_order_reference_id": "",
"quote_id": 0,
"sandbox_simulation_reference": "",
"confirmed": false
}
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/carts/mine")
.setHeader("content-type", "application/json")
.setBody("{\n \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\n }\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/carts/mine"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\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 \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\n }\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/carts/mine")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/carts/mine")
.header("content-type", "application/json")
.body("{\n \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\n }\n }\n }\n}")
.asString();
const data = JSON.stringify({
quote: {
id: 0,
created_at: '',
updated_at: '',
converted_at: '',
is_active: false,
is_virtual: false,
items: [
{
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {
file_info: {
base64_encoded_data: '',
type: '',
name: ''
}
}
}
],
bundle_options: [
{
option_id: 0,
option_qty: 0,
option_selections: [],
extension_attributes: {}
}
],
configurable_item_options: [
{
option_id: '',
option_value: 0,
extension_attributes: {}
}
],
downloadable_option: {
downloadable_links: []
},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {
giftcard_created_codes: []
}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
],
items_count: 0,
items_qty: '',
customer: {
id: 0,
group_id: 0,
default_billing: '',
default_shipping: '',
confirmation: '',
created_at: '',
updated_at: '',
created_in: '',
dob: '',
email: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
gender: 0,
store_id: 0,
taxvat: '',
website_id: 0,
addresses: [
{
id: 0,
customer_id: 0,
region: {
region_code: '',
region: '',
region_id: 0,
extension_attributes: {}
},
region_id: 0,
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
default_shipping: false,
default_billing: false,
extension_attributes: {},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
],
disable_auto_group_change: 0,
extension_attributes: {
company_attributes: {
customer_id: 0,
company_id: 0,
job_title: '',
status: 0,
telephone: '',
extension_attributes: {}
},
is_subscribed: false,
amazon_id: '',
vertex_customer_code: ''
},
custom_attributes: [
{}
]
},
billing_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{}
],
gift_registry_id: 0
},
custom_attributes: [
{}
]
},
reserved_order_id: '',
orig_order_id: 0,
currency: {
global_currency_code: '',
base_currency_code: '',
store_currency_code: '',
quote_currency_code: '',
store_to_base_rate: '',
store_to_quote_rate: '',
base_to_global_rate: '',
base_to_quote_rate: '',
extension_attributes: {}
},
customer_is_guest: false,
customer_note: '',
customer_note_notify: false,
customer_tax_class_id: 0,
store_id: 0,
extension_attributes: {
shipping_assignments: [
{
shipping: {
address: {},
method: '',
extension_attributes: {}
},
items: [
{}
],
extension_attributes: {}
}
],
negotiable_quote: {
quote_id: 0,
is_regular_quote: false,
status: '',
negotiated_price_type: 0,
negotiated_price_value: '',
shipping_price: '',
quote_name: '',
expiration_period: '',
email_notification_status: 0,
has_unconfirmed_changes: false,
is_shipping_tax_changed: false,
is_customer_price_changed: false,
notifications: 0,
applied_rule_ids: '',
is_address_draft: false,
deleted_sku: '',
creator_id: 0,
creator_type: 0,
original_total_price: '',
base_original_total_price: '',
negotiated_total_price: '',
base_negotiated_total_price: '',
extension_attributes: {}
},
amazon_order_reference_id: {
id: '',
amazon_order_reference_id: '',
quote_id: 0,
sandbox_simulation_reference: '',
confirmed: false
}
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/async/V1/carts/mine');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/carts/mine',
headers: {'content-type': 'application/json'},
data: {
quote: {
id: 0,
created_at: '',
updated_at: '',
converted_at: '',
is_active: false,
is_virtual: false,
items: [
{
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {file_info: {base64_encoded_data: '', type: '', name: ''}}
}
],
bundle_options: [{option_id: 0, option_qty: 0, option_selections: [], extension_attributes: {}}],
configurable_item_options: [{option_id: '', option_value: 0, extension_attributes: {}}],
downloadable_option: {downloadable_links: []},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {giftcard_created_codes: []}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
],
items_count: 0,
items_qty: '',
customer: {
id: 0,
group_id: 0,
default_billing: '',
default_shipping: '',
confirmation: '',
created_at: '',
updated_at: '',
created_in: '',
dob: '',
email: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
gender: 0,
store_id: 0,
taxvat: '',
website_id: 0,
addresses: [
{
id: 0,
customer_id: 0,
region: {region_code: '', region: '', region_id: 0, extension_attributes: {}},
region_id: 0,
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
default_shipping: false,
default_billing: false,
extension_attributes: {},
custom_attributes: [{attribute_code: '', value: ''}]
}
],
disable_auto_group_change: 0,
extension_attributes: {
company_attributes: {
customer_id: 0,
company_id: 0,
job_title: '',
status: 0,
telephone: '',
extension_attributes: {}
},
is_subscribed: false,
amazon_id: '',
vertex_customer_code: ''
},
custom_attributes: [{}]
},
billing_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {discounts: [{}], gift_registry_id: 0},
custom_attributes: [{}]
},
reserved_order_id: '',
orig_order_id: 0,
currency: {
global_currency_code: '',
base_currency_code: '',
store_currency_code: '',
quote_currency_code: '',
store_to_base_rate: '',
store_to_quote_rate: '',
base_to_global_rate: '',
base_to_quote_rate: '',
extension_attributes: {}
},
customer_is_guest: false,
customer_note: '',
customer_note_notify: false,
customer_tax_class_id: 0,
store_id: 0,
extension_attributes: {
shipping_assignments: [
{
shipping: {address: {}, method: '', extension_attributes: {}},
items: [{}],
extension_attributes: {}
}
],
negotiable_quote: {
quote_id: 0,
is_regular_quote: false,
status: '',
negotiated_price_type: 0,
negotiated_price_value: '',
shipping_price: '',
quote_name: '',
expiration_period: '',
email_notification_status: 0,
has_unconfirmed_changes: false,
is_shipping_tax_changed: false,
is_customer_price_changed: false,
notifications: 0,
applied_rule_ids: '',
is_address_draft: false,
deleted_sku: '',
creator_id: 0,
creator_type: 0,
original_total_price: '',
base_original_total_price: '',
negotiated_total_price: '',
base_negotiated_total_price: '',
extension_attributes: {}
},
amazon_order_reference_id: {
id: '',
amazon_order_reference_id: '',
quote_id: 0,
sandbox_simulation_reference: '',
confirmed: false
}
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/carts/mine';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"quote":{"id":0,"created_at":"","updated_at":"","converted_at":"","is_active":false,"is_virtual":false,"items":[{"item_id":0,"sku":"","qty":"","name":"","price":"","product_type":"","quote_id":"","product_option":{"extension_attributes":{"custom_options":[{"option_id":"","option_value":"","extension_attributes":{"file_info":{"base64_encoded_data":"","type":"","name":""}}}],"bundle_options":[{"option_id":0,"option_qty":0,"option_selections":[],"extension_attributes":{}}],"configurable_item_options":[{"option_id":"","option_value":0,"extension_attributes":{}}],"downloadable_option":{"downloadable_links":[]},"giftcard_item_option":{"giftcard_amount":"","custom_giftcard_amount":"","giftcard_sender_name":"","giftcard_recipient_name":"","giftcard_sender_email":"","giftcard_recipient_email":"","giftcard_message":"","extension_attributes":{"giftcard_created_codes":[]}}}},"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"negotiable_quote_item":{"item_id":0,"original_price":"","original_tax_amount":"","original_discount_amount":"","extension_attributes":{}}}}],"items_count":0,"items_qty":"","customer":{"id":0,"group_id":0,"default_billing":"","default_shipping":"","confirmation":"","created_at":"","updated_at":"","created_in":"","dob":"","email":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","gender":0,"store_id":0,"taxvat":"","website_id":0,"addresses":[{"id":0,"customer_id":0,"region":{"region_code":"","region":"","region_id":0,"extension_attributes":{}},"region_id":0,"country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","default_shipping":false,"default_billing":false,"extension_attributes":{},"custom_attributes":[{"attribute_code":"","value":""}]}],"disable_auto_group_change":0,"extension_attributes":{"company_attributes":{"customer_id":0,"company_id":0,"job_title":"","status":0,"telephone":"","extension_attributes":{}},"is_subscribed":false,"amazon_id":"","vertex_customer_code":""},"custom_attributes":[{}]},"billing_address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{}],"gift_registry_id":0},"custom_attributes":[{}]},"reserved_order_id":"","orig_order_id":0,"currency":{"global_currency_code":"","base_currency_code":"","store_currency_code":"","quote_currency_code":"","store_to_base_rate":"","store_to_quote_rate":"","base_to_global_rate":"","base_to_quote_rate":"","extension_attributes":{}},"customer_is_guest":false,"customer_note":"","customer_note_notify":false,"customer_tax_class_id":0,"store_id":0,"extension_attributes":{"shipping_assignments":[{"shipping":{"address":{},"method":"","extension_attributes":{}},"items":[{}],"extension_attributes":{}}],"negotiable_quote":{"quote_id":0,"is_regular_quote":false,"status":"","negotiated_price_type":0,"negotiated_price_value":"","shipping_price":"","quote_name":"","expiration_period":"","email_notification_status":0,"has_unconfirmed_changes":false,"is_shipping_tax_changed":false,"is_customer_price_changed":false,"notifications":0,"applied_rule_ids":"","is_address_draft":false,"deleted_sku":"","creator_id":0,"creator_type":0,"original_total_price":"","base_original_total_price":"","negotiated_total_price":"","base_negotiated_total_price":"","extension_attributes":{}},"amazon_order_reference_id":{"id":"","amazon_order_reference_id":"","quote_id":0,"sandbox_simulation_reference":"","confirmed":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}}/async/V1/carts/mine',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "quote": {\n "id": 0,\n "created_at": "",\n "updated_at": "",\n "converted_at": "",\n "is_active": false,\n "is_virtual": false,\n "items": [\n {\n "item_id": 0,\n "sku": "",\n "qty": "",\n "name": "",\n "price": "",\n "product_type": "",\n "quote_id": "",\n "product_option": {\n "extension_attributes": {\n "custom_options": [\n {\n "option_id": "",\n "option_value": "",\n "extension_attributes": {\n "file_info": {\n "base64_encoded_data": "",\n "type": "",\n "name": ""\n }\n }\n }\n ],\n "bundle_options": [\n {\n "option_id": 0,\n "option_qty": 0,\n "option_selections": [],\n "extension_attributes": {}\n }\n ],\n "configurable_item_options": [\n {\n "option_id": "",\n "option_value": 0,\n "extension_attributes": {}\n }\n ],\n "downloadable_option": {\n "downloadable_links": []\n },\n "giftcard_item_option": {\n "giftcard_amount": "",\n "custom_giftcard_amount": "",\n "giftcard_sender_name": "",\n "giftcard_recipient_name": "",\n "giftcard_sender_email": "",\n "giftcard_recipient_email": "",\n "giftcard_message": "",\n "extension_attributes": {\n "giftcard_created_codes": []\n }\n }\n }\n },\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "negotiable_quote_item": {\n "item_id": 0,\n "original_price": "",\n "original_tax_amount": "",\n "original_discount_amount": "",\n "extension_attributes": {}\n }\n }\n }\n ],\n "items_count": 0,\n "items_qty": "",\n "customer": {\n "id": 0,\n "group_id": 0,\n "default_billing": "",\n "default_shipping": "",\n "confirmation": "",\n "created_at": "",\n "updated_at": "",\n "created_in": "",\n "dob": "",\n "email": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "gender": 0,\n "store_id": 0,\n "taxvat": "",\n "website_id": 0,\n "addresses": [\n {\n "id": 0,\n "customer_id": 0,\n "region": {\n "region_code": "",\n "region": "",\n "region_id": 0,\n "extension_attributes": {}\n },\n "region_id": 0,\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "default_shipping": false,\n "default_billing": false,\n "extension_attributes": {},\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n ],\n "disable_auto_group_change": 0,\n "extension_attributes": {\n "company_attributes": {\n "customer_id": 0,\n "company_id": 0,\n "job_title": "",\n "status": 0,\n "telephone": "",\n "extension_attributes": {}\n },\n "is_subscribed": false,\n "amazon_id": "",\n "vertex_customer_code": ""\n },\n "custom_attributes": [\n {}\n ]\n },\n "billing_address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {}\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {}\n ]\n },\n "reserved_order_id": "",\n "orig_order_id": 0,\n "currency": {\n "global_currency_code": "",\n "base_currency_code": "",\n "store_currency_code": "",\n "quote_currency_code": "",\n "store_to_base_rate": "",\n "store_to_quote_rate": "",\n "base_to_global_rate": "",\n "base_to_quote_rate": "",\n "extension_attributes": {}\n },\n "customer_is_guest": false,\n "customer_note": "",\n "customer_note_notify": false,\n "customer_tax_class_id": 0,\n "store_id": 0,\n "extension_attributes": {\n "shipping_assignments": [\n {\n "shipping": {\n "address": {},\n "method": "",\n "extension_attributes": {}\n },\n "items": [\n {}\n ],\n "extension_attributes": {}\n }\n ],\n "negotiable_quote": {\n "quote_id": 0,\n "is_regular_quote": false,\n "status": "",\n "negotiated_price_type": 0,\n "negotiated_price_value": "",\n "shipping_price": "",\n "quote_name": "",\n "expiration_period": "",\n "email_notification_status": 0,\n "has_unconfirmed_changes": false,\n "is_shipping_tax_changed": false,\n "is_customer_price_changed": false,\n "notifications": 0,\n "applied_rule_ids": "",\n "is_address_draft": false,\n "deleted_sku": "",\n "creator_id": 0,\n "creator_type": 0,\n "original_total_price": "",\n "base_original_total_price": "",\n "negotiated_total_price": "",\n "base_negotiated_total_price": "",\n "extension_attributes": {}\n },\n "amazon_order_reference_id": {\n "id": "",\n "amazon_order_reference_id": "",\n "quote_id": 0,\n "sandbox_simulation_reference": "",\n "confirmed": false\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 \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\n }\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/carts/mine")
.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/async/V1/carts/mine',
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({
quote: {
id: 0,
created_at: '',
updated_at: '',
converted_at: '',
is_active: false,
is_virtual: false,
items: [
{
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {file_info: {base64_encoded_data: '', type: '', name: ''}}
}
],
bundle_options: [{option_id: 0, option_qty: 0, option_selections: [], extension_attributes: {}}],
configurable_item_options: [{option_id: '', option_value: 0, extension_attributes: {}}],
downloadable_option: {downloadable_links: []},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {giftcard_created_codes: []}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
],
items_count: 0,
items_qty: '',
customer: {
id: 0,
group_id: 0,
default_billing: '',
default_shipping: '',
confirmation: '',
created_at: '',
updated_at: '',
created_in: '',
dob: '',
email: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
gender: 0,
store_id: 0,
taxvat: '',
website_id: 0,
addresses: [
{
id: 0,
customer_id: 0,
region: {region_code: '', region: '', region_id: 0, extension_attributes: {}},
region_id: 0,
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
default_shipping: false,
default_billing: false,
extension_attributes: {},
custom_attributes: [{attribute_code: '', value: ''}]
}
],
disable_auto_group_change: 0,
extension_attributes: {
company_attributes: {
customer_id: 0,
company_id: 0,
job_title: '',
status: 0,
telephone: '',
extension_attributes: {}
},
is_subscribed: false,
amazon_id: '',
vertex_customer_code: ''
},
custom_attributes: [{}]
},
billing_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {discounts: [{}], gift_registry_id: 0},
custom_attributes: [{}]
},
reserved_order_id: '',
orig_order_id: 0,
currency: {
global_currency_code: '',
base_currency_code: '',
store_currency_code: '',
quote_currency_code: '',
store_to_base_rate: '',
store_to_quote_rate: '',
base_to_global_rate: '',
base_to_quote_rate: '',
extension_attributes: {}
},
customer_is_guest: false,
customer_note: '',
customer_note_notify: false,
customer_tax_class_id: 0,
store_id: 0,
extension_attributes: {
shipping_assignments: [
{
shipping: {address: {}, method: '', extension_attributes: {}},
items: [{}],
extension_attributes: {}
}
],
negotiable_quote: {
quote_id: 0,
is_regular_quote: false,
status: '',
negotiated_price_type: 0,
negotiated_price_value: '',
shipping_price: '',
quote_name: '',
expiration_period: '',
email_notification_status: 0,
has_unconfirmed_changes: false,
is_shipping_tax_changed: false,
is_customer_price_changed: false,
notifications: 0,
applied_rule_ids: '',
is_address_draft: false,
deleted_sku: '',
creator_id: 0,
creator_type: 0,
original_total_price: '',
base_original_total_price: '',
negotiated_total_price: '',
base_negotiated_total_price: '',
extension_attributes: {}
},
amazon_order_reference_id: {
id: '',
amazon_order_reference_id: '',
quote_id: 0,
sandbox_simulation_reference: '',
confirmed: false
}
}
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/carts/mine',
headers: {'content-type': 'application/json'},
body: {
quote: {
id: 0,
created_at: '',
updated_at: '',
converted_at: '',
is_active: false,
is_virtual: false,
items: [
{
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {file_info: {base64_encoded_data: '', type: '', name: ''}}
}
],
bundle_options: [{option_id: 0, option_qty: 0, option_selections: [], extension_attributes: {}}],
configurable_item_options: [{option_id: '', option_value: 0, extension_attributes: {}}],
downloadable_option: {downloadable_links: []},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {giftcard_created_codes: []}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
],
items_count: 0,
items_qty: '',
customer: {
id: 0,
group_id: 0,
default_billing: '',
default_shipping: '',
confirmation: '',
created_at: '',
updated_at: '',
created_in: '',
dob: '',
email: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
gender: 0,
store_id: 0,
taxvat: '',
website_id: 0,
addresses: [
{
id: 0,
customer_id: 0,
region: {region_code: '', region: '', region_id: 0, extension_attributes: {}},
region_id: 0,
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
default_shipping: false,
default_billing: false,
extension_attributes: {},
custom_attributes: [{attribute_code: '', value: ''}]
}
],
disable_auto_group_change: 0,
extension_attributes: {
company_attributes: {
customer_id: 0,
company_id: 0,
job_title: '',
status: 0,
telephone: '',
extension_attributes: {}
},
is_subscribed: false,
amazon_id: '',
vertex_customer_code: ''
},
custom_attributes: [{}]
},
billing_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {discounts: [{}], gift_registry_id: 0},
custom_attributes: [{}]
},
reserved_order_id: '',
orig_order_id: 0,
currency: {
global_currency_code: '',
base_currency_code: '',
store_currency_code: '',
quote_currency_code: '',
store_to_base_rate: '',
store_to_quote_rate: '',
base_to_global_rate: '',
base_to_quote_rate: '',
extension_attributes: {}
},
customer_is_guest: false,
customer_note: '',
customer_note_notify: false,
customer_tax_class_id: 0,
store_id: 0,
extension_attributes: {
shipping_assignments: [
{
shipping: {address: {}, method: '', extension_attributes: {}},
items: [{}],
extension_attributes: {}
}
],
negotiable_quote: {
quote_id: 0,
is_regular_quote: false,
status: '',
negotiated_price_type: 0,
negotiated_price_value: '',
shipping_price: '',
quote_name: '',
expiration_period: '',
email_notification_status: 0,
has_unconfirmed_changes: false,
is_shipping_tax_changed: false,
is_customer_price_changed: false,
notifications: 0,
applied_rule_ids: '',
is_address_draft: false,
deleted_sku: '',
creator_id: 0,
creator_type: 0,
original_total_price: '',
base_original_total_price: '',
negotiated_total_price: '',
base_negotiated_total_price: '',
extension_attributes: {}
},
amazon_order_reference_id: {
id: '',
amazon_order_reference_id: '',
quote_id: 0,
sandbox_simulation_reference: '',
confirmed: 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('PUT', '{{baseUrl}}/async/V1/carts/mine');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
quote: {
id: 0,
created_at: '',
updated_at: '',
converted_at: '',
is_active: false,
is_virtual: false,
items: [
{
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {
file_info: {
base64_encoded_data: '',
type: '',
name: ''
}
}
}
],
bundle_options: [
{
option_id: 0,
option_qty: 0,
option_selections: [],
extension_attributes: {}
}
],
configurable_item_options: [
{
option_id: '',
option_value: 0,
extension_attributes: {}
}
],
downloadable_option: {
downloadable_links: []
},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {
giftcard_created_codes: []
}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
],
items_count: 0,
items_qty: '',
customer: {
id: 0,
group_id: 0,
default_billing: '',
default_shipping: '',
confirmation: '',
created_at: '',
updated_at: '',
created_in: '',
dob: '',
email: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
gender: 0,
store_id: 0,
taxvat: '',
website_id: 0,
addresses: [
{
id: 0,
customer_id: 0,
region: {
region_code: '',
region: '',
region_id: 0,
extension_attributes: {}
},
region_id: 0,
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
default_shipping: false,
default_billing: false,
extension_attributes: {},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
],
disable_auto_group_change: 0,
extension_attributes: {
company_attributes: {
customer_id: 0,
company_id: 0,
job_title: '',
status: 0,
telephone: '',
extension_attributes: {}
},
is_subscribed: false,
amazon_id: '',
vertex_customer_code: ''
},
custom_attributes: [
{}
]
},
billing_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{}
],
gift_registry_id: 0
},
custom_attributes: [
{}
]
},
reserved_order_id: '',
orig_order_id: 0,
currency: {
global_currency_code: '',
base_currency_code: '',
store_currency_code: '',
quote_currency_code: '',
store_to_base_rate: '',
store_to_quote_rate: '',
base_to_global_rate: '',
base_to_quote_rate: '',
extension_attributes: {}
},
customer_is_guest: false,
customer_note: '',
customer_note_notify: false,
customer_tax_class_id: 0,
store_id: 0,
extension_attributes: {
shipping_assignments: [
{
shipping: {
address: {},
method: '',
extension_attributes: {}
},
items: [
{}
],
extension_attributes: {}
}
],
negotiable_quote: {
quote_id: 0,
is_regular_quote: false,
status: '',
negotiated_price_type: 0,
negotiated_price_value: '',
shipping_price: '',
quote_name: '',
expiration_period: '',
email_notification_status: 0,
has_unconfirmed_changes: false,
is_shipping_tax_changed: false,
is_customer_price_changed: false,
notifications: 0,
applied_rule_ids: '',
is_address_draft: false,
deleted_sku: '',
creator_id: 0,
creator_type: 0,
original_total_price: '',
base_original_total_price: '',
negotiated_total_price: '',
base_negotiated_total_price: '',
extension_attributes: {}
},
amazon_order_reference_id: {
id: '',
amazon_order_reference_id: '',
quote_id: 0,
sandbox_simulation_reference: '',
confirmed: 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: 'PUT',
url: '{{baseUrl}}/async/V1/carts/mine',
headers: {'content-type': 'application/json'},
data: {
quote: {
id: 0,
created_at: '',
updated_at: '',
converted_at: '',
is_active: false,
is_virtual: false,
items: [
{
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {file_info: {base64_encoded_data: '', type: '', name: ''}}
}
],
bundle_options: [{option_id: 0, option_qty: 0, option_selections: [], extension_attributes: {}}],
configurable_item_options: [{option_id: '', option_value: 0, extension_attributes: {}}],
downloadable_option: {downloadable_links: []},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {giftcard_created_codes: []}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
],
items_count: 0,
items_qty: '',
customer: {
id: 0,
group_id: 0,
default_billing: '',
default_shipping: '',
confirmation: '',
created_at: '',
updated_at: '',
created_in: '',
dob: '',
email: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
gender: 0,
store_id: 0,
taxvat: '',
website_id: 0,
addresses: [
{
id: 0,
customer_id: 0,
region: {region_code: '', region: '', region_id: 0, extension_attributes: {}},
region_id: 0,
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
default_shipping: false,
default_billing: false,
extension_attributes: {},
custom_attributes: [{attribute_code: '', value: ''}]
}
],
disable_auto_group_change: 0,
extension_attributes: {
company_attributes: {
customer_id: 0,
company_id: 0,
job_title: '',
status: 0,
telephone: '',
extension_attributes: {}
},
is_subscribed: false,
amazon_id: '',
vertex_customer_code: ''
},
custom_attributes: [{}]
},
billing_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {discounts: [{}], gift_registry_id: 0},
custom_attributes: [{}]
},
reserved_order_id: '',
orig_order_id: 0,
currency: {
global_currency_code: '',
base_currency_code: '',
store_currency_code: '',
quote_currency_code: '',
store_to_base_rate: '',
store_to_quote_rate: '',
base_to_global_rate: '',
base_to_quote_rate: '',
extension_attributes: {}
},
customer_is_guest: false,
customer_note: '',
customer_note_notify: false,
customer_tax_class_id: 0,
store_id: 0,
extension_attributes: {
shipping_assignments: [
{
shipping: {address: {}, method: '', extension_attributes: {}},
items: [{}],
extension_attributes: {}
}
],
negotiable_quote: {
quote_id: 0,
is_regular_quote: false,
status: '',
negotiated_price_type: 0,
negotiated_price_value: '',
shipping_price: '',
quote_name: '',
expiration_period: '',
email_notification_status: 0,
has_unconfirmed_changes: false,
is_shipping_tax_changed: false,
is_customer_price_changed: false,
notifications: 0,
applied_rule_ids: '',
is_address_draft: false,
deleted_sku: '',
creator_id: 0,
creator_type: 0,
original_total_price: '',
base_original_total_price: '',
negotiated_total_price: '',
base_negotiated_total_price: '',
extension_attributes: {}
},
amazon_order_reference_id: {
id: '',
amazon_order_reference_id: '',
quote_id: 0,
sandbox_simulation_reference: '',
confirmed: false
}
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/carts/mine';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"quote":{"id":0,"created_at":"","updated_at":"","converted_at":"","is_active":false,"is_virtual":false,"items":[{"item_id":0,"sku":"","qty":"","name":"","price":"","product_type":"","quote_id":"","product_option":{"extension_attributes":{"custom_options":[{"option_id":"","option_value":"","extension_attributes":{"file_info":{"base64_encoded_data":"","type":"","name":""}}}],"bundle_options":[{"option_id":0,"option_qty":0,"option_selections":[],"extension_attributes":{}}],"configurable_item_options":[{"option_id":"","option_value":0,"extension_attributes":{}}],"downloadable_option":{"downloadable_links":[]},"giftcard_item_option":{"giftcard_amount":"","custom_giftcard_amount":"","giftcard_sender_name":"","giftcard_recipient_name":"","giftcard_sender_email":"","giftcard_recipient_email":"","giftcard_message":"","extension_attributes":{"giftcard_created_codes":[]}}}},"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"negotiable_quote_item":{"item_id":0,"original_price":"","original_tax_amount":"","original_discount_amount":"","extension_attributes":{}}}}],"items_count":0,"items_qty":"","customer":{"id":0,"group_id":0,"default_billing":"","default_shipping":"","confirmation":"","created_at":"","updated_at":"","created_in":"","dob":"","email":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","gender":0,"store_id":0,"taxvat":"","website_id":0,"addresses":[{"id":0,"customer_id":0,"region":{"region_code":"","region":"","region_id":0,"extension_attributes":{}},"region_id":0,"country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","default_shipping":false,"default_billing":false,"extension_attributes":{},"custom_attributes":[{"attribute_code":"","value":""}]}],"disable_auto_group_change":0,"extension_attributes":{"company_attributes":{"customer_id":0,"company_id":0,"job_title":"","status":0,"telephone":"","extension_attributes":{}},"is_subscribed":false,"amazon_id":"","vertex_customer_code":""},"custom_attributes":[{}]},"billing_address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{}],"gift_registry_id":0},"custom_attributes":[{}]},"reserved_order_id":"","orig_order_id":0,"currency":{"global_currency_code":"","base_currency_code":"","store_currency_code":"","quote_currency_code":"","store_to_base_rate":"","store_to_quote_rate":"","base_to_global_rate":"","base_to_quote_rate":"","extension_attributes":{}},"customer_is_guest":false,"customer_note":"","customer_note_notify":false,"customer_tax_class_id":0,"store_id":0,"extension_attributes":{"shipping_assignments":[{"shipping":{"address":{},"method":"","extension_attributes":{}},"items":[{}],"extension_attributes":{}}],"negotiable_quote":{"quote_id":0,"is_regular_quote":false,"status":"","negotiated_price_type":0,"negotiated_price_value":"","shipping_price":"","quote_name":"","expiration_period":"","email_notification_status":0,"has_unconfirmed_changes":false,"is_shipping_tax_changed":false,"is_customer_price_changed":false,"notifications":0,"applied_rule_ids":"","is_address_draft":false,"deleted_sku":"","creator_id":0,"creator_type":0,"original_total_price":"","base_original_total_price":"","negotiated_total_price":"","base_negotiated_total_price":"","extension_attributes":{}},"amazon_order_reference_id":{"id":"","amazon_order_reference_id":"","quote_id":0,"sandbox_simulation_reference":"","confirmed":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 = @{ @"quote": @{ @"id": @0, @"created_at": @"", @"updated_at": @"", @"converted_at": @"", @"is_active": @NO, @"is_virtual": @NO, @"items": @[ @{ @"item_id": @0, @"sku": @"", @"qty": @"", @"name": @"", @"price": @"", @"product_type": @"", @"quote_id": @"", @"product_option": @{ @"extension_attributes": @{ @"custom_options": @[ @{ @"option_id": @"", @"option_value": @"", @"extension_attributes": @{ @"file_info": @{ @"base64_encoded_data": @"", @"type": @"", @"name": @"" } } } ], @"bundle_options": @[ @{ @"option_id": @0, @"option_qty": @0, @"option_selections": @[ ], @"extension_attributes": @{ } } ], @"configurable_item_options": @[ @{ @"option_id": @"", @"option_value": @0, @"extension_attributes": @{ } } ], @"downloadable_option": @{ @"downloadable_links": @[ ] }, @"giftcard_item_option": @{ @"giftcard_amount": @"", @"custom_giftcard_amount": @"", @"giftcard_sender_name": @"", @"giftcard_recipient_name": @"", @"giftcard_sender_email": @"", @"giftcard_recipient_email": @"", @"giftcard_message": @"", @"extension_attributes": @{ @"giftcard_created_codes": @[ ] } } } }, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"negotiable_quote_item": @{ @"item_id": @0, @"original_price": @"", @"original_tax_amount": @"", @"original_discount_amount": @"", @"extension_attributes": @{ } } } } ], @"items_count": @0, @"items_qty": @"", @"customer": @{ @"id": @0, @"group_id": @0, @"default_billing": @"", @"default_shipping": @"", @"confirmation": @"", @"created_at": @"", @"updated_at": @"", @"created_in": @"", @"dob": @"", @"email": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"gender": @0, @"store_id": @0, @"taxvat": @"", @"website_id": @0, @"addresses": @[ @{ @"id": @0, @"customer_id": @0, @"region": @{ @"region_code": @"", @"region": @"", @"region_id": @0, @"extension_attributes": @{ } }, @"region_id": @0, @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"default_shipping": @NO, @"default_billing": @NO, @"extension_attributes": @{ }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } ], @"disable_auto_group_change": @0, @"extension_attributes": @{ @"company_attributes": @{ @"customer_id": @0, @"company_id": @0, @"job_title": @"", @"status": @0, @"telephone": @"", @"extension_attributes": @{ } }, @"is_subscribed": @NO, @"amazon_id": @"", @"vertex_customer_code": @"" }, @"custom_attributes": @[ @{ } ] }, @"billing_address": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ } ] }, @"reserved_order_id": @"", @"orig_order_id": @0, @"currency": @{ @"global_currency_code": @"", @"base_currency_code": @"", @"store_currency_code": @"", @"quote_currency_code": @"", @"store_to_base_rate": @"", @"store_to_quote_rate": @"", @"base_to_global_rate": @"", @"base_to_quote_rate": @"", @"extension_attributes": @{ } }, @"customer_is_guest": @NO, @"customer_note": @"", @"customer_note_notify": @NO, @"customer_tax_class_id": @0, @"store_id": @0, @"extension_attributes": @{ @"shipping_assignments": @[ @{ @"shipping": @{ @"address": @{ }, @"method": @"", @"extension_attributes": @{ } }, @"items": @[ @{ } ], @"extension_attributes": @{ } } ], @"negotiable_quote": @{ @"quote_id": @0, @"is_regular_quote": @NO, @"status": @"", @"negotiated_price_type": @0, @"negotiated_price_value": @"", @"shipping_price": @"", @"quote_name": @"", @"expiration_period": @"", @"email_notification_status": @0, @"has_unconfirmed_changes": @NO, @"is_shipping_tax_changed": @NO, @"is_customer_price_changed": @NO, @"notifications": @0, @"applied_rule_ids": @"", @"is_address_draft": @NO, @"deleted_sku": @"", @"creator_id": @0, @"creator_type": @0, @"original_total_price": @"", @"base_original_total_price": @"", @"negotiated_total_price": @"", @"base_negotiated_total_price": @"", @"extension_attributes": @{ } }, @"amazon_order_reference_id": @{ @"id": @"", @"amazon_order_reference_id": @"", @"quote_id": @0, @"sandbox_simulation_reference": @"", @"confirmed": @NO } } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/carts/mine"]
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}}/async/V1/carts/mine" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\n }\n }\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/carts/mine",
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([
'quote' => [
'id' => 0,
'created_at' => '',
'updated_at' => '',
'converted_at' => '',
'is_active' => null,
'is_virtual' => null,
'items' => [
[
'item_id' => 0,
'sku' => '',
'qty' => '',
'name' => '',
'price' => '',
'product_type' => '',
'quote_id' => '',
'product_option' => [
'extension_attributes' => [
'custom_options' => [
[
'option_id' => '',
'option_value' => '',
'extension_attributes' => [
'file_info' => [
'base64_encoded_data' => '',
'type' => '',
'name' => ''
]
]
]
],
'bundle_options' => [
[
'option_id' => 0,
'option_qty' => 0,
'option_selections' => [
],
'extension_attributes' => [
]
]
],
'configurable_item_options' => [
[
'option_id' => '',
'option_value' => 0,
'extension_attributes' => [
]
]
],
'downloadable_option' => [
'downloadable_links' => [
]
],
'giftcard_item_option' => [
'giftcard_amount' => '',
'custom_giftcard_amount' => '',
'giftcard_sender_name' => '',
'giftcard_recipient_name' => '',
'giftcard_sender_email' => '',
'giftcard_recipient_email' => '',
'giftcard_message' => '',
'extension_attributes' => [
'giftcard_created_codes' => [
]
]
]
]
],
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
],
'items_count' => 0,
'items_qty' => '',
'customer' => [
'id' => 0,
'group_id' => 0,
'default_billing' => '',
'default_shipping' => '',
'confirmation' => '',
'created_at' => '',
'updated_at' => '',
'created_in' => '',
'dob' => '',
'email' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'gender' => 0,
'store_id' => 0,
'taxvat' => '',
'website_id' => 0,
'addresses' => [
[
'id' => 0,
'customer_id' => 0,
'region' => [
'region_code' => '',
'region' => '',
'region_id' => 0,
'extension_attributes' => [
]
],
'region_id' => 0,
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'default_shipping' => null,
'default_billing' => null,
'extension_attributes' => [
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
],
'disable_auto_group_change' => 0,
'extension_attributes' => [
'company_attributes' => [
'customer_id' => 0,
'company_id' => 0,
'job_title' => '',
'status' => 0,
'telephone' => '',
'extension_attributes' => [
]
],
'is_subscribed' => null,
'amazon_id' => '',
'vertex_customer_code' => ''
],
'custom_attributes' => [
[
]
]
],
'billing_address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
]
]
],
'reserved_order_id' => '',
'orig_order_id' => 0,
'currency' => [
'global_currency_code' => '',
'base_currency_code' => '',
'store_currency_code' => '',
'quote_currency_code' => '',
'store_to_base_rate' => '',
'store_to_quote_rate' => '',
'base_to_global_rate' => '',
'base_to_quote_rate' => '',
'extension_attributes' => [
]
],
'customer_is_guest' => null,
'customer_note' => '',
'customer_note_notify' => null,
'customer_tax_class_id' => 0,
'store_id' => 0,
'extension_attributes' => [
'shipping_assignments' => [
[
'shipping' => [
'address' => [
],
'method' => '',
'extension_attributes' => [
]
],
'items' => [
[
]
],
'extension_attributes' => [
]
]
],
'negotiable_quote' => [
'quote_id' => 0,
'is_regular_quote' => null,
'status' => '',
'negotiated_price_type' => 0,
'negotiated_price_value' => '',
'shipping_price' => '',
'quote_name' => '',
'expiration_period' => '',
'email_notification_status' => 0,
'has_unconfirmed_changes' => null,
'is_shipping_tax_changed' => null,
'is_customer_price_changed' => null,
'notifications' => 0,
'applied_rule_ids' => '',
'is_address_draft' => null,
'deleted_sku' => '',
'creator_id' => 0,
'creator_type' => 0,
'original_total_price' => '',
'base_original_total_price' => '',
'negotiated_total_price' => '',
'base_negotiated_total_price' => '',
'extension_attributes' => [
]
],
'amazon_order_reference_id' => [
'id' => '',
'amazon_order_reference_id' => '',
'quote_id' => 0,
'sandbox_simulation_reference' => '',
'confirmed' => 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('PUT', '{{baseUrl}}/async/V1/carts/mine', [
'body' => '{
"quote": {
"id": 0,
"created_at": "",
"updated_at": "",
"converted_at": "",
"is_active": false,
"is_virtual": false,
"items": [
{
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
],
"items_count": 0,
"items_qty": "",
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"billing_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{}
],
"gift_registry_id": 0
},
"custom_attributes": [
{}
]
},
"reserved_order_id": "",
"orig_order_id": 0,
"currency": {
"global_currency_code": "",
"base_currency_code": "",
"store_currency_code": "",
"quote_currency_code": "",
"store_to_base_rate": "",
"store_to_quote_rate": "",
"base_to_global_rate": "",
"base_to_quote_rate": "",
"extension_attributes": {}
},
"customer_is_guest": false,
"customer_note": "",
"customer_note_notify": false,
"customer_tax_class_id": 0,
"store_id": 0,
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {},
"method": "",
"extension_attributes": {}
},
"items": [
{}
],
"extension_attributes": {}
}
],
"negotiable_quote": {
"quote_id": 0,
"is_regular_quote": false,
"status": "",
"negotiated_price_type": 0,
"negotiated_price_value": "",
"shipping_price": "",
"quote_name": "",
"expiration_period": "",
"email_notification_status": 0,
"has_unconfirmed_changes": false,
"is_shipping_tax_changed": false,
"is_customer_price_changed": false,
"notifications": 0,
"applied_rule_ids": "",
"is_address_draft": false,
"deleted_sku": "",
"creator_id": 0,
"creator_type": 0,
"original_total_price": "",
"base_original_total_price": "",
"negotiated_total_price": "",
"base_negotiated_total_price": "",
"extension_attributes": {}
},
"amazon_order_reference_id": {
"id": "",
"amazon_order_reference_id": "",
"quote_id": 0,
"sandbox_simulation_reference": "",
"confirmed": false
}
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/carts/mine');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'quote' => [
'id' => 0,
'created_at' => '',
'updated_at' => '',
'converted_at' => '',
'is_active' => null,
'is_virtual' => null,
'items' => [
[
'item_id' => 0,
'sku' => '',
'qty' => '',
'name' => '',
'price' => '',
'product_type' => '',
'quote_id' => '',
'product_option' => [
'extension_attributes' => [
'custom_options' => [
[
'option_id' => '',
'option_value' => '',
'extension_attributes' => [
'file_info' => [
'base64_encoded_data' => '',
'type' => '',
'name' => ''
]
]
]
],
'bundle_options' => [
[
'option_id' => 0,
'option_qty' => 0,
'option_selections' => [
],
'extension_attributes' => [
]
]
],
'configurable_item_options' => [
[
'option_id' => '',
'option_value' => 0,
'extension_attributes' => [
]
]
],
'downloadable_option' => [
'downloadable_links' => [
]
],
'giftcard_item_option' => [
'giftcard_amount' => '',
'custom_giftcard_amount' => '',
'giftcard_sender_name' => '',
'giftcard_recipient_name' => '',
'giftcard_sender_email' => '',
'giftcard_recipient_email' => '',
'giftcard_message' => '',
'extension_attributes' => [
'giftcard_created_codes' => [
]
]
]
]
],
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
],
'items_count' => 0,
'items_qty' => '',
'customer' => [
'id' => 0,
'group_id' => 0,
'default_billing' => '',
'default_shipping' => '',
'confirmation' => '',
'created_at' => '',
'updated_at' => '',
'created_in' => '',
'dob' => '',
'email' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'gender' => 0,
'store_id' => 0,
'taxvat' => '',
'website_id' => 0,
'addresses' => [
[
'id' => 0,
'customer_id' => 0,
'region' => [
'region_code' => '',
'region' => '',
'region_id' => 0,
'extension_attributes' => [
]
],
'region_id' => 0,
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'default_shipping' => null,
'default_billing' => null,
'extension_attributes' => [
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
],
'disable_auto_group_change' => 0,
'extension_attributes' => [
'company_attributes' => [
'customer_id' => 0,
'company_id' => 0,
'job_title' => '',
'status' => 0,
'telephone' => '',
'extension_attributes' => [
]
],
'is_subscribed' => null,
'amazon_id' => '',
'vertex_customer_code' => ''
],
'custom_attributes' => [
[
]
]
],
'billing_address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
]
]
],
'reserved_order_id' => '',
'orig_order_id' => 0,
'currency' => [
'global_currency_code' => '',
'base_currency_code' => '',
'store_currency_code' => '',
'quote_currency_code' => '',
'store_to_base_rate' => '',
'store_to_quote_rate' => '',
'base_to_global_rate' => '',
'base_to_quote_rate' => '',
'extension_attributes' => [
]
],
'customer_is_guest' => null,
'customer_note' => '',
'customer_note_notify' => null,
'customer_tax_class_id' => 0,
'store_id' => 0,
'extension_attributes' => [
'shipping_assignments' => [
[
'shipping' => [
'address' => [
],
'method' => '',
'extension_attributes' => [
]
],
'items' => [
[
]
],
'extension_attributes' => [
]
]
],
'negotiable_quote' => [
'quote_id' => 0,
'is_regular_quote' => null,
'status' => '',
'negotiated_price_type' => 0,
'negotiated_price_value' => '',
'shipping_price' => '',
'quote_name' => '',
'expiration_period' => '',
'email_notification_status' => 0,
'has_unconfirmed_changes' => null,
'is_shipping_tax_changed' => null,
'is_customer_price_changed' => null,
'notifications' => 0,
'applied_rule_ids' => '',
'is_address_draft' => null,
'deleted_sku' => '',
'creator_id' => 0,
'creator_type' => 0,
'original_total_price' => '',
'base_original_total_price' => '',
'negotiated_total_price' => '',
'base_negotiated_total_price' => '',
'extension_attributes' => [
]
],
'amazon_order_reference_id' => [
'id' => '',
'amazon_order_reference_id' => '',
'quote_id' => 0,
'sandbox_simulation_reference' => '',
'confirmed' => null
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'quote' => [
'id' => 0,
'created_at' => '',
'updated_at' => '',
'converted_at' => '',
'is_active' => null,
'is_virtual' => null,
'items' => [
[
'item_id' => 0,
'sku' => '',
'qty' => '',
'name' => '',
'price' => '',
'product_type' => '',
'quote_id' => '',
'product_option' => [
'extension_attributes' => [
'custom_options' => [
[
'option_id' => '',
'option_value' => '',
'extension_attributes' => [
'file_info' => [
'base64_encoded_data' => '',
'type' => '',
'name' => ''
]
]
]
],
'bundle_options' => [
[
'option_id' => 0,
'option_qty' => 0,
'option_selections' => [
],
'extension_attributes' => [
]
]
],
'configurable_item_options' => [
[
'option_id' => '',
'option_value' => 0,
'extension_attributes' => [
]
]
],
'downloadable_option' => [
'downloadable_links' => [
]
],
'giftcard_item_option' => [
'giftcard_amount' => '',
'custom_giftcard_amount' => '',
'giftcard_sender_name' => '',
'giftcard_recipient_name' => '',
'giftcard_sender_email' => '',
'giftcard_recipient_email' => '',
'giftcard_message' => '',
'extension_attributes' => [
'giftcard_created_codes' => [
]
]
]
]
],
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
],
'items_count' => 0,
'items_qty' => '',
'customer' => [
'id' => 0,
'group_id' => 0,
'default_billing' => '',
'default_shipping' => '',
'confirmation' => '',
'created_at' => '',
'updated_at' => '',
'created_in' => '',
'dob' => '',
'email' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'gender' => 0,
'store_id' => 0,
'taxvat' => '',
'website_id' => 0,
'addresses' => [
[
'id' => 0,
'customer_id' => 0,
'region' => [
'region_code' => '',
'region' => '',
'region_id' => 0,
'extension_attributes' => [
]
],
'region_id' => 0,
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'default_shipping' => null,
'default_billing' => null,
'extension_attributes' => [
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
],
'disable_auto_group_change' => 0,
'extension_attributes' => [
'company_attributes' => [
'customer_id' => 0,
'company_id' => 0,
'job_title' => '',
'status' => 0,
'telephone' => '',
'extension_attributes' => [
]
],
'is_subscribed' => null,
'amazon_id' => '',
'vertex_customer_code' => ''
],
'custom_attributes' => [
[
]
]
],
'billing_address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
]
]
],
'reserved_order_id' => '',
'orig_order_id' => 0,
'currency' => [
'global_currency_code' => '',
'base_currency_code' => '',
'store_currency_code' => '',
'quote_currency_code' => '',
'store_to_base_rate' => '',
'store_to_quote_rate' => '',
'base_to_global_rate' => '',
'base_to_quote_rate' => '',
'extension_attributes' => [
]
],
'customer_is_guest' => null,
'customer_note' => '',
'customer_note_notify' => null,
'customer_tax_class_id' => 0,
'store_id' => 0,
'extension_attributes' => [
'shipping_assignments' => [
[
'shipping' => [
'address' => [
],
'method' => '',
'extension_attributes' => [
]
],
'items' => [
[
]
],
'extension_attributes' => [
]
]
],
'negotiable_quote' => [
'quote_id' => 0,
'is_regular_quote' => null,
'status' => '',
'negotiated_price_type' => 0,
'negotiated_price_value' => '',
'shipping_price' => '',
'quote_name' => '',
'expiration_period' => '',
'email_notification_status' => 0,
'has_unconfirmed_changes' => null,
'is_shipping_tax_changed' => null,
'is_customer_price_changed' => null,
'notifications' => 0,
'applied_rule_ids' => '',
'is_address_draft' => null,
'deleted_sku' => '',
'creator_id' => 0,
'creator_type' => 0,
'original_total_price' => '',
'base_original_total_price' => '',
'negotiated_total_price' => '',
'base_negotiated_total_price' => '',
'extension_attributes' => [
]
],
'amazon_order_reference_id' => [
'id' => '',
'amazon_order_reference_id' => '',
'quote_id' => 0,
'sandbox_simulation_reference' => '',
'confirmed' => null
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/carts/mine');
$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}}/async/V1/carts/mine' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"quote": {
"id": 0,
"created_at": "",
"updated_at": "",
"converted_at": "",
"is_active": false,
"is_virtual": false,
"items": [
{
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
],
"items_count": 0,
"items_qty": "",
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"billing_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{}
],
"gift_registry_id": 0
},
"custom_attributes": [
{}
]
},
"reserved_order_id": "",
"orig_order_id": 0,
"currency": {
"global_currency_code": "",
"base_currency_code": "",
"store_currency_code": "",
"quote_currency_code": "",
"store_to_base_rate": "",
"store_to_quote_rate": "",
"base_to_global_rate": "",
"base_to_quote_rate": "",
"extension_attributes": {}
},
"customer_is_guest": false,
"customer_note": "",
"customer_note_notify": false,
"customer_tax_class_id": 0,
"store_id": 0,
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {},
"method": "",
"extension_attributes": {}
},
"items": [
{}
],
"extension_attributes": {}
}
],
"negotiable_quote": {
"quote_id": 0,
"is_regular_quote": false,
"status": "",
"negotiated_price_type": 0,
"negotiated_price_value": "",
"shipping_price": "",
"quote_name": "",
"expiration_period": "",
"email_notification_status": 0,
"has_unconfirmed_changes": false,
"is_shipping_tax_changed": false,
"is_customer_price_changed": false,
"notifications": 0,
"applied_rule_ids": "",
"is_address_draft": false,
"deleted_sku": "",
"creator_id": 0,
"creator_type": 0,
"original_total_price": "",
"base_original_total_price": "",
"negotiated_total_price": "",
"base_negotiated_total_price": "",
"extension_attributes": {}
},
"amazon_order_reference_id": {
"id": "",
"amazon_order_reference_id": "",
"quote_id": 0,
"sandbox_simulation_reference": "",
"confirmed": false
}
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/carts/mine' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"quote": {
"id": 0,
"created_at": "",
"updated_at": "",
"converted_at": "",
"is_active": false,
"is_virtual": false,
"items": [
{
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
],
"items_count": 0,
"items_qty": "",
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"billing_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{}
],
"gift_registry_id": 0
},
"custom_attributes": [
{}
]
},
"reserved_order_id": "",
"orig_order_id": 0,
"currency": {
"global_currency_code": "",
"base_currency_code": "",
"store_currency_code": "",
"quote_currency_code": "",
"store_to_base_rate": "",
"store_to_quote_rate": "",
"base_to_global_rate": "",
"base_to_quote_rate": "",
"extension_attributes": {}
},
"customer_is_guest": false,
"customer_note": "",
"customer_note_notify": false,
"customer_tax_class_id": 0,
"store_id": 0,
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {},
"method": "",
"extension_attributes": {}
},
"items": [
{}
],
"extension_attributes": {}
}
],
"negotiable_quote": {
"quote_id": 0,
"is_regular_quote": false,
"status": "",
"negotiated_price_type": 0,
"negotiated_price_value": "",
"shipping_price": "",
"quote_name": "",
"expiration_period": "",
"email_notification_status": 0,
"has_unconfirmed_changes": false,
"is_shipping_tax_changed": false,
"is_customer_price_changed": false,
"notifications": 0,
"applied_rule_ids": "",
"is_address_draft": false,
"deleted_sku": "",
"creator_id": 0,
"creator_type": 0,
"original_total_price": "",
"base_original_total_price": "",
"negotiated_total_price": "",
"base_negotiated_total_price": "",
"extension_attributes": {}
},
"amazon_order_reference_id": {
"id": "",
"amazon_order_reference_id": "",
"quote_id": 0,
"sandbox_simulation_reference": "",
"confirmed": false
}
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\n }\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/async/V1/carts/mine", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/carts/mine"
payload = { "quote": {
"id": 0,
"created_at": "",
"updated_at": "",
"converted_at": "",
"is_active": False,
"is_virtual": False,
"items": [
{
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": { "extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": { "file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
} }
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": { "downloadable_links": [] },
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": { "giftcard_created_codes": [] }
}
} },
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
],
"items_count": 0,
"items_qty": "",
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": False,
"default_billing": False,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": False,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [{}]
},
"billing_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [{}],
"gift_registry_id": 0
},
"custom_attributes": [{}]
},
"reserved_order_id": "",
"orig_order_id": 0,
"currency": {
"global_currency_code": "",
"base_currency_code": "",
"store_currency_code": "",
"quote_currency_code": "",
"store_to_base_rate": "",
"store_to_quote_rate": "",
"base_to_global_rate": "",
"base_to_quote_rate": "",
"extension_attributes": {}
},
"customer_is_guest": False,
"customer_note": "",
"customer_note_notify": False,
"customer_tax_class_id": 0,
"store_id": 0,
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {},
"method": "",
"extension_attributes": {}
},
"items": [{}],
"extension_attributes": {}
}
],
"negotiable_quote": {
"quote_id": 0,
"is_regular_quote": False,
"status": "",
"negotiated_price_type": 0,
"negotiated_price_value": "",
"shipping_price": "",
"quote_name": "",
"expiration_period": "",
"email_notification_status": 0,
"has_unconfirmed_changes": False,
"is_shipping_tax_changed": False,
"is_customer_price_changed": False,
"notifications": 0,
"applied_rule_ids": "",
"is_address_draft": False,
"deleted_sku": "",
"creator_id": 0,
"creator_type": 0,
"original_total_price": "",
"base_original_total_price": "",
"negotiated_total_price": "",
"base_negotiated_total_price": "",
"extension_attributes": {}
},
"amazon_order_reference_id": {
"id": "",
"amazon_order_reference_id": "",
"quote_id": 0,
"sandbox_simulation_reference": "",
"confirmed": False
}
}
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/carts/mine"
payload <- "{\n \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\n }\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}}/async/V1/carts/mine")
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 \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\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.put('/baseUrl/async/V1/carts/mine') do |req|
req.body = "{\n \"quote\": {\n \"id\": 0,\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"converted_at\": \"\",\n \"is_active\": false,\n \"is_virtual\": false,\n \"items\": [\n {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n ],\n \"items_count\": 0,\n \"items_qty\": \"\",\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"billing_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {}\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"reserved_order_id\": \"\",\n \"orig_order_id\": 0,\n \"currency\": {\n \"global_currency_code\": \"\",\n \"base_currency_code\": \"\",\n \"store_currency_code\": \"\",\n \"quote_currency_code\": \"\",\n \"store_to_base_rate\": \"\",\n \"store_to_quote_rate\": \"\",\n \"base_to_global_rate\": \"\",\n \"base_to_quote_rate\": \"\",\n \"extension_attributes\": {}\n },\n \"customer_is_guest\": false,\n \"customer_note\": \"\",\n \"customer_note_notify\": false,\n \"customer_tax_class_id\": 0,\n \"store_id\": 0,\n \"extension_attributes\": {\n \"shipping_assignments\": [\n {\n \"shipping\": {\n \"address\": {},\n \"method\": \"\",\n \"extension_attributes\": {}\n },\n \"items\": [\n {}\n ],\n \"extension_attributes\": {}\n }\n ],\n \"negotiable_quote\": {\n \"quote_id\": 0,\n \"is_regular_quote\": false,\n \"status\": \"\",\n \"negotiated_price_type\": 0,\n \"negotiated_price_value\": \"\",\n \"shipping_price\": \"\",\n \"quote_name\": \"\",\n \"expiration_period\": \"\",\n \"email_notification_status\": 0,\n \"has_unconfirmed_changes\": false,\n \"is_shipping_tax_changed\": false,\n \"is_customer_price_changed\": false,\n \"notifications\": 0,\n \"applied_rule_ids\": \"\",\n \"is_address_draft\": false,\n \"deleted_sku\": \"\",\n \"creator_id\": 0,\n \"creator_type\": 0,\n \"original_total_price\": \"\",\n \"base_original_total_price\": \"\",\n \"negotiated_total_price\": \"\",\n \"base_negotiated_total_price\": \"\",\n \"extension_attributes\": {}\n },\n \"amazon_order_reference_id\": {\n \"id\": \"\",\n \"amazon_order_reference_id\": \"\",\n \"quote_id\": 0,\n \"sandbox_simulation_reference\": \"\",\n \"confirmed\": false\n }\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}}/async/V1/carts/mine";
let payload = json!({"quote": json!({
"id": 0,
"created_at": "",
"updated_at": "",
"converted_at": "",
"is_active": false,
"is_virtual": false,
"items": (
json!({
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": json!({"extension_attributes": json!({
"custom_options": (
json!({
"option_id": "",
"option_value": "",
"extension_attributes": json!({"file_info": json!({
"base64_encoded_data": "",
"type": "",
"name": ""
})})
})
),
"bundle_options": (
json!({
"option_id": 0,
"option_qty": 0,
"option_selections": (),
"extension_attributes": json!({})
})
),
"configurable_item_options": (
json!({
"option_id": "",
"option_value": 0,
"extension_attributes": json!({})
})
),
"downloadable_option": json!({"downloadable_links": ()}),
"giftcard_item_option": json!({
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": json!({"giftcard_created_codes": ()})
})
})}),
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"negotiable_quote_item": json!({
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": json!({})
})
})
})
),
"items_count": 0,
"items_qty": "",
"customer": json!({
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": (
json!({
"id": 0,
"customer_id": 0,
"region": json!({
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": json!({})
}),
"region_id": 0,
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": json!({}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})
),
"disable_auto_group_change": 0,
"extension_attributes": json!({
"company_attributes": json!({
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": json!({})
}),
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
}),
"custom_attributes": (json!({}))
}),
"billing_address": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (json!({})),
"gift_registry_id": 0
}),
"custom_attributes": (json!({}))
}),
"reserved_order_id": "",
"orig_order_id": 0,
"currency": json!({
"global_currency_code": "",
"base_currency_code": "",
"store_currency_code": "",
"quote_currency_code": "",
"store_to_base_rate": "",
"store_to_quote_rate": "",
"base_to_global_rate": "",
"base_to_quote_rate": "",
"extension_attributes": json!({})
}),
"customer_is_guest": false,
"customer_note": "",
"customer_note_notify": false,
"customer_tax_class_id": 0,
"store_id": 0,
"extension_attributes": json!({
"shipping_assignments": (
json!({
"shipping": json!({
"address": json!({}),
"method": "",
"extension_attributes": json!({})
}),
"items": (json!({})),
"extension_attributes": json!({})
})
),
"negotiable_quote": json!({
"quote_id": 0,
"is_regular_quote": false,
"status": "",
"negotiated_price_type": 0,
"negotiated_price_value": "",
"shipping_price": "",
"quote_name": "",
"expiration_period": "",
"email_notification_status": 0,
"has_unconfirmed_changes": false,
"is_shipping_tax_changed": false,
"is_customer_price_changed": false,
"notifications": 0,
"applied_rule_ids": "",
"is_address_draft": false,
"deleted_sku": "",
"creator_id": 0,
"creator_type": 0,
"original_total_price": "",
"base_original_total_price": "",
"negotiated_total_price": "",
"base_negotiated_total_price": "",
"extension_attributes": json!({})
}),
"amazon_order_reference_id": json!({
"id": "",
"amazon_order_reference_id": "",
"quote_id": 0,
"sandbox_simulation_reference": "",
"confirmed": false
})
})
})});
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}}/async/V1/carts/mine \
--header 'content-type: application/json' \
--data '{
"quote": {
"id": 0,
"created_at": "",
"updated_at": "",
"converted_at": "",
"is_active": false,
"is_virtual": false,
"items": [
{
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
],
"items_count": 0,
"items_qty": "",
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"billing_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{}
],
"gift_registry_id": 0
},
"custom_attributes": [
{}
]
},
"reserved_order_id": "",
"orig_order_id": 0,
"currency": {
"global_currency_code": "",
"base_currency_code": "",
"store_currency_code": "",
"quote_currency_code": "",
"store_to_base_rate": "",
"store_to_quote_rate": "",
"base_to_global_rate": "",
"base_to_quote_rate": "",
"extension_attributes": {}
},
"customer_is_guest": false,
"customer_note": "",
"customer_note_notify": false,
"customer_tax_class_id": 0,
"store_id": 0,
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {},
"method": "",
"extension_attributes": {}
},
"items": [
{}
],
"extension_attributes": {}
}
],
"negotiable_quote": {
"quote_id": 0,
"is_regular_quote": false,
"status": "",
"negotiated_price_type": 0,
"negotiated_price_value": "",
"shipping_price": "",
"quote_name": "",
"expiration_period": "",
"email_notification_status": 0,
"has_unconfirmed_changes": false,
"is_shipping_tax_changed": false,
"is_customer_price_changed": false,
"notifications": 0,
"applied_rule_ids": "",
"is_address_draft": false,
"deleted_sku": "",
"creator_id": 0,
"creator_type": 0,
"original_total_price": "",
"base_original_total_price": "",
"negotiated_total_price": "",
"base_negotiated_total_price": "",
"extension_attributes": {}
},
"amazon_order_reference_id": {
"id": "",
"amazon_order_reference_id": "",
"quote_id": 0,
"sandbox_simulation_reference": "",
"confirmed": false
}
}
}
}'
echo '{
"quote": {
"id": 0,
"created_at": "",
"updated_at": "",
"converted_at": "",
"is_active": false,
"is_virtual": false,
"items": [
{
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
],
"items_count": 0,
"items_qty": "",
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"billing_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{}
],
"gift_registry_id": 0
},
"custom_attributes": [
{}
]
},
"reserved_order_id": "",
"orig_order_id": 0,
"currency": {
"global_currency_code": "",
"base_currency_code": "",
"store_currency_code": "",
"quote_currency_code": "",
"store_to_base_rate": "",
"store_to_quote_rate": "",
"base_to_global_rate": "",
"base_to_quote_rate": "",
"extension_attributes": {}
},
"customer_is_guest": false,
"customer_note": "",
"customer_note_notify": false,
"customer_tax_class_id": 0,
"store_id": 0,
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {},
"method": "",
"extension_attributes": {}
},
"items": [
{}
],
"extension_attributes": {}
}
],
"negotiable_quote": {
"quote_id": 0,
"is_regular_quote": false,
"status": "",
"negotiated_price_type": 0,
"negotiated_price_value": "",
"shipping_price": "",
"quote_name": "",
"expiration_period": "",
"email_notification_status": 0,
"has_unconfirmed_changes": false,
"is_shipping_tax_changed": false,
"is_customer_price_changed": false,
"notifications": 0,
"applied_rule_ids": "",
"is_address_draft": false,
"deleted_sku": "",
"creator_id": 0,
"creator_type": 0,
"original_total_price": "",
"base_original_total_price": "",
"negotiated_total_price": "",
"base_negotiated_total_price": "",
"extension_attributes": {}
},
"amazon_order_reference_id": {
"id": "",
"amazon_order_reference_id": "",
"quote_id": 0,
"sandbox_simulation_reference": "",
"confirmed": false
}
}
}
}' | \
http PUT {{baseUrl}}/async/V1/carts/mine \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "quote": {\n "id": 0,\n "created_at": "",\n "updated_at": "",\n "converted_at": "",\n "is_active": false,\n "is_virtual": false,\n "items": [\n {\n "item_id": 0,\n "sku": "",\n "qty": "",\n "name": "",\n "price": "",\n "product_type": "",\n "quote_id": "",\n "product_option": {\n "extension_attributes": {\n "custom_options": [\n {\n "option_id": "",\n "option_value": "",\n "extension_attributes": {\n "file_info": {\n "base64_encoded_data": "",\n "type": "",\n "name": ""\n }\n }\n }\n ],\n "bundle_options": [\n {\n "option_id": 0,\n "option_qty": 0,\n "option_selections": [],\n "extension_attributes": {}\n }\n ],\n "configurable_item_options": [\n {\n "option_id": "",\n "option_value": 0,\n "extension_attributes": {}\n }\n ],\n "downloadable_option": {\n "downloadable_links": []\n },\n "giftcard_item_option": {\n "giftcard_amount": "",\n "custom_giftcard_amount": "",\n "giftcard_sender_name": "",\n "giftcard_recipient_name": "",\n "giftcard_sender_email": "",\n "giftcard_recipient_email": "",\n "giftcard_message": "",\n "extension_attributes": {\n "giftcard_created_codes": []\n }\n }\n }\n },\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "negotiable_quote_item": {\n "item_id": 0,\n "original_price": "",\n "original_tax_amount": "",\n "original_discount_amount": "",\n "extension_attributes": {}\n }\n }\n }\n ],\n "items_count": 0,\n "items_qty": "",\n "customer": {\n "id": 0,\n "group_id": 0,\n "default_billing": "",\n "default_shipping": "",\n "confirmation": "",\n "created_at": "",\n "updated_at": "",\n "created_in": "",\n "dob": "",\n "email": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "gender": 0,\n "store_id": 0,\n "taxvat": "",\n "website_id": 0,\n "addresses": [\n {\n "id": 0,\n "customer_id": 0,\n "region": {\n "region_code": "",\n "region": "",\n "region_id": 0,\n "extension_attributes": {}\n },\n "region_id": 0,\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "default_shipping": false,\n "default_billing": false,\n "extension_attributes": {},\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n ],\n "disable_auto_group_change": 0,\n "extension_attributes": {\n "company_attributes": {\n "customer_id": 0,\n "company_id": 0,\n "job_title": "",\n "status": 0,\n "telephone": "",\n "extension_attributes": {}\n },\n "is_subscribed": false,\n "amazon_id": "",\n "vertex_customer_code": ""\n },\n "custom_attributes": [\n {}\n ]\n },\n "billing_address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {}\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {}\n ]\n },\n "reserved_order_id": "",\n "orig_order_id": 0,\n "currency": {\n "global_currency_code": "",\n "base_currency_code": "",\n "store_currency_code": "",\n "quote_currency_code": "",\n "store_to_base_rate": "",\n "store_to_quote_rate": "",\n "base_to_global_rate": "",\n "base_to_quote_rate": "",\n "extension_attributes": {}\n },\n "customer_is_guest": false,\n "customer_note": "",\n "customer_note_notify": false,\n "customer_tax_class_id": 0,\n "store_id": 0,\n "extension_attributes": {\n "shipping_assignments": [\n {\n "shipping": {\n "address": {},\n "method": "",\n "extension_attributes": {}\n },\n "items": [\n {}\n ],\n "extension_attributes": {}\n }\n ],\n "negotiable_quote": {\n "quote_id": 0,\n "is_regular_quote": false,\n "status": "",\n "negotiated_price_type": 0,\n "negotiated_price_value": "",\n "shipping_price": "",\n "quote_name": "",\n "expiration_period": "",\n "email_notification_status": 0,\n "has_unconfirmed_changes": false,\n "is_shipping_tax_changed": false,\n "is_customer_price_changed": false,\n "notifications": 0,\n "applied_rule_ids": "",\n "is_address_draft": false,\n "deleted_sku": "",\n "creator_id": 0,\n "creator_type": 0,\n "original_total_price": "",\n "base_original_total_price": "",\n "negotiated_total_price": "",\n "base_negotiated_total_price": "",\n "extension_attributes": {}\n },\n "amazon_order_reference_id": {\n "id": "",\n "amazon_order_reference_id": "",\n "quote_id": 0,\n "sandbox_simulation_reference": "",\n "confirmed": false\n }\n }\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/carts/mine
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["quote": [
"id": 0,
"created_at": "",
"updated_at": "",
"converted_at": "",
"is_active": false,
"is_virtual": false,
"items": [
[
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": ["extension_attributes": [
"custom_options": [
[
"option_id": "",
"option_value": "",
"extension_attributes": ["file_info": [
"base64_encoded_data": "",
"type": "",
"name": ""
]]
]
],
"bundle_options": [
[
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": []
]
],
"configurable_item_options": [
[
"option_id": "",
"option_value": 0,
"extension_attributes": []
]
],
"downloadable_option": ["downloadable_links": []],
"giftcard_item_option": [
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": ["giftcard_created_codes": []]
]
]],
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"negotiable_quote_item": [
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": []
]
]
]
],
"items_count": 0,
"items_qty": "",
"customer": [
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
[
"id": 0,
"customer_id": 0,
"region": [
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": []
],
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": [],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]
],
"disable_auto_group_change": 0,
"extension_attributes": [
"company_attributes": [
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": []
],
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
],
"custom_attributes": [[]]
],
"billing_address": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [[]],
"gift_registry_id": 0
],
"custom_attributes": [[]]
],
"reserved_order_id": "",
"orig_order_id": 0,
"currency": [
"global_currency_code": "",
"base_currency_code": "",
"store_currency_code": "",
"quote_currency_code": "",
"store_to_base_rate": "",
"store_to_quote_rate": "",
"base_to_global_rate": "",
"base_to_quote_rate": "",
"extension_attributes": []
],
"customer_is_guest": false,
"customer_note": "",
"customer_note_notify": false,
"customer_tax_class_id": 0,
"store_id": 0,
"extension_attributes": [
"shipping_assignments": [
[
"shipping": [
"address": [],
"method": "",
"extension_attributes": []
],
"items": [[]],
"extension_attributes": []
]
],
"negotiable_quote": [
"quote_id": 0,
"is_regular_quote": false,
"status": "",
"negotiated_price_type": 0,
"negotiated_price_value": "",
"shipping_price": "",
"quote_name": "",
"expiration_period": "",
"email_notification_status": 0,
"has_unconfirmed_changes": false,
"is_shipping_tax_changed": false,
"is_customer_price_changed": false,
"notifications": 0,
"applied_rule_ids": "",
"is_address_draft": false,
"deleted_sku": "",
"creator_id": 0,
"creator_type": 0,
"original_total_price": "",
"base_original_total_price": "",
"negotiated_total_price": "",
"base_negotiated_total_price": "",
"extension_attributes": []
],
"amazon_order_reference_id": [
"id": "",
"amazon_order_reference_id": "",
"quote_id": 0,
"sandbox_simulation_reference": "",
"confirmed": false
]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/carts/mine")! 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
carts-mine-balance-apply
{{baseUrl}}/async/V1/carts/mine/balance/apply
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/carts/mine/balance/apply");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/carts/mine/balance/apply")
require "http/client"
url = "{{baseUrl}}/async/V1/carts/mine/balance/apply"
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}}/async/V1/carts/mine/balance/apply"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/async/V1/carts/mine/balance/apply");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/carts/mine/balance/apply"
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/async/V1/carts/mine/balance/apply HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/carts/mine/balance/apply")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/carts/mine/balance/apply"))
.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}}/async/V1/carts/mine/balance/apply")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/carts/mine/balance/apply")
.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}}/async/V1/carts/mine/balance/apply');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/carts/mine/balance/apply'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/carts/mine/balance/apply';
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}}/async/V1/carts/mine/balance/apply',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/carts/mine/balance/apply")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/async/V1/carts/mine/balance/apply',
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}}/async/V1/carts/mine/balance/apply'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/async/V1/carts/mine/balance/apply');
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}}/async/V1/carts/mine/balance/apply'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/carts/mine/balance/apply';
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}}/async/V1/carts/mine/balance/apply"]
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}}/async/V1/carts/mine/balance/apply" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/carts/mine/balance/apply",
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}}/async/V1/carts/mine/balance/apply');
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/carts/mine/balance/apply');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/async/V1/carts/mine/balance/apply');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/async/V1/carts/mine/balance/apply' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/carts/mine/balance/apply' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/async/V1/carts/mine/balance/apply")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/carts/mine/balance/apply"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/carts/mine/balance/apply"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/async/V1/carts/mine/balance/apply")
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/async/V1/carts/mine/balance/apply') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/carts/mine/balance/apply";
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}}/async/V1/carts/mine/balance/apply
http POST {{baseUrl}}/async/V1/carts/mine/balance/apply
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/async/V1/carts/mine/balance/apply
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/carts/mine/balance/apply")! 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()
PUT
carts-mine-collect-totals
{{baseUrl}}/async/V1/carts/mine/collect-totals
BODY json
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/carts/mine/collect-totals");
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/carts/mine/collect-totals" {:content-type :json
:form-params {:paymentMethod {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}
:shippingCarrierCode ""
:shippingMethodCode ""
:additionalData {:extension_attributes {:gift_messages [{:gift_message_id 0
:customer_id 0
:sender ""
:recipient ""
:message ""
:extension_attributes {:entity_id ""
:entity_type ""
:wrapping_id 0
:wrapping_allow_gift_receipt false
:wrapping_add_printed_card false}}]}
:custom_attributes [{:attribute_code ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/carts/mine/collect-totals"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\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}}/async/V1/carts/mine/collect-totals"),
Content = new StringContent("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/carts/mine/collect-totals");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/carts/mine/collect-totals"
payload := strings.NewReader("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\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/async/V1/carts/mine/collect-totals HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 800
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/carts/mine/collect-totals")
.setHeader("content-type", "application/json")
.setBody("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/carts/mine/collect-totals"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/carts/mine/collect-totals")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/carts/mine/collect-totals")
.header("content-type", "application/json")
.body("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
shippingCarrierCode: '',
shippingMethodCode: '',
additionalData: {
extension_attributes: {
gift_messages: [
{
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
]
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/async/V1/carts/mine/collect-totals');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/carts/mine/collect-totals',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
shippingCarrierCode: '',
shippingMethodCode: '',
additionalData: {
extension_attributes: {
gift_messages: [
{
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
]
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/carts/mine/collect-totals';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"shippingCarrierCode":"","shippingMethodCode":"","additionalData":{"extension_attributes":{"gift_messages":[{"gift_message_id":0,"customer_id":0,"sender":"","recipient":"","message":"","extension_attributes":{"entity_id":"","entity_type":"","wrapping_id":0,"wrapping_allow_gift_receipt":false,"wrapping_add_printed_card":false}}]},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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}}/async/V1/carts/mine/collect-totals',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "shippingCarrierCode": "",\n "shippingMethodCode": "",\n "additionalData": {\n "extension_attributes": {\n "gift_messages": [\n {\n "gift_message_id": 0,\n "customer_id": 0,\n "sender": "",\n "recipient": "",\n "message": "",\n "extension_attributes": {\n "entity_id": "",\n "entity_type": "",\n "wrapping_id": 0,\n "wrapping_allow_gift_receipt": false,\n "wrapping_add_printed_card": false\n }\n }\n ]\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/carts/mine/collect-totals")
.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/async/V1/carts/mine/collect-totals',
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({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
shippingCarrierCode: '',
shippingMethodCode: '',
additionalData: {
extension_attributes: {
gift_messages: [
{
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
]
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/carts/mine/collect-totals',
headers: {'content-type': 'application/json'},
body: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
shippingCarrierCode: '',
shippingMethodCode: '',
additionalData: {
extension_attributes: {
gift_messages: [
{
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
]
},
custom_attributes: [{attribute_code: '', value: ''}]
}
},
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}}/async/V1/carts/mine/collect-totals');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
shippingCarrierCode: '',
shippingMethodCode: '',
additionalData: {
extension_attributes: {
gift_messages: [
{
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
]
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
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}}/async/V1/carts/mine/collect-totals',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
shippingCarrierCode: '',
shippingMethodCode: '',
additionalData: {
extension_attributes: {
gift_messages: [
{
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
]
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/carts/mine/collect-totals';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"shippingCarrierCode":"","shippingMethodCode":"","additionalData":{"extension_attributes":{"gift_messages":[{"gift_message_id":0,"customer_id":0,"sender":"","recipient":"","message":"","extension_attributes":{"entity_id":"","entity_type":"","wrapping_id":0,"wrapping_allow_gift_receipt":false,"wrapping_add_printed_card":false}}]},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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 = @{ @"paymentMethod": @{ @"po_number": @"", @"method": @"", @"additional_data": @[ ], @"extension_attributes": @{ @"agreement_ids": @[ ] } },
@"shippingCarrierCode": @"",
@"shippingMethodCode": @"",
@"additionalData": @{ @"extension_attributes": @{ @"gift_messages": @[ @{ @"gift_message_id": @0, @"customer_id": @0, @"sender": @"", @"recipient": @"", @"message": @"", @"extension_attributes": @{ @"entity_id": @"", @"entity_type": @"", @"wrapping_id": @0, @"wrapping_allow_gift_receipt": @NO, @"wrapping_add_printed_card": @NO } } ] }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/carts/mine/collect-totals"]
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}}/async/V1/carts/mine/collect-totals" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/carts/mine/collect-totals",
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([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'shippingCarrierCode' => '',
'shippingMethodCode' => '',
'additionalData' => [
'extension_attributes' => [
'gift_messages' => [
[
'gift_message_id' => 0,
'customer_id' => 0,
'sender' => '',
'recipient' => '',
'message' => '',
'extension_attributes' => [
'entity_id' => '',
'entity_type' => '',
'wrapping_id' => 0,
'wrapping_allow_gift_receipt' => null,
'wrapping_add_printed_card' => null
]
]
]
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]),
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}}/async/V1/carts/mine/collect-totals', [
'body' => '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/carts/mine/collect-totals');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'shippingCarrierCode' => '',
'shippingMethodCode' => '',
'additionalData' => [
'extension_attributes' => [
'gift_messages' => [
[
'gift_message_id' => 0,
'customer_id' => 0,
'sender' => '',
'recipient' => '',
'message' => '',
'extension_attributes' => [
'entity_id' => '',
'entity_type' => '',
'wrapping_id' => 0,
'wrapping_allow_gift_receipt' => null,
'wrapping_add_printed_card' => null
]
]
]
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'shippingCarrierCode' => '',
'shippingMethodCode' => '',
'additionalData' => [
'extension_attributes' => [
'gift_messages' => [
[
'gift_message_id' => 0,
'customer_id' => 0,
'sender' => '',
'recipient' => '',
'message' => '',
'extension_attributes' => [
'entity_id' => '',
'entity_type' => '',
'wrapping_id' => 0,
'wrapping_allow_gift_receipt' => null,
'wrapping_add_printed_card' => null
]
]
]
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/carts/mine/collect-totals');
$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}}/async/V1/carts/mine/collect-totals' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/carts/mine/collect-totals' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/async/V1/carts/mine/collect-totals", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/carts/mine/collect-totals"
payload = {
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": { "agreement_ids": [] }
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": { "gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": False,
"wrapping_add_printed_card": False
}
}
] },
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/carts/mine/collect-totals"
payload <- "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\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}}/async/V1/carts/mine/collect-totals")
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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.put('/baseUrl/async/V1/carts/mine/collect-totals') do |req|
req.body = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\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}}/async/V1/carts/mine/collect-totals";
let payload = json!({
"paymentMethod": json!({
"po_number": "",
"method": "",
"additional_data": (),
"extension_attributes": json!({"agreement_ids": ()})
}),
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": json!({
"extension_attributes": json!({"gift_messages": (
json!({
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": json!({
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
})
})
)}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})
});
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}}/async/V1/carts/mine/collect-totals \
--header 'content-type: application/json' \
--data '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
echo '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}' | \
http PUT {{baseUrl}}/async/V1/carts/mine/collect-totals \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "shippingCarrierCode": "",\n "shippingMethodCode": "",\n "additionalData": {\n "extension_attributes": {\n "gift_messages": [\n {\n "gift_message_id": 0,\n "customer_id": 0,\n "sender": "",\n "recipient": "",\n "message": "",\n "extension_attributes": {\n "entity_id": "",\n "entity_type": "",\n "wrapping_id": 0,\n "wrapping_allow_gift_receipt": false,\n "wrapping_add_printed_card": false\n }\n }\n ]\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/carts/mine/collect-totals
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"paymentMethod": [
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": ["agreement_ids": []]
],
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": [
"extension_attributes": ["gift_messages": [
[
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": [
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
]
]
]],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/carts/mine/collect-totals")! 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
carts-mine-payment-information
{{baseUrl}}/async/V1/carts/mine/payment-information
BODY json
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/carts/mine/payment-information");
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/carts/mine/payment-information" {:content-type :json
:form-params {:paymentMethod {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}
:billingAddress {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/carts/mine/payment-information"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/carts/mine/payment-information"),
Content = new StringContent("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/carts/mine/payment-information");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/carts/mine/payment-information"
payload := strings.NewReader("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/carts/mine/payment-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1069
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/carts/mine/payment-information")
.setHeader("content-type", "application/json")
.setBody("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/carts/mine/payment-information"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/carts/mine/payment-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/carts/mine/payment-information")
.header("content-type", "application/json")
.body("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/carts/mine/payment-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/carts/mine/payment-information',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/carts/mine/payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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}}/async/V1/carts/mine/payment-information',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/carts/mine/payment-information")
.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/async/V1/carts/mine/payment-information',
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({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/carts/mine/payment-information',
headers: {'content-type': 'application/json'},
body: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
},
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}}/async/V1/carts/mine/payment-information');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
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}}/async/V1/carts/mine/payment-information',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/carts/mine/payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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 = @{ @"paymentMethod": @{ @"po_number": @"", @"method": @"", @"additional_data": @[ ], @"extension_attributes": @{ @"agreement_ids": @[ ] } },
@"billingAddress": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/carts/mine/payment-information"]
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}}/async/V1/carts/mine/payment-information" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/carts/mine/payment-information",
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([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]),
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}}/async/V1/carts/mine/payment-information', [
'body' => '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/carts/mine/payment-information');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/carts/mine/payment-information');
$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}}/async/V1/carts/mine/payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/carts/mine/payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/carts/mine/payment-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/carts/mine/payment-information"
payload = {
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": { "agreement_ids": [] }
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/carts/mine/payment-information"
payload <- "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/carts/mine/payment-information")
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/carts/mine/payment-information') do |req|
req.body = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/carts/mine/payment-information";
let payload = json!({
"paymentMethod": json!({
"po_number": "",
"method": "",
"additional_data": (),
"extension_attributes": json!({"agreement_ids": ()})
}),
"billingAddress": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})
});
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}}/async/V1/carts/mine/payment-information \
--header 'content-type: application/json' \
--data '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
echo '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}' | \
http POST {{baseUrl}}/async/V1/carts/mine/payment-information \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/carts/mine/payment-information
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"paymentMethod": [
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": ["agreement_ids": []]
],
"billingAddress": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/carts/mine/payment-information")! 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
carts-mine-set-payment-information
{{baseUrl}}/async/V1/carts/mine/set-payment-information
BODY json
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/carts/mine/set-payment-information");
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/carts/mine/set-payment-information" {:content-type :json
:form-params {:paymentMethod {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}
:billingAddress {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/carts/mine/set-payment-information"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/carts/mine/set-payment-information"),
Content = new StringContent("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/carts/mine/set-payment-information");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/carts/mine/set-payment-information"
payload := strings.NewReader("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/carts/mine/set-payment-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1069
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/carts/mine/set-payment-information")
.setHeader("content-type", "application/json")
.setBody("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/carts/mine/set-payment-information"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/carts/mine/set-payment-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/carts/mine/set-payment-information")
.header("content-type", "application/json")
.body("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/carts/mine/set-payment-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/carts/mine/set-payment-information',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/carts/mine/set-payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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}}/async/V1/carts/mine/set-payment-information',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/carts/mine/set-payment-information")
.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/async/V1/carts/mine/set-payment-information',
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({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/carts/mine/set-payment-information',
headers: {'content-type': 'application/json'},
body: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
},
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}}/async/V1/carts/mine/set-payment-information');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
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}}/async/V1/carts/mine/set-payment-information',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/carts/mine/set-payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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 = @{ @"paymentMethod": @{ @"po_number": @"", @"method": @"", @"additional_data": @[ ], @"extension_attributes": @{ @"agreement_ids": @[ ] } },
@"billingAddress": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/carts/mine/set-payment-information"]
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}}/async/V1/carts/mine/set-payment-information" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/carts/mine/set-payment-information",
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([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]),
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}}/async/V1/carts/mine/set-payment-information', [
'body' => '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/carts/mine/set-payment-information');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/carts/mine/set-payment-information');
$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}}/async/V1/carts/mine/set-payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/carts/mine/set-payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/carts/mine/set-payment-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/carts/mine/set-payment-information"
payload = {
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": { "agreement_ids": [] }
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/carts/mine/set-payment-information"
payload <- "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/carts/mine/set-payment-information")
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/carts/mine/set-payment-information') do |req|
req.body = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/carts/mine/set-payment-information";
let payload = json!({
"paymentMethod": json!({
"po_number": "",
"method": "",
"additional_data": (),
"extension_attributes": json!({"agreement_ids": ()})
}),
"billingAddress": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})
});
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}}/async/V1/carts/mine/set-payment-information \
--header 'content-type: application/json' \
--data '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
echo '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}' | \
http POST {{baseUrl}}/async/V1/carts/mine/set-payment-information \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/carts/mine/set-payment-information
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"paymentMethod": [
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": ["agreement_ids": []]
],
"billingAddress": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/carts/mine/set-payment-information")! 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
customers
{{baseUrl}}/async/V1/customers
BODY json
{
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"password": "",
"redirectUrl": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/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 \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/customers" {:content-type :json
:form-params {:customer {:id 0
:group_id 0
:default_billing ""
:default_shipping ""
:confirmation ""
:created_at ""
:updated_at ""
:created_in ""
:dob ""
:email ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:gender 0
:store_id 0
:taxvat ""
:website_id 0
:addresses [{:id 0
:customer_id 0
:region {:region_code ""
:region ""
:region_id 0
:extension_attributes {}}
:region_id 0
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:default_shipping false
:default_billing false
:extension_attributes {}
:custom_attributes [{:attribute_code ""
:value ""}]}]
:disable_auto_group_change 0
:extension_attributes {:company_attributes {:customer_id 0
:company_id 0
:job_title ""
:status 0
:telephone ""
:extension_attributes {}}
:is_subscribed false
:amazon_id ""
:vertex_customer_code ""}
:custom_attributes [{}]}
:password ""
:redirectUrl ""}})
require "http/client"
url = "{{baseUrl}}/async/V1/customers"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\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}}/async/V1/customers"),
Content = new StringContent("{\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\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}}/async/V1/customers");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/customers"
payload := strings.NewReader("{\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\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/async/V1/customers HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1626
{
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"password": "",
"redirectUrl": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/customers")
.setHeader("content-type", "application/json")
.setBody("{\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/customers"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\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\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/customers")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/customers")
.header("content-type", "application/json")
.body("{\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\n}")
.asString();
const data = JSON.stringify({
customer: {
id: 0,
group_id: 0,
default_billing: '',
default_shipping: '',
confirmation: '',
created_at: '',
updated_at: '',
created_in: '',
dob: '',
email: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
gender: 0,
store_id: 0,
taxvat: '',
website_id: 0,
addresses: [
{
id: 0,
customer_id: 0,
region: {
region_code: '',
region: '',
region_id: 0,
extension_attributes: {}
},
region_id: 0,
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
default_shipping: false,
default_billing: false,
extension_attributes: {},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
],
disable_auto_group_change: 0,
extension_attributes: {
company_attributes: {
customer_id: 0,
company_id: 0,
job_title: '',
status: 0,
telephone: '',
extension_attributes: {}
},
is_subscribed: false,
amazon_id: '',
vertex_customer_code: ''
},
custom_attributes: [
{}
]
},
password: '',
redirectUrl: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/customers');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/customers',
headers: {'content-type': 'application/json'},
data: {
customer: {
id: 0,
group_id: 0,
default_billing: '',
default_shipping: '',
confirmation: '',
created_at: '',
updated_at: '',
created_in: '',
dob: '',
email: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
gender: 0,
store_id: 0,
taxvat: '',
website_id: 0,
addresses: [
{
id: 0,
customer_id: 0,
region: {region_code: '', region: '', region_id: 0, extension_attributes: {}},
region_id: 0,
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
default_shipping: false,
default_billing: false,
extension_attributes: {},
custom_attributes: [{attribute_code: '', value: ''}]
}
],
disable_auto_group_change: 0,
extension_attributes: {
company_attributes: {
customer_id: 0,
company_id: 0,
job_title: '',
status: 0,
telephone: '',
extension_attributes: {}
},
is_subscribed: false,
amazon_id: '',
vertex_customer_code: ''
},
custom_attributes: [{}]
},
password: '',
redirectUrl: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/customers';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"customer":{"id":0,"group_id":0,"default_billing":"","default_shipping":"","confirmation":"","created_at":"","updated_at":"","created_in":"","dob":"","email":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","gender":0,"store_id":0,"taxvat":"","website_id":0,"addresses":[{"id":0,"customer_id":0,"region":{"region_code":"","region":"","region_id":0,"extension_attributes":{}},"region_id":0,"country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","default_shipping":false,"default_billing":false,"extension_attributes":{},"custom_attributes":[{"attribute_code":"","value":""}]}],"disable_auto_group_change":0,"extension_attributes":{"company_attributes":{"customer_id":0,"company_id":0,"job_title":"","status":0,"telephone":"","extension_attributes":{}},"is_subscribed":false,"amazon_id":"","vertex_customer_code":""},"custom_attributes":[{}]},"password":"","redirectUrl":""}'
};
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}}/async/V1/customers',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "customer": {\n "id": 0,\n "group_id": 0,\n "default_billing": "",\n "default_shipping": "",\n "confirmation": "",\n "created_at": "",\n "updated_at": "",\n "created_in": "",\n "dob": "",\n "email": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "gender": 0,\n "store_id": 0,\n "taxvat": "",\n "website_id": 0,\n "addresses": [\n {\n "id": 0,\n "customer_id": 0,\n "region": {\n "region_code": "",\n "region": "",\n "region_id": 0,\n "extension_attributes": {}\n },\n "region_id": 0,\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "default_shipping": false,\n "default_billing": false,\n "extension_attributes": {},\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n ],\n "disable_auto_group_change": 0,\n "extension_attributes": {\n "company_attributes": {\n "customer_id": 0,\n "company_id": 0,\n "job_title": "",\n "status": 0,\n "telephone": "",\n "extension_attributes": {}\n },\n "is_subscribed": false,\n "amazon_id": "",\n "vertex_customer_code": ""\n },\n "custom_attributes": [\n {}\n ]\n },\n "password": "",\n "redirectUrl": ""\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\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/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/async/V1/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({
customer: {
id: 0,
group_id: 0,
default_billing: '',
default_shipping: '',
confirmation: '',
created_at: '',
updated_at: '',
created_in: '',
dob: '',
email: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
gender: 0,
store_id: 0,
taxvat: '',
website_id: 0,
addresses: [
{
id: 0,
customer_id: 0,
region: {region_code: '', region: '', region_id: 0, extension_attributes: {}},
region_id: 0,
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
default_shipping: false,
default_billing: false,
extension_attributes: {},
custom_attributes: [{attribute_code: '', value: ''}]
}
],
disable_auto_group_change: 0,
extension_attributes: {
company_attributes: {
customer_id: 0,
company_id: 0,
job_title: '',
status: 0,
telephone: '',
extension_attributes: {}
},
is_subscribed: false,
amazon_id: '',
vertex_customer_code: ''
},
custom_attributes: [{}]
},
password: '',
redirectUrl: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/customers',
headers: {'content-type': 'application/json'},
body: {
customer: {
id: 0,
group_id: 0,
default_billing: '',
default_shipping: '',
confirmation: '',
created_at: '',
updated_at: '',
created_in: '',
dob: '',
email: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
gender: 0,
store_id: 0,
taxvat: '',
website_id: 0,
addresses: [
{
id: 0,
customer_id: 0,
region: {region_code: '', region: '', region_id: 0, extension_attributes: {}},
region_id: 0,
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
default_shipping: false,
default_billing: false,
extension_attributes: {},
custom_attributes: [{attribute_code: '', value: ''}]
}
],
disable_auto_group_change: 0,
extension_attributes: {
company_attributes: {
customer_id: 0,
company_id: 0,
job_title: '',
status: 0,
telephone: '',
extension_attributes: {}
},
is_subscribed: false,
amazon_id: '',
vertex_customer_code: ''
},
custom_attributes: [{}]
},
password: '',
redirectUrl: ''
},
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}}/async/V1/customers');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
customer: {
id: 0,
group_id: 0,
default_billing: '',
default_shipping: '',
confirmation: '',
created_at: '',
updated_at: '',
created_in: '',
dob: '',
email: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
gender: 0,
store_id: 0,
taxvat: '',
website_id: 0,
addresses: [
{
id: 0,
customer_id: 0,
region: {
region_code: '',
region: '',
region_id: 0,
extension_attributes: {}
},
region_id: 0,
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
default_shipping: false,
default_billing: false,
extension_attributes: {},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
],
disable_auto_group_change: 0,
extension_attributes: {
company_attributes: {
customer_id: 0,
company_id: 0,
job_title: '',
status: 0,
telephone: '',
extension_attributes: {}
},
is_subscribed: false,
amazon_id: '',
vertex_customer_code: ''
},
custom_attributes: [
{}
]
},
password: '',
redirectUrl: ''
});
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}}/async/V1/customers',
headers: {'content-type': 'application/json'},
data: {
customer: {
id: 0,
group_id: 0,
default_billing: '',
default_shipping: '',
confirmation: '',
created_at: '',
updated_at: '',
created_in: '',
dob: '',
email: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
gender: 0,
store_id: 0,
taxvat: '',
website_id: 0,
addresses: [
{
id: 0,
customer_id: 0,
region: {region_code: '', region: '', region_id: 0, extension_attributes: {}},
region_id: 0,
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
default_shipping: false,
default_billing: false,
extension_attributes: {},
custom_attributes: [{attribute_code: '', value: ''}]
}
],
disable_auto_group_change: 0,
extension_attributes: {
company_attributes: {
customer_id: 0,
company_id: 0,
job_title: '',
status: 0,
telephone: '',
extension_attributes: {}
},
is_subscribed: false,
amazon_id: '',
vertex_customer_code: ''
},
custom_attributes: [{}]
},
password: '',
redirectUrl: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/customers';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"customer":{"id":0,"group_id":0,"default_billing":"","default_shipping":"","confirmation":"","created_at":"","updated_at":"","created_in":"","dob":"","email":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","gender":0,"store_id":0,"taxvat":"","website_id":0,"addresses":[{"id":0,"customer_id":0,"region":{"region_code":"","region":"","region_id":0,"extension_attributes":{}},"region_id":0,"country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","default_shipping":false,"default_billing":false,"extension_attributes":{},"custom_attributes":[{"attribute_code":"","value":""}]}],"disable_auto_group_change":0,"extension_attributes":{"company_attributes":{"customer_id":0,"company_id":0,"job_title":"","status":0,"telephone":"","extension_attributes":{}},"is_subscribed":false,"amazon_id":"","vertex_customer_code":""},"custom_attributes":[{}]},"password":"","redirectUrl":""}'
};
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": @0, @"group_id": @0, @"default_billing": @"", @"default_shipping": @"", @"confirmation": @"", @"created_at": @"", @"updated_at": @"", @"created_in": @"", @"dob": @"", @"email": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"gender": @0, @"store_id": @0, @"taxvat": @"", @"website_id": @0, @"addresses": @[ @{ @"id": @0, @"customer_id": @0, @"region": @{ @"region_code": @"", @"region": @"", @"region_id": @0, @"extension_attributes": @{ } }, @"region_id": @0, @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"default_shipping": @NO, @"default_billing": @NO, @"extension_attributes": @{ }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } ], @"disable_auto_group_change": @0, @"extension_attributes": @{ @"company_attributes": @{ @"customer_id": @0, @"company_id": @0, @"job_title": @"", @"status": @0, @"telephone": @"", @"extension_attributes": @{ } }, @"is_subscribed": @NO, @"amazon_id": @"", @"vertex_customer_code": @"" }, @"custom_attributes": @[ @{ } ] },
@"password": @"",
@"redirectUrl": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/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}}/async/V1/customers" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/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([
'customer' => [
'id' => 0,
'group_id' => 0,
'default_billing' => '',
'default_shipping' => '',
'confirmation' => '',
'created_at' => '',
'updated_at' => '',
'created_in' => '',
'dob' => '',
'email' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'gender' => 0,
'store_id' => 0,
'taxvat' => '',
'website_id' => 0,
'addresses' => [
[
'id' => 0,
'customer_id' => 0,
'region' => [
'region_code' => '',
'region' => '',
'region_id' => 0,
'extension_attributes' => [
]
],
'region_id' => 0,
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'default_shipping' => null,
'default_billing' => null,
'extension_attributes' => [
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
],
'disable_auto_group_change' => 0,
'extension_attributes' => [
'company_attributes' => [
'customer_id' => 0,
'company_id' => 0,
'job_title' => '',
'status' => 0,
'telephone' => '',
'extension_attributes' => [
]
],
'is_subscribed' => null,
'amazon_id' => '',
'vertex_customer_code' => ''
],
'custom_attributes' => [
[
]
]
],
'password' => '',
'redirectUrl' => ''
]),
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}}/async/V1/customers', [
'body' => '{
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"password": "",
"redirectUrl": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/customers');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'customer' => [
'id' => 0,
'group_id' => 0,
'default_billing' => '',
'default_shipping' => '',
'confirmation' => '',
'created_at' => '',
'updated_at' => '',
'created_in' => '',
'dob' => '',
'email' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'gender' => 0,
'store_id' => 0,
'taxvat' => '',
'website_id' => 0,
'addresses' => [
[
'id' => 0,
'customer_id' => 0,
'region' => [
'region_code' => '',
'region' => '',
'region_id' => 0,
'extension_attributes' => [
]
],
'region_id' => 0,
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'default_shipping' => null,
'default_billing' => null,
'extension_attributes' => [
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
],
'disable_auto_group_change' => 0,
'extension_attributes' => [
'company_attributes' => [
'customer_id' => 0,
'company_id' => 0,
'job_title' => '',
'status' => 0,
'telephone' => '',
'extension_attributes' => [
]
],
'is_subscribed' => null,
'amazon_id' => '',
'vertex_customer_code' => ''
],
'custom_attributes' => [
[
]
]
],
'password' => '',
'redirectUrl' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'customer' => [
'id' => 0,
'group_id' => 0,
'default_billing' => '',
'default_shipping' => '',
'confirmation' => '',
'created_at' => '',
'updated_at' => '',
'created_in' => '',
'dob' => '',
'email' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'gender' => 0,
'store_id' => 0,
'taxvat' => '',
'website_id' => 0,
'addresses' => [
[
'id' => 0,
'customer_id' => 0,
'region' => [
'region_code' => '',
'region' => '',
'region_id' => 0,
'extension_attributes' => [
]
],
'region_id' => 0,
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'default_shipping' => null,
'default_billing' => null,
'extension_attributes' => [
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
],
'disable_auto_group_change' => 0,
'extension_attributes' => [
'company_attributes' => [
'customer_id' => 0,
'company_id' => 0,
'job_title' => '',
'status' => 0,
'telephone' => '',
'extension_attributes' => [
]
],
'is_subscribed' => null,
'amazon_id' => '',
'vertex_customer_code' => ''
],
'custom_attributes' => [
[
]
]
],
'password' => '',
'redirectUrl' => ''
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/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}}/async/V1/customers' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"password": "",
"redirectUrl": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/customers' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"password": "",
"redirectUrl": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/customers", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/customers"
payload = {
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": False,
"default_billing": False,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": False,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [{}]
},
"password": "",
"redirectUrl": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/customers"
payload <- "{\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\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}}/async/V1/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 \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\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/async/V1/customers') do |req|
req.body = "{\n \"customer\": {\n \"id\": 0,\n \"group_id\": 0,\n \"default_billing\": \"\",\n \"default_shipping\": \"\",\n \"confirmation\": \"\",\n \"created_at\": \"\",\n \"updated_at\": \"\",\n \"created_in\": \"\",\n \"dob\": \"\",\n \"email\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"gender\": 0,\n \"store_id\": 0,\n \"taxvat\": \"\",\n \"website_id\": 0,\n \"addresses\": [\n {\n \"id\": 0,\n \"customer_id\": 0,\n \"region\": {\n \"region_code\": \"\",\n \"region\": \"\",\n \"region_id\": 0,\n \"extension_attributes\": {}\n },\n \"region_id\": 0,\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"default_shipping\": false,\n \"default_billing\": false,\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n ],\n \"disable_auto_group_change\": 0,\n \"extension_attributes\": {\n \"company_attributes\": {\n \"customer_id\": 0,\n \"company_id\": 0,\n \"job_title\": \"\",\n \"status\": 0,\n \"telephone\": \"\",\n \"extension_attributes\": {}\n },\n \"is_subscribed\": false,\n \"amazon_id\": \"\",\n \"vertex_customer_code\": \"\"\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"password\": \"\",\n \"redirectUrl\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/customers";
let payload = json!({
"customer": json!({
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": (
json!({
"id": 0,
"customer_id": 0,
"region": json!({
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": json!({})
}),
"region_id": 0,
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": json!({}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})
),
"disable_auto_group_change": 0,
"extension_attributes": json!({
"company_attributes": json!({
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": json!({})
}),
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
}),
"custom_attributes": (json!({}))
}),
"password": "",
"redirectUrl": ""
});
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}}/async/V1/customers \
--header 'content-type: application/json' \
--data '{
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"password": "",
"redirectUrl": ""
}'
echo '{
"customer": {
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
{
"id": 0,
"customer_id": 0,
"region": {
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": {}
},
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": {},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
],
"disable_auto_group_change": 0,
"extension_attributes": {
"company_attributes": {
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": {}
},
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
},
"custom_attributes": [
{}
]
},
"password": "",
"redirectUrl": ""
}' | \
http POST {{baseUrl}}/async/V1/customers \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "customer": {\n "id": 0,\n "group_id": 0,\n "default_billing": "",\n "default_shipping": "",\n "confirmation": "",\n "created_at": "",\n "updated_at": "",\n "created_in": "",\n "dob": "",\n "email": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "gender": 0,\n "store_id": 0,\n "taxvat": "",\n "website_id": 0,\n "addresses": [\n {\n "id": 0,\n "customer_id": 0,\n "region": {\n "region_code": "",\n "region": "",\n "region_id": 0,\n "extension_attributes": {}\n },\n "region_id": 0,\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "default_shipping": false,\n "default_billing": false,\n "extension_attributes": {},\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n ],\n "disable_auto_group_change": 0,\n "extension_attributes": {\n "company_attributes": {\n "customer_id": 0,\n "company_id": 0,\n "job_title": "",\n "status": 0,\n "telephone": "",\n "extension_attributes": {}\n },\n "is_subscribed": false,\n "amazon_id": "",\n "vertex_customer_code": ""\n },\n "custom_attributes": [\n {}\n ]\n },\n "password": "",\n "redirectUrl": ""\n}' \
--output-document \
- {{baseUrl}}/async/V1/customers
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"customer": [
"id": 0,
"group_id": 0,
"default_billing": "",
"default_shipping": "",
"confirmation": "",
"created_at": "",
"updated_at": "",
"created_in": "",
"dob": "",
"email": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"gender": 0,
"store_id": 0,
"taxvat": "",
"website_id": 0,
"addresses": [
[
"id": 0,
"customer_id": 0,
"region": [
"region_code": "",
"region": "",
"region_id": 0,
"extension_attributes": []
],
"region_id": 0,
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"default_shipping": false,
"default_billing": false,
"extension_attributes": [],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]
],
"disable_auto_group_change": 0,
"extension_attributes": [
"company_attributes": [
"customer_id": 0,
"company_id": 0,
"job_title": "",
"status": 0,
"telephone": "",
"extension_attributes": []
],
"is_subscribed": false,
"amazon_id": "",
"vertex_customer_code": ""
],
"custom_attributes": [[]]
],
"password": "",
"redirectUrl": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/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()
POST
customers-isEmailAvailable
{{baseUrl}}/async/V1/customers/isEmailAvailable
BODY json
{
"customerEmail": "",
"websiteId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/customers/isEmailAvailable");
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 \"customerEmail\": \"\",\n \"websiteId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/customers/isEmailAvailable" {:content-type :json
:form-params {:customerEmail ""
:websiteId 0}})
require "http/client"
url = "{{baseUrl}}/async/V1/customers/isEmailAvailable"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"customerEmail\": \"\",\n \"websiteId\": 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}}/async/V1/customers/isEmailAvailable"),
Content = new StringContent("{\n \"customerEmail\": \"\",\n \"websiteId\": 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}}/async/V1/customers/isEmailAvailable");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"customerEmail\": \"\",\n \"websiteId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/customers/isEmailAvailable"
payload := strings.NewReader("{\n \"customerEmail\": \"\",\n \"websiteId\": 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/async/V1/customers/isEmailAvailable HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 43
{
"customerEmail": "",
"websiteId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/customers/isEmailAvailable")
.setHeader("content-type", "application/json")
.setBody("{\n \"customerEmail\": \"\",\n \"websiteId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/customers/isEmailAvailable"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"customerEmail\": \"\",\n \"websiteId\": 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 \"customerEmail\": \"\",\n \"websiteId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/customers/isEmailAvailable")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/customers/isEmailAvailable")
.header("content-type", "application/json")
.body("{\n \"customerEmail\": \"\",\n \"websiteId\": 0\n}")
.asString();
const data = JSON.stringify({
customerEmail: '',
websiteId: 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}}/async/V1/customers/isEmailAvailable');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/customers/isEmailAvailable',
headers: {'content-type': 'application/json'},
data: {customerEmail: '', websiteId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/customers/isEmailAvailable';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"customerEmail":"","websiteId":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}}/async/V1/customers/isEmailAvailable',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "customerEmail": "",\n "websiteId": 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 \"customerEmail\": \"\",\n \"websiteId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/customers/isEmailAvailable")
.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/async/V1/customers/isEmailAvailable',
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({customerEmail: '', websiteId: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/customers/isEmailAvailable',
headers: {'content-type': 'application/json'},
body: {customerEmail: '', websiteId: 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}}/async/V1/customers/isEmailAvailable');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
customerEmail: '',
websiteId: 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}}/async/V1/customers/isEmailAvailable',
headers: {'content-type': 'application/json'},
data: {customerEmail: '', websiteId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/customers/isEmailAvailable';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"customerEmail":"","websiteId":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 = @{ @"customerEmail": @"",
@"websiteId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/customers/isEmailAvailable"]
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}}/async/V1/customers/isEmailAvailable" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"customerEmail\": \"\",\n \"websiteId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/customers/isEmailAvailable",
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([
'customerEmail' => '',
'websiteId' => 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}}/async/V1/customers/isEmailAvailable', [
'body' => '{
"customerEmail": "",
"websiteId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/customers/isEmailAvailable');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'customerEmail' => '',
'websiteId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'customerEmail' => '',
'websiteId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/customers/isEmailAvailable');
$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}}/async/V1/customers/isEmailAvailable' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"customerEmail": "",
"websiteId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/customers/isEmailAvailable' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"customerEmail": "",
"websiteId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"customerEmail\": \"\",\n \"websiteId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/customers/isEmailAvailable", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/customers/isEmailAvailable"
payload = {
"customerEmail": "",
"websiteId": 0
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/customers/isEmailAvailable"
payload <- "{\n \"customerEmail\": \"\",\n \"websiteId\": 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}}/async/V1/customers/isEmailAvailable")
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 \"customerEmail\": \"\",\n \"websiteId\": 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/async/V1/customers/isEmailAvailable') do |req|
req.body = "{\n \"customerEmail\": \"\",\n \"websiteId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/customers/isEmailAvailable";
let payload = json!({
"customerEmail": "",
"websiteId": 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}}/async/V1/customers/isEmailAvailable \
--header 'content-type: application/json' \
--data '{
"customerEmail": "",
"websiteId": 0
}'
echo '{
"customerEmail": "",
"websiteId": 0
}' | \
http POST {{baseUrl}}/async/V1/customers/isEmailAvailable \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "customerEmail": "",\n "websiteId": 0\n}' \
--output-document \
- {{baseUrl}}/async/V1/customers/isEmailAvailable
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"customerEmail": "",
"websiteId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/customers/isEmailAvailable")! 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()
PUT
customers-me-activate
{{baseUrl}}/async/V1/customers/me/activate
BODY json
{
"confirmationKey": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/customers/me/activate");
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 \"confirmationKey\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/customers/me/activate" {:content-type :json
:form-params {:confirmationKey ""}})
require "http/client"
url = "{{baseUrl}}/async/V1/customers/me/activate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"confirmationKey\": \"\"\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}}/async/V1/customers/me/activate"),
Content = new StringContent("{\n \"confirmationKey\": \"\"\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}}/async/V1/customers/me/activate");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"confirmationKey\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/customers/me/activate"
payload := strings.NewReader("{\n \"confirmationKey\": \"\"\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/async/V1/customers/me/activate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 27
{
"confirmationKey": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/customers/me/activate")
.setHeader("content-type", "application/json")
.setBody("{\n \"confirmationKey\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/customers/me/activate"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"confirmationKey\": \"\"\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 \"confirmationKey\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/customers/me/activate")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/customers/me/activate")
.header("content-type", "application/json")
.body("{\n \"confirmationKey\": \"\"\n}")
.asString();
const data = JSON.stringify({
confirmationKey: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/async/V1/customers/me/activate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/customers/me/activate',
headers: {'content-type': 'application/json'},
data: {confirmationKey: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/customers/me/activate';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"confirmationKey":""}'
};
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}}/async/V1/customers/me/activate',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "confirmationKey": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"confirmationKey\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/customers/me/activate")
.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/async/V1/customers/me/activate',
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({confirmationKey: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/customers/me/activate',
headers: {'content-type': 'application/json'},
body: {confirmationKey: ''},
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}}/async/V1/customers/me/activate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
confirmationKey: ''
});
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}}/async/V1/customers/me/activate',
headers: {'content-type': 'application/json'},
data: {confirmationKey: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/customers/me/activate';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"confirmationKey":""}'
};
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 = @{ @"confirmationKey": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/customers/me/activate"]
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}}/async/V1/customers/me/activate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"confirmationKey\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/customers/me/activate",
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([
'confirmationKey' => ''
]),
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}}/async/V1/customers/me/activate', [
'body' => '{
"confirmationKey": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/customers/me/activate');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'confirmationKey' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'confirmationKey' => ''
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/customers/me/activate');
$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}}/async/V1/customers/me/activate' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"confirmationKey": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/customers/me/activate' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"confirmationKey": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"confirmationKey\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/async/V1/customers/me/activate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/customers/me/activate"
payload = { "confirmationKey": "" }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/customers/me/activate"
payload <- "{\n \"confirmationKey\": \"\"\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}}/async/V1/customers/me/activate")
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 \"confirmationKey\": \"\"\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/async/V1/customers/me/activate') do |req|
req.body = "{\n \"confirmationKey\": \"\"\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}}/async/V1/customers/me/activate";
let payload = json!({"confirmationKey": ""});
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}}/async/V1/customers/me/activate \
--header 'content-type: application/json' \
--data '{
"confirmationKey": ""
}'
echo '{
"confirmationKey": ""
}' | \
http PUT {{baseUrl}}/async/V1/customers/me/activate \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "confirmationKey": ""\n}' \
--output-document \
- {{baseUrl}}/async/V1/customers/me/activate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["confirmationKey": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/customers/me/activate")! 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
customers-me-password
{{baseUrl}}/async/V1/customers/me/password
BODY json
{
"currentPassword": "",
"newPassword": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/customers/me/password");
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 \"currentPassword\": \"\",\n \"newPassword\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/customers/me/password" {:content-type :json
:form-params {:currentPassword ""
:newPassword ""}})
require "http/client"
url = "{{baseUrl}}/async/V1/customers/me/password"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"currentPassword\": \"\",\n \"newPassword\": \"\"\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}}/async/V1/customers/me/password"),
Content = new StringContent("{\n \"currentPassword\": \"\",\n \"newPassword\": \"\"\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}}/async/V1/customers/me/password");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"currentPassword\": \"\",\n \"newPassword\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/customers/me/password"
payload := strings.NewReader("{\n \"currentPassword\": \"\",\n \"newPassword\": \"\"\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/async/V1/customers/me/password HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 48
{
"currentPassword": "",
"newPassword": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/customers/me/password")
.setHeader("content-type", "application/json")
.setBody("{\n \"currentPassword\": \"\",\n \"newPassword\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/customers/me/password"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"currentPassword\": \"\",\n \"newPassword\": \"\"\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 \"currentPassword\": \"\",\n \"newPassword\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/customers/me/password")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/customers/me/password")
.header("content-type", "application/json")
.body("{\n \"currentPassword\": \"\",\n \"newPassword\": \"\"\n}")
.asString();
const data = JSON.stringify({
currentPassword: '',
newPassword: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/async/V1/customers/me/password');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/customers/me/password',
headers: {'content-type': 'application/json'},
data: {currentPassword: '', newPassword: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/customers/me/password';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"currentPassword":"","newPassword":""}'
};
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}}/async/V1/customers/me/password',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "currentPassword": "",\n "newPassword": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"currentPassword\": \"\",\n \"newPassword\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/customers/me/password")
.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/async/V1/customers/me/password',
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({currentPassword: '', newPassword: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/customers/me/password',
headers: {'content-type': 'application/json'},
body: {currentPassword: '', newPassword: ''},
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}}/async/V1/customers/me/password');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
currentPassword: '',
newPassword: ''
});
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}}/async/V1/customers/me/password',
headers: {'content-type': 'application/json'},
data: {currentPassword: '', newPassword: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/customers/me/password';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"currentPassword":"","newPassword":""}'
};
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 = @{ @"currentPassword": @"",
@"newPassword": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/customers/me/password"]
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}}/async/V1/customers/me/password" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"currentPassword\": \"\",\n \"newPassword\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/customers/me/password",
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([
'currentPassword' => '',
'newPassword' => ''
]),
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}}/async/V1/customers/me/password', [
'body' => '{
"currentPassword": "",
"newPassword": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/customers/me/password');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'currentPassword' => '',
'newPassword' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'currentPassword' => '',
'newPassword' => ''
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/customers/me/password');
$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}}/async/V1/customers/me/password' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"currentPassword": "",
"newPassword": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/customers/me/password' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"currentPassword": "",
"newPassword": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"currentPassword\": \"\",\n \"newPassword\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/async/V1/customers/me/password", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/customers/me/password"
payload = {
"currentPassword": "",
"newPassword": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/customers/me/password"
payload <- "{\n \"currentPassword\": \"\",\n \"newPassword\": \"\"\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}}/async/V1/customers/me/password")
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 \"currentPassword\": \"\",\n \"newPassword\": \"\"\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/async/V1/customers/me/password') do |req|
req.body = "{\n \"currentPassword\": \"\",\n \"newPassword\": \"\"\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}}/async/V1/customers/me/password";
let payload = json!({
"currentPassword": "",
"newPassword": ""
});
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}}/async/V1/customers/me/password \
--header 'content-type: application/json' \
--data '{
"currentPassword": "",
"newPassword": ""
}'
echo '{
"currentPassword": "",
"newPassword": ""
}' | \
http PUT {{baseUrl}}/async/V1/customers/me/password \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "currentPassword": "",\n "newPassword": ""\n}' \
--output-document \
- {{baseUrl}}/async/V1/customers/me/password
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"currentPassword": "",
"newPassword": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/customers/me/password")! 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
customers-password
{{baseUrl}}/async/V1/customers/password
BODY json
{
"email": "",
"template": "",
"websiteId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/customers/password");
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 \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/customers/password" {:content-type :json
:form-params {:email ""
:template ""
:websiteId 0}})
require "http/client"
url = "{{baseUrl}}/async/V1/customers/password"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 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}}/async/V1/customers/password"),
Content = new StringContent("{\n \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 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}}/async/V1/customers/password");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/customers/password"
payload := strings.NewReader("{\n \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 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/async/V1/customers/password HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 53
{
"email": "",
"template": "",
"websiteId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/customers/password")
.setHeader("content-type", "application/json")
.setBody("{\n \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/customers/password"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 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 \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/customers/password")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/customers/password")
.header("content-type", "application/json")
.body("{\n \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 0\n}")
.asString();
const data = JSON.stringify({
email: '',
template: '',
websiteId: 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}}/async/V1/customers/password');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/customers/password',
headers: {'content-type': 'application/json'},
data: {email: '', template: '', websiteId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/customers/password';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"email":"","template":"","websiteId":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}}/async/V1/customers/password',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "email": "",\n "template": "",\n "websiteId": 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 \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/customers/password")
.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/async/V1/customers/password',
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({email: '', template: '', websiteId: 0}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/customers/password',
headers: {'content-type': 'application/json'},
body: {email: '', template: '', websiteId: 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}}/async/V1/customers/password');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
email: '',
template: '',
websiteId: 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}}/async/V1/customers/password',
headers: {'content-type': 'application/json'},
data: {email: '', template: '', websiteId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/customers/password';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"email":"","template":"","websiteId":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 = @{ @"email": @"",
@"template": @"",
@"websiteId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/customers/password"]
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}}/async/V1/customers/password" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/customers/password",
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([
'email' => '',
'template' => '',
'websiteId' => 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}}/async/V1/customers/password', [
'body' => '{
"email": "",
"template": "",
"websiteId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/customers/password');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'email' => '',
'template' => '',
'websiteId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'email' => '',
'template' => '',
'websiteId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/customers/password');
$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}}/async/V1/customers/password' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"template": "",
"websiteId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/customers/password' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"template": "",
"websiteId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/async/V1/customers/password", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/customers/password"
payload = {
"email": "",
"template": "",
"websiteId": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/customers/password"
payload <- "{\n \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 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}}/async/V1/customers/password")
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 \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 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/async/V1/customers/password') do |req|
req.body = "{\n \"email\": \"\",\n \"template\": \"\",\n \"websiteId\": 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}}/async/V1/customers/password";
let payload = json!({
"email": "",
"template": "",
"websiteId": 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}}/async/V1/customers/password \
--header 'content-type: application/json' \
--data '{
"email": "",
"template": "",
"websiteId": 0
}'
echo '{
"email": "",
"template": "",
"websiteId": 0
}' | \
http PUT {{baseUrl}}/async/V1/customers/password \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "email": "",\n "template": "",\n "websiteId": 0\n}' \
--output-document \
- {{baseUrl}}/async/V1/customers/password
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"email": "",
"template": "",
"websiteId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/customers/password")! 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
customers-resetPassword
{{baseUrl}}/async/V1/customers/resetPassword
BODY json
{
"email": "",
"resetToken": "",
"newPassword": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/customers/resetPassword");
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 \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/customers/resetPassword" {:content-type :json
:form-params {:email ""
:resetToken ""
:newPassword ""}})
require "http/client"
url = "{{baseUrl}}/async/V1/customers/resetPassword"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\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}}/async/V1/customers/resetPassword"),
Content = new StringContent("{\n \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\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}}/async/V1/customers/resetPassword");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/customers/resetPassword"
payload := strings.NewReader("{\n \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\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/async/V1/customers/resetPassword HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 58
{
"email": "",
"resetToken": "",
"newPassword": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/customers/resetPassword")
.setHeader("content-type", "application/json")
.setBody("{\n \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/customers/resetPassword"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\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 \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/customers/resetPassword")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/customers/resetPassword")
.header("content-type", "application/json")
.body("{\n \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\n}")
.asString();
const data = JSON.stringify({
email: '',
resetToken: '',
newPassword: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/customers/resetPassword');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/customers/resetPassword',
headers: {'content-type': 'application/json'},
data: {email: '', resetToken: '', newPassword: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/customers/resetPassword';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"email":"","resetToken":"","newPassword":""}'
};
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}}/async/V1/customers/resetPassword',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "email": "",\n "resetToken": "",\n "newPassword": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/customers/resetPassword")
.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/async/V1/customers/resetPassword',
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({email: '', resetToken: '', newPassword: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/customers/resetPassword',
headers: {'content-type': 'application/json'},
body: {email: '', resetToken: '', newPassword: ''},
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}}/async/V1/customers/resetPassword');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
email: '',
resetToken: '',
newPassword: ''
});
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}}/async/V1/customers/resetPassword',
headers: {'content-type': 'application/json'},
data: {email: '', resetToken: '', newPassword: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/customers/resetPassword';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"email":"","resetToken":"","newPassword":""}'
};
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 = @{ @"email": @"",
@"resetToken": @"",
@"newPassword": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/customers/resetPassword"]
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}}/async/V1/customers/resetPassword" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/customers/resetPassword",
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([
'email' => '',
'resetToken' => '',
'newPassword' => ''
]),
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}}/async/V1/customers/resetPassword', [
'body' => '{
"email": "",
"resetToken": "",
"newPassword": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/customers/resetPassword');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'email' => '',
'resetToken' => '',
'newPassword' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'email' => '',
'resetToken' => '',
'newPassword' => ''
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/customers/resetPassword');
$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}}/async/V1/customers/resetPassword' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"resetToken": "",
"newPassword": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/customers/resetPassword' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"resetToken": "",
"newPassword": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/customers/resetPassword", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/customers/resetPassword"
payload = {
"email": "",
"resetToken": "",
"newPassword": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/customers/resetPassword"
payload <- "{\n \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\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}}/async/V1/customers/resetPassword")
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 \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\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/async/V1/customers/resetPassword') do |req|
req.body = "{\n \"email\": \"\",\n \"resetToken\": \"\",\n \"newPassword\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/customers/resetPassword";
let payload = json!({
"email": "",
"resetToken": "",
"newPassword": ""
});
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}}/async/V1/customers/resetPassword \
--header 'content-type: application/json' \
--data '{
"email": "",
"resetToken": "",
"newPassword": ""
}'
echo '{
"email": "",
"resetToken": "",
"newPassword": ""
}' | \
http POST {{baseUrl}}/async/V1/customers/resetPassword \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "email": "",\n "resetToken": "",\n "newPassword": ""\n}' \
--output-document \
- {{baseUrl}}/async/V1/customers/resetPassword
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"email": "",
"resetToken": "",
"newPassword": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/customers/resetPassword")! 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
giftregistry-mine-estimate-shipping-methods
{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods
BODY json
{
"registryId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods");
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 \"registryId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods" {:content-type :json
:form-params {:registryId 0}})
require "http/client"
url = "{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"registryId\": 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}}/async/V1/giftregistry/mine/estimate-shipping-methods"),
Content = new StringContent("{\n \"registryId\": 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}}/async/V1/giftregistry/mine/estimate-shipping-methods");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"registryId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods"
payload := strings.NewReader("{\n \"registryId\": 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/async/V1/giftregistry/mine/estimate-shipping-methods HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 21
{
"registryId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods")
.setHeader("content-type", "application/json")
.setBody("{\n \"registryId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"registryId\": 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 \"registryId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods")
.header("content-type", "application/json")
.body("{\n \"registryId\": 0\n}")
.asString();
const data = JSON.stringify({
registryId: 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}}/async/V1/giftregistry/mine/estimate-shipping-methods');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods',
headers: {'content-type': 'application/json'},
data: {registryId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"registryId":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}}/async/V1/giftregistry/mine/estimate-shipping-methods',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "registryId": 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 \"registryId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods")
.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/async/V1/giftregistry/mine/estimate-shipping-methods',
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({registryId: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods',
headers: {'content-type': 'application/json'},
body: {registryId: 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}}/async/V1/giftregistry/mine/estimate-shipping-methods');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
registryId: 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}}/async/V1/giftregistry/mine/estimate-shipping-methods',
headers: {'content-type': 'application/json'},
data: {registryId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"registryId":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 = @{ @"registryId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods"]
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}}/async/V1/giftregistry/mine/estimate-shipping-methods" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"registryId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods",
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([
'registryId' => 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}}/async/V1/giftregistry/mine/estimate-shipping-methods', [
'body' => '{
"registryId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'registryId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'registryId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods');
$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}}/async/V1/giftregistry/mine/estimate-shipping-methods' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"registryId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"registryId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"registryId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/giftregistry/mine/estimate-shipping-methods", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods"
payload = { "registryId": 0 }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods"
payload <- "{\n \"registryId\": 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}}/async/V1/giftregistry/mine/estimate-shipping-methods")
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 \"registryId\": 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/async/V1/giftregistry/mine/estimate-shipping-methods') do |req|
req.body = "{\n \"registryId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods";
let payload = json!({"registryId": 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}}/async/V1/giftregistry/mine/estimate-shipping-methods \
--header 'content-type: application/json' \
--data '{
"registryId": 0
}'
echo '{
"registryId": 0
}' | \
http POST {{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "registryId": 0\n}' \
--output-document \
- {{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["registryId": 0] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/giftregistry/mine/estimate-shipping-methods")! 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
guest-carts
{{baseUrl}}/async/V1/guest-carts
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/guest-carts")
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts"
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}}/async/V1/guest-carts"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/async/V1/guest-carts");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts"
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/async/V1/guest-carts HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/guest-carts")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts"))
.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}}/async/V1/guest-carts")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/guest-carts")
.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}}/async/V1/guest-carts');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/async/V1/guest-carts'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts';
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}}/async/V1/guest-carts',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/async/V1/guest-carts',
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}}/async/V1/guest-carts'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/async/V1/guest-carts');
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}}/async/V1/guest-carts'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts';
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}}/async/V1/guest-carts"]
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}}/async/V1/guest-carts" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts",
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}}/async/V1/guest-carts');
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/async/V1/guest-carts');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/async/V1/guest-carts' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/async/V1/guest-carts")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/async/V1/guest-carts")
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/async/V1/guest-carts') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/guest-carts";
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}}/async/V1/guest-carts
http POST {{baseUrl}}/async/V1/guest-carts
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/async/V1/guest-carts
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts")! 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()
PUT
guest-carts-{cartId}
{{baseUrl}}/async/V1/guest-carts/:cartId
QUERY PARAMS
cartId
BODY json
{
"customerId": 0,
"storeId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId");
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 \"customerId\": 0,\n \"storeId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/guest-carts/:cartId" {:content-type :json
:form-params {:customerId 0
:storeId 0}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"customerId\": 0,\n \"storeId\": 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}}/async/V1/guest-carts/:cartId"),
Content = new StringContent("{\n \"customerId\": 0,\n \"storeId\": 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}}/async/V1/guest-carts/:cartId");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"customerId\": 0,\n \"storeId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId"
payload := strings.NewReader("{\n \"customerId\": 0,\n \"storeId\": 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/async/V1/guest-carts/:cartId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 37
{
"customerId": 0,
"storeId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/guest-carts/:cartId")
.setHeader("content-type", "application/json")
.setBody("{\n \"customerId\": 0,\n \"storeId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"customerId\": 0,\n \"storeId\": 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 \"customerId\": 0,\n \"storeId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/guest-carts/:cartId")
.header("content-type", "application/json")
.body("{\n \"customerId\": 0,\n \"storeId\": 0\n}")
.asString();
const data = JSON.stringify({
customerId: 0,
storeId: 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}}/async/V1/guest-carts/:cartId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId',
headers: {'content-type': 'application/json'},
data: {customerId: 0, storeId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"customerId":0,"storeId":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}}/async/V1/guest-carts/:cartId',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "customerId": 0,\n "storeId": 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 \"customerId\": 0,\n \"storeId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId")
.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/async/V1/guest-carts/:cartId',
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({customerId: 0, storeId: 0}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId',
headers: {'content-type': 'application/json'},
body: {customerId: 0, storeId: 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}}/async/V1/guest-carts/:cartId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
customerId: 0,
storeId: 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}}/async/V1/guest-carts/:cartId',
headers: {'content-type': 'application/json'},
data: {customerId: 0, storeId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"customerId":0,"storeId":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 = @{ @"customerId": @0,
@"storeId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId"]
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}}/async/V1/guest-carts/:cartId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"customerId\": 0,\n \"storeId\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId",
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([
'customerId' => 0,
'storeId' => 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}}/async/V1/guest-carts/:cartId', [
'body' => '{
"customerId": 0,
"storeId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'customerId' => 0,
'storeId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'customerId' => 0,
'storeId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId');
$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}}/async/V1/guest-carts/:cartId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"customerId": 0,
"storeId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"customerId": 0,
"storeId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"customerId\": 0,\n \"storeId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/async/V1/guest-carts/:cartId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId"
payload = {
"customerId": 0,
"storeId": 0
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId"
payload <- "{\n \"customerId\": 0,\n \"storeId\": 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}}/async/V1/guest-carts/:cartId")
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 \"customerId\": 0,\n \"storeId\": 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/async/V1/guest-carts/:cartId') do |req|
req.body = "{\n \"customerId\": 0,\n \"storeId\": 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}}/async/V1/guest-carts/:cartId";
let payload = json!({
"customerId": 0,
"storeId": 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}}/async/V1/guest-carts/:cartId \
--header 'content-type: application/json' \
--data '{
"customerId": 0,
"storeId": 0
}'
echo '{
"customerId": 0,
"storeId": 0
}' | \
http PUT {{baseUrl}}/async/V1/guest-carts/:cartId \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "customerId": 0,\n "storeId": 0\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"customerId": 0,
"storeId": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId")! 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
guest-carts-{cartId}-billing-address
{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address
QUERY PARAMS
cartId
BODY json
{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address");
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 \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address" {:content-type :json
:form-params {:address {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}
:useForShipping false}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": 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}}/async/V1/guest-carts/:cartId/billing-address"),
Content = new StringContent("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": 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}}/async/V1/guest-carts/:cartId/billing-address");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address"
payload := strings.NewReader("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": 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/async/V1/guest-carts/:cartId/billing-address HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 935
{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address")
.setHeader("content-type", "application/json")
.setBody("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": 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 \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address")
.header("content-type", "application/json")
.body("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}")
.asString();
const data = JSON.stringify({
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
},
useForShipping: 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}}/async/V1/guest-carts/:cartId/billing-address');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address',
headers: {'content-type': 'application/json'},
data: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
useForShipping: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]},"useForShipping":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}}/async/V1/guest-carts/:cartId/billing-address',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "useForShipping": 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 \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address")
.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/async/V1/guest-carts/:cartId/billing-address',
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: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
useForShipping: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address',
headers: {'content-type': 'application/json'},
body: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
useForShipping: 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}}/async/V1/guest-carts/:cartId/billing-address');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
},
useForShipping: 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}}/async/V1/guest-carts/:cartId/billing-address',
headers: {'content-type': 'application/json'},
data: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
useForShipping: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]},"useForShipping":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 = @{ @"address": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] },
@"useForShipping": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address"]
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}}/async/V1/guest-carts/:cartId/billing-address" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address",
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' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'useForShipping' => 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}}/async/V1/guest-carts/:cartId/billing-address', [
'body' => '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'useForShipping' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'useForShipping' => null
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address');
$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}}/async/V1/guest-carts/:cartId/billing-address' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/guest-carts/:cartId/billing-address", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address"
payload = {
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address"
payload <- "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": 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}}/async/V1/guest-carts/:cartId/billing-address")
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 \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": 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/async/V1/guest-carts/:cartId/billing-address') do |req|
req.body = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address";
let payload = json!({
"address": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"useForShipping": 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}}/async/V1/guest-carts/:cartId/billing-address \
--header 'content-type: application/json' \
--data '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}'
echo '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}' | \
http POST {{baseUrl}}/async/V1/guest-carts/:cartId/billing-address \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "useForShipping": false\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/billing-address
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"address": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
],
"useForShipping": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/billing-address")! 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()
PUT
guest-carts-{cartId}-collect-totals
{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals
QUERY PARAMS
cartId
BODY json
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals");
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals" {:content-type :json
:form-params {:paymentMethod {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}
:shippingCarrierCode ""
:shippingMethodCode ""
:additionalData {:extension_attributes {:gift_messages [{:gift_message_id 0
:customer_id 0
:sender ""
:recipient ""
:message ""
:extension_attributes {:entity_id ""
:entity_type ""
:wrapping_id 0
:wrapping_allow_gift_receipt false
:wrapping_add_printed_card false}}]}
:custom_attributes [{:attribute_code ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\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}}/async/V1/guest-carts/:cartId/collect-totals"),
Content = new StringContent("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/collect-totals");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals"
payload := strings.NewReader("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\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/async/V1/guest-carts/:cartId/collect-totals HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 800
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals")
.setHeader("content-type", "application/json")
.setBody("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals")
.header("content-type", "application/json")
.body("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
shippingCarrierCode: '',
shippingMethodCode: '',
additionalData: {
extension_attributes: {
gift_messages: [
{
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
]
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
shippingCarrierCode: '',
shippingMethodCode: '',
additionalData: {
extension_attributes: {
gift_messages: [
{
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
]
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"shippingCarrierCode":"","shippingMethodCode":"","additionalData":{"extension_attributes":{"gift_messages":[{"gift_message_id":0,"customer_id":0,"sender":"","recipient":"","message":"","extension_attributes":{"entity_id":"","entity_type":"","wrapping_id":0,"wrapping_allow_gift_receipt":false,"wrapping_add_printed_card":false}}]},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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}}/async/V1/guest-carts/:cartId/collect-totals',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "shippingCarrierCode": "",\n "shippingMethodCode": "",\n "additionalData": {\n "extension_attributes": {\n "gift_messages": [\n {\n "gift_message_id": 0,\n "customer_id": 0,\n "sender": "",\n "recipient": "",\n "message": "",\n "extension_attributes": {\n "entity_id": "",\n "entity_type": "",\n "wrapping_id": 0,\n "wrapping_allow_gift_receipt": false,\n "wrapping_add_printed_card": false\n }\n }\n ]\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals")
.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/async/V1/guest-carts/:cartId/collect-totals',
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({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
shippingCarrierCode: '',
shippingMethodCode: '',
additionalData: {
extension_attributes: {
gift_messages: [
{
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
]
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals',
headers: {'content-type': 'application/json'},
body: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
shippingCarrierCode: '',
shippingMethodCode: '',
additionalData: {
extension_attributes: {
gift_messages: [
{
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
]
},
custom_attributes: [{attribute_code: '', value: ''}]
}
},
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}}/async/V1/guest-carts/:cartId/collect-totals');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
shippingCarrierCode: '',
shippingMethodCode: '',
additionalData: {
extension_attributes: {
gift_messages: [
{
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
]
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
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}}/async/V1/guest-carts/:cartId/collect-totals',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
shippingCarrierCode: '',
shippingMethodCode: '',
additionalData: {
extension_attributes: {
gift_messages: [
{
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
]
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"shippingCarrierCode":"","shippingMethodCode":"","additionalData":{"extension_attributes":{"gift_messages":[{"gift_message_id":0,"customer_id":0,"sender":"","recipient":"","message":"","extension_attributes":{"entity_id":"","entity_type":"","wrapping_id":0,"wrapping_allow_gift_receipt":false,"wrapping_add_printed_card":false}}]},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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 = @{ @"paymentMethod": @{ @"po_number": @"", @"method": @"", @"additional_data": @[ ], @"extension_attributes": @{ @"agreement_ids": @[ ] } },
@"shippingCarrierCode": @"",
@"shippingMethodCode": @"",
@"additionalData": @{ @"extension_attributes": @{ @"gift_messages": @[ @{ @"gift_message_id": @0, @"customer_id": @0, @"sender": @"", @"recipient": @"", @"message": @"", @"extension_attributes": @{ @"entity_id": @"", @"entity_type": @"", @"wrapping_id": @0, @"wrapping_allow_gift_receipt": @NO, @"wrapping_add_printed_card": @NO } } ] }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals"]
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}}/async/V1/guest-carts/:cartId/collect-totals" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals",
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([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'shippingCarrierCode' => '',
'shippingMethodCode' => '',
'additionalData' => [
'extension_attributes' => [
'gift_messages' => [
[
'gift_message_id' => 0,
'customer_id' => 0,
'sender' => '',
'recipient' => '',
'message' => '',
'extension_attributes' => [
'entity_id' => '',
'entity_type' => '',
'wrapping_id' => 0,
'wrapping_allow_gift_receipt' => null,
'wrapping_add_printed_card' => null
]
]
]
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]),
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}}/async/V1/guest-carts/:cartId/collect-totals', [
'body' => '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'shippingCarrierCode' => '',
'shippingMethodCode' => '',
'additionalData' => [
'extension_attributes' => [
'gift_messages' => [
[
'gift_message_id' => 0,
'customer_id' => 0,
'sender' => '',
'recipient' => '',
'message' => '',
'extension_attributes' => [
'entity_id' => '',
'entity_type' => '',
'wrapping_id' => 0,
'wrapping_allow_gift_receipt' => null,
'wrapping_add_printed_card' => null
]
]
]
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'shippingCarrierCode' => '',
'shippingMethodCode' => '',
'additionalData' => [
'extension_attributes' => [
'gift_messages' => [
[
'gift_message_id' => 0,
'customer_id' => 0,
'sender' => '',
'recipient' => '',
'message' => '',
'extension_attributes' => [
'entity_id' => '',
'entity_type' => '',
'wrapping_id' => 0,
'wrapping_allow_gift_receipt' => null,
'wrapping_add_printed_card' => null
]
]
]
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals');
$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}}/async/V1/guest-carts/:cartId/collect-totals' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/async/V1/guest-carts/:cartId/collect-totals", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals"
payload = {
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": { "agreement_ids": [] }
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": { "gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": False,
"wrapping_add_printed_card": False
}
}
] },
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals"
payload <- "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\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}}/async/V1/guest-carts/:cartId/collect-totals")
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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.put('/baseUrl/async/V1/guest-carts/:cartId/collect-totals') do |req|
req.body = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"shippingCarrierCode\": \"\",\n \"shippingMethodCode\": \"\",\n \"additionalData\": {\n \"extension_attributes\": {\n \"gift_messages\": [\n {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n ]\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\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}}/async/V1/guest-carts/:cartId/collect-totals";
let payload = json!({
"paymentMethod": json!({
"po_number": "",
"method": "",
"additional_data": (),
"extension_attributes": json!({"agreement_ids": ()})
}),
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": json!({
"extension_attributes": json!({"gift_messages": (
json!({
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": json!({
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
})
})
)}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})
});
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}}/async/V1/guest-carts/:cartId/collect-totals \
--header 'content-type: application/json' \
--data '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
echo '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": {
"extension_attributes": {
"gift_messages": [
{
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
]
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}' | \
http PUT {{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "shippingCarrierCode": "",\n "shippingMethodCode": "",\n "additionalData": {\n "extension_attributes": {\n "gift_messages": [\n {\n "gift_message_id": 0,\n "customer_id": 0,\n "sender": "",\n "recipient": "",\n "message": "",\n "extension_attributes": {\n "entity_id": "",\n "entity_type": "",\n "wrapping_id": 0,\n "wrapping_allow_gift_receipt": false,\n "wrapping_add_printed_card": false\n }\n }\n ]\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"paymentMethod": [
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": ["agreement_ids": []]
],
"shippingCarrierCode": "",
"shippingMethodCode": "",
"additionalData": [
"extension_attributes": ["gift_messages": [
[
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": [
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
]
]
]],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/collect-totals")! 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()
DELETE
guest-carts-{cartId}-coupons
{{baseUrl}}/async/V1/guest-carts/:cartId/coupons
QUERY PARAMS
cartId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons")
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons"
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}}/async/V1/guest-carts/:cartId/coupons"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/async/V1/guest-carts/:cartId/coupons");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons"
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/async/V1/guest-carts/:cartId/coupons HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/coupons"))
.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}}/async/V1/guest-carts/:cartId/coupons")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/async/V1/guest-carts/:cartId/coupons")
.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}}/async/V1/guest-carts/:cartId/coupons');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/coupons'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/coupons';
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}}/async/V1/guest-carts/:cartId/coupons',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/coupons")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/async/V1/guest-carts/:cartId/coupons',
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}}/async/V1/guest-carts/:cartId/coupons'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/async/V1/guest-carts/:cartId/coupons');
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}}/async/V1/guest-carts/:cartId/coupons'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/coupons';
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}}/async/V1/guest-carts/:cartId/coupons"]
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}}/async/V1/guest-carts/:cartId/coupons" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/coupons",
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}}/async/V1/guest-carts/:cartId/coupons');
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/coupons');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/coupons');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/coupons' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/coupons' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/async/V1/guest-carts/:cartId/coupons")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/async/V1/guest-carts/:cartId/coupons")
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/async/V1/guest-carts/:cartId/coupons') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons";
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}}/async/V1/guest-carts/:cartId/coupons
http DELETE {{baseUrl}}/async/V1/guest-carts/:cartId/coupons
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/coupons
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons")! 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()
PUT
guest-carts-{cartId}-coupons-{couponCode}
{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode
QUERY PARAMS
cartId
couponCode
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode")
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode"
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}}/async/V1/guest-carts/:cartId/coupons/:couponCode"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode");
var request = new RestRequest("", Method.Put);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode"
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/async/V1/guest-carts/:cartId/coupons/:couponCode HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode"))
.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}}/async/V1/guest-carts/:cartId/coupons/:couponCode")
.put(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode")
.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}}/async/V1/guest-carts/:cartId/coupons/:couponCode');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode';
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}}/async/V1/guest-carts/:cartId/coupons/:couponCode',
method: 'PUT',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode")
.put(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/async/V1/guest-carts/:cartId/coupons/:couponCode',
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}}/async/V1/guest-carts/:cartId/coupons/:couponCode'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode');
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}}/async/V1/guest-carts/:cartId/coupons/:couponCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode';
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}}/async/V1/guest-carts/:cartId/coupons/:couponCode"]
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}}/async/V1/guest-carts/:cartId/coupons/:couponCode" in
Client.call `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode",
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}}/async/V1/guest-carts/:cartId/coupons/:couponCode');
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode');
$request->setRequestMethod('PUT');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode' -Method PUT
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode' -Method PUT
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("PUT", "/baseUrl/async/V1/guest-carts/:cartId/coupons/:couponCode")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode"
response = requests.put(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode"
response <- VERB("PUT", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode")
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/async/V1/guest-carts/:cartId/coupons/:couponCode') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode";
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}}/async/V1/guest-carts/:cartId/coupons/:couponCode
http PUT {{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode
wget --quiet \
--method PUT \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/coupons/:couponCode")! 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()
POST
guest-carts-{cartId}-estimate-shipping-methods
{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods
QUERY PARAMS
cartId
BODY json
{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods");
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 \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods" {:content-type :json
:form-params {:address {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/estimate-shipping-methods"),
Content = new StringContent("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/estimate-shipping-methods");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods"
payload := strings.NewReader("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/guest-carts/:cartId/estimate-shipping-methods HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 908
{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods")
.setHeader("content-type", "application/json")
.setBody("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods")
.header("content-type", "application/json")
.body("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods',
headers: {'content-type': 'application/json'},
data: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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}}/async/V1/guest-carts/:cartId/estimate-shipping-methods',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\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 \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods")
.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/async/V1/guest-carts/:cartId/estimate-shipping-methods',
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: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods',
headers: {'content-type': 'application/json'},
body: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
},
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}}/async/V1/guest-carts/:cartId/estimate-shipping-methods');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
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}}/async/V1/guest-carts/:cartId/estimate-shipping-methods',
headers: {'content-type': 'application/json'},
data: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods"]
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}}/async/V1/guest-carts/:cartId/estimate-shipping-methods" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods",
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' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]),
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}}/async/V1/guest-carts/:cartId/estimate-shipping-methods', [
'body' => '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods');
$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}}/async/V1/guest-carts/:cartId/estimate-shipping-methods' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/guest-carts/:cartId/estimate-shipping-methods", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods"
payload = { "address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods"
payload <- "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/estimate-shipping-methods")
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 \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/guest-carts/:cartId/estimate-shipping-methods') do |req|
req.body = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/estimate-shipping-methods";
let payload = json!({"address": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})});
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}}/async/V1/guest-carts/:cartId/estimate-shipping-methods \
--header 'content-type: application/json' \
--data '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
echo '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}' | \
http POST {{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["address": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/estimate-shipping-methods")! 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
guest-carts-{cartId}-gift-message
{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message
QUERY PARAMS
cartId
BODY json
{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message");
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 \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message" {:content-type :json
:form-params {:giftMessage {:gift_message_id 0
:customer_id 0
:sender ""
:recipient ""
:message ""
:extension_attributes {:entity_id ""
:entity_type ""
:wrapping_id 0
:wrapping_allow_gift_receipt false
:wrapping_add_printed_card false}}}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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}}/async/V1/guest-carts/:cartId/gift-message"),
Content = new StringContent("{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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}}/async/V1/guest-carts/:cartId/gift-message");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message"
payload := strings.NewReader("{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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/async/V1/guest-carts/:cartId/gift-message HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 325
{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message")
.setHeader("content-type", "application/json")
.setBody("{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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 \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message")
.header("content-type", "application/json")
.body("{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}")
.asString();
const data = JSON.stringify({
giftMessage: {
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: 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}}/async/V1/guest-carts/:cartId/gift-message');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message',
headers: {'content-type': 'application/json'},
data: {
giftMessage: {
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"giftMessage":{"gift_message_id":0,"customer_id":0,"sender":"","recipient":"","message":"","extension_attributes":{"entity_id":"","entity_type":"","wrapping_id":0,"wrapping_allow_gift_receipt":false,"wrapping_add_printed_card":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}}/async/V1/guest-carts/:cartId/gift-message',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "giftMessage": {\n "gift_message_id": 0,\n "customer_id": 0,\n "sender": "",\n "recipient": "",\n "message": "",\n "extension_attributes": {\n "entity_id": "",\n "entity_type": "",\n "wrapping_id": 0,\n "wrapping_allow_gift_receipt": false,\n "wrapping_add_printed_card": false\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 \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message")
.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/async/V1/guest-carts/:cartId/gift-message',
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({
giftMessage: {
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message',
headers: {'content-type': 'application/json'},
body: {
giftMessage: {
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: 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}}/async/V1/guest-carts/:cartId/gift-message');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
giftMessage: {
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: 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}}/async/V1/guest-carts/:cartId/gift-message',
headers: {'content-type': 'application/json'},
data: {
giftMessage: {
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"giftMessage":{"gift_message_id":0,"customer_id":0,"sender":"","recipient":"","message":"","extension_attributes":{"entity_id":"","entity_type":"","wrapping_id":0,"wrapping_allow_gift_receipt":false,"wrapping_add_printed_card":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 = @{ @"giftMessage": @{ @"gift_message_id": @0, @"customer_id": @0, @"sender": @"", @"recipient": @"", @"message": @"", @"extension_attributes": @{ @"entity_id": @"", @"entity_type": @"", @"wrapping_id": @0, @"wrapping_allow_gift_receipt": @NO, @"wrapping_add_printed_card": @NO } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message"]
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}}/async/V1/guest-carts/:cartId/gift-message" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message",
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([
'giftMessage' => [
'gift_message_id' => 0,
'customer_id' => 0,
'sender' => '',
'recipient' => '',
'message' => '',
'extension_attributes' => [
'entity_id' => '',
'entity_type' => '',
'wrapping_id' => 0,
'wrapping_allow_gift_receipt' => null,
'wrapping_add_printed_card' => 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}}/async/V1/guest-carts/:cartId/gift-message', [
'body' => '{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'giftMessage' => [
'gift_message_id' => 0,
'customer_id' => 0,
'sender' => '',
'recipient' => '',
'message' => '',
'extension_attributes' => [
'entity_id' => '',
'entity_type' => '',
'wrapping_id' => 0,
'wrapping_allow_gift_receipt' => null,
'wrapping_add_printed_card' => null
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'giftMessage' => [
'gift_message_id' => 0,
'customer_id' => 0,
'sender' => '',
'recipient' => '',
'message' => '',
'extension_attributes' => [
'entity_id' => '',
'entity_type' => '',
'wrapping_id' => 0,
'wrapping_allow_gift_receipt' => null,
'wrapping_add_printed_card' => null
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message');
$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}}/async/V1/guest-carts/:cartId/gift-message' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/guest-carts/:cartId/gift-message", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message"
payload = { "giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": False,
"wrapping_add_printed_card": False
}
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message"
payload <- "{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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}}/async/V1/guest-carts/:cartId/gift-message")
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 \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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/async/V1/guest-carts/:cartId/gift-message') do |req|
req.body = "{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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}}/async/V1/guest-carts/:cartId/gift-message";
let payload = json!({"giftMessage": json!({
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": json!({
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": 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}}/async/V1/guest-carts/:cartId/gift-message \
--header 'content-type: application/json' \
--data '{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}'
echo '{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}' | \
http POST {{baseUrl}}/async/V1/guest-carts/:cartId/gift-message \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "giftMessage": {\n "gift_message_id": 0,\n "customer_id": 0,\n "sender": "",\n "recipient": "",\n "message": "",\n "extension_attributes": {\n "entity_id": "",\n "entity_type": "",\n "wrapping_id": 0,\n "wrapping_allow_gift_receipt": false,\n "wrapping_add_printed_card": false\n }\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/gift-message
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["giftMessage": [
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": [
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message")! 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
guest-carts-{cartId}-gift-message-{itemId}
{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId
QUERY PARAMS
cartId
itemId
BODY json
{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId");
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 \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId" {:content-type :json
:form-params {:giftMessage {:gift_message_id 0
:customer_id 0
:sender ""
:recipient ""
:message ""
:extension_attributes {:entity_id ""
:entity_type ""
:wrapping_id 0
:wrapping_allow_gift_receipt false
:wrapping_add_printed_card false}}}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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}}/async/V1/guest-carts/:cartId/gift-message/:itemId"),
Content = new StringContent("{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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}}/async/V1/guest-carts/:cartId/gift-message/:itemId");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId"
payload := strings.NewReader("{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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/async/V1/guest-carts/:cartId/gift-message/:itemId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 325
{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId")
.setHeader("content-type", "application/json")
.setBody("{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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 \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId")
.header("content-type", "application/json")
.body("{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}")
.asString();
const data = JSON.stringify({
giftMessage: {
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: 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}}/async/V1/guest-carts/:cartId/gift-message/:itemId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId',
headers: {'content-type': 'application/json'},
data: {
giftMessage: {
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"giftMessage":{"gift_message_id":0,"customer_id":0,"sender":"","recipient":"","message":"","extension_attributes":{"entity_id":"","entity_type":"","wrapping_id":0,"wrapping_allow_gift_receipt":false,"wrapping_add_printed_card":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}}/async/V1/guest-carts/:cartId/gift-message/:itemId',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "giftMessage": {\n "gift_message_id": 0,\n "customer_id": 0,\n "sender": "",\n "recipient": "",\n "message": "",\n "extension_attributes": {\n "entity_id": "",\n "entity_type": "",\n "wrapping_id": 0,\n "wrapping_allow_gift_receipt": false,\n "wrapping_add_printed_card": false\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 \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId")
.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/async/V1/guest-carts/:cartId/gift-message/:itemId',
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({
giftMessage: {
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId',
headers: {'content-type': 'application/json'},
body: {
giftMessage: {
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: 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}}/async/V1/guest-carts/:cartId/gift-message/:itemId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
giftMessage: {
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: 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}}/async/V1/guest-carts/:cartId/gift-message/:itemId',
headers: {'content-type': 'application/json'},
data: {
giftMessage: {
gift_message_id: 0,
customer_id: 0,
sender: '',
recipient: '',
message: '',
extension_attributes: {
entity_id: '',
entity_type: '',
wrapping_id: 0,
wrapping_allow_gift_receipt: false,
wrapping_add_printed_card: false
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"giftMessage":{"gift_message_id":0,"customer_id":0,"sender":"","recipient":"","message":"","extension_attributes":{"entity_id":"","entity_type":"","wrapping_id":0,"wrapping_allow_gift_receipt":false,"wrapping_add_printed_card":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 = @{ @"giftMessage": @{ @"gift_message_id": @0, @"customer_id": @0, @"sender": @"", @"recipient": @"", @"message": @"", @"extension_attributes": @{ @"entity_id": @"", @"entity_type": @"", @"wrapping_id": @0, @"wrapping_allow_gift_receipt": @NO, @"wrapping_add_printed_card": @NO } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId"]
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}}/async/V1/guest-carts/:cartId/gift-message/:itemId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId",
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([
'giftMessage' => [
'gift_message_id' => 0,
'customer_id' => 0,
'sender' => '',
'recipient' => '',
'message' => '',
'extension_attributes' => [
'entity_id' => '',
'entity_type' => '',
'wrapping_id' => 0,
'wrapping_allow_gift_receipt' => null,
'wrapping_add_printed_card' => 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}}/async/V1/guest-carts/:cartId/gift-message/:itemId', [
'body' => '{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'giftMessage' => [
'gift_message_id' => 0,
'customer_id' => 0,
'sender' => '',
'recipient' => '',
'message' => '',
'extension_attributes' => [
'entity_id' => '',
'entity_type' => '',
'wrapping_id' => 0,
'wrapping_allow_gift_receipt' => null,
'wrapping_add_printed_card' => null
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'giftMessage' => [
'gift_message_id' => 0,
'customer_id' => 0,
'sender' => '',
'recipient' => '',
'message' => '',
'extension_attributes' => [
'entity_id' => '',
'entity_type' => '',
'wrapping_id' => 0,
'wrapping_allow_gift_receipt' => null,
'wrapping_add_printed_card' => null
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId');
$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}}/async/V1/guest-carts/:cartId/gift-message/:itemId' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/guest-carts/:cartId/gift-message/:itemId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId"
payload = { "giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": False,
"wrapping_add_printed_card": False
}
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId"
payload <- "{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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}}/async/V1/guest-carts/:cartId/gift-message/:itemId")
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 \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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/async/V1/guest-carts/:cartId/gift-message/:itemId') do |req|
req.body = "{\n \"giftMessage\": {\n \"gift_message_id\": 0,\n \"customer_id\": 0,\n \"sender\": \"\",\n \"recipient\": \"\",\n \"message\": \"\",\n \"extension_attributes\": {\n \"entity_id\": \"\",\n \"entity_type\": \"\",\n \"wrapping_id\": 0,\n \"wrapping_allow_gift_receipt\": false,\n \"wrapping_add_printed_card\": false\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}}/async/V1/guest-carts/:cartId/gift-message/:itemId";
let payload = json!({"giftMessage": json!({
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": json!({
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": 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}}/async/V1/guest-carts/:cartId/gift-message/:itemId \
--header 'content-type: application/json' \
--data '{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}'
echo '{
"giftMessage": {
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": {
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
}
}
}' | \
http POST {{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "giftMessage": {\n "gift_message_id": 0,\n "customer_id": 0,\n "sender": "",\n "recipient": "",\n "message": "",\n "extension_attributes": {\n "entity_id": "",\n "entity_type": "",\n "wrapping_id": 0,\n "wrapping_allow_gift_receipt": false,\n "wrapping_add_printed_card": false\n }\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["giftMessage": [
"gift_message_id": 0,
"customer_id": 0,
"sender": "",
"recipient": "",
"message": "",
"extension_attributes": [
"entity_id": "",
"entity_type": "",
"wrapping_id": 0,
"wrapping_allow_gift_receipt": false,
"wrapping_add_printed_card": false
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/gift-message/:itemId")! 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
guest-carts-{cartId}-items
{{baseUrl}}/async/V1/guest-carts/:cartId/items
QUERY PARAMS
cartId
BODY json
{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/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 \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/guest-carts/:cartId/items" {:content-type :json
:form-params {:cartItem {:item_id 0
:sku ""
:qty ""
:name ""
:price ""
:product_type ""
:quote_id ""
:product_option {:extension_attributes {:custom_options [{:option_id ""
:option_value ""
:extension_attributes {:file_info {:base64_encoded_data ""
:type ""
:name ""}}}]
:bundle_options [{:option_id 0
:option_qty 0
:option_selections []
:extension_attributes {}}]
:configurable_item_options [{:option_id ""
:option_value 0
:extension_attributes {}}]
:downloadable_option {:downloadable_links []}
:giftcard_item_option {:giftcard_amount ""
:custom_giftcard_amount ""
:giftcard_sender_name ""
:giftcard_recipient_name ""
:giftcard_sender_email ""
:giftcard_recipient_email ""
:giftcard_message ""
:extension_attributes {:giftcard_created_codes []}}}}
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:negotiable_quote_item {:item_id 0
:original_price ""
:original_tax_amount ""
:original_discount_amount ""
:extension_attributes {}}}}}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/items"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\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}}/async/V1/guest-carts/:cartId/items"),
Content = new StringContent("{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\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}}/async/V1/guest-carts/:cartId/items");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/items"
payload := strings.NewReader("{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\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/async/V1/guest-carts/:cartId/items HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1899
{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/guest-carts/:cartId/items")
.setHeader("content-type", "application/json")
.setBody("{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/items"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\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 \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/items")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/guest-carts/:cartId/items")
.header("content-type", "application/json")
.body("{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}")
.asString();
const data = JSON.stringify({
cartItem: {
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {
file_info: {
base64_encoded_data: '',
type: '',
name: ''
}
}
}
],
bundle_options: [
{
option_id: 0,
option_qty: 0,
option_selections: [],
extension_attributes: {}
}
],
configurable_item_options: [
{
option_id: '',
option_value: 0,
extension_attributes: {}
}
],
downloadable_option: {
downloadable_links: []
},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {
giftcard_created_codes: []
}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/guest-carts/:cartId/items');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/items',
headers: {'content-type': 'application/json'},
data: {
cartItem: {
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {file_info: {base64_encoded_data: '', type: '', name: ''}}
}
],
bundle_options: [{option_id: 0, option_qty: 0, option_selections: [], extension_attributes: {}}],
configurable_item_options: [{option_id: '', option_value: 0, extension_attributes: {}}],
downloadable_option: {downloadable_links: []},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {giftcard_created_codes: []}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/items';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cartItem":{"item_id":0,"sku":"","qty":"","name":"","price":"","product_type":"","quote_id":"","product_option":{"extension_attributes":{"custom_options":[{"option_id":"","option_value":"","extension_attributes":{"file_info":{"base64_encoded_data":"","type":"","name":""}}}],"bundle_options":[{"option_id":0,"option_qty":0,"option_selections":[],"extension_attributes":{}}],"configurable_item_options":[{"option_id":"","option_value":0,"extension_attributes":{}}],"downloadable_option":{"downloadable_links":[]},"giftcard_item_option":{"giftcard_amount":"","custom_giftcard_amount":"","giftcard_sender_name":"","giftcard_recipient_name":"","giftcard_sender_email":"","giftcard_recipient_email":"","giftcard_message":"","extension_attributes":{"giftcard_created_codes":[]}}}},"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"negotiable_quote_item":{"item_id":0,"original_price":"","original_tax_amount":"","original_discount_amount":"","extension_attributes":{}}}}}'
};
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}}/async/V1/guest-carts/:cartId/items',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cartItem": {\n "item_id": 0,\n "sku": "",\n "qty": "",\n "name": "",\n "price": "",\n "product_type": "",\n "quote_id": "",\n "product_option": {\n "extension_attributes": {\n "custom_options": [\n {\n "option_id": "",\n "option_value": "",\n "extension_attributes": {\n "file_info": {\n "base64_encoded_data": "",\n "type": "",\n "name": ""\n }\n }\n }\n ],\n "bundle_options": [\n {\n "option_id": 0,\n "option_qty": 0,\n "option_selections": [],\n "extension_attributes": {}\n }\n ],\n "configurable_item_options": [\n {\n "option_id": "",\n "option_value": 0,\n "extension_attributes": {}\n }\n ],\n "downloadable_option": {\n "downloadable_links": []\n },\n "giftcard_item_option": {\n "giftcard_amount": "",\n "custom_giftcard_amount": "",\n "giftcard_sender_name": "",\n "giftcard_recipient_name": "",\n "giftcard_sender_email": "",\n "giftcard_recipient_email": "",\n "giftcard_message": "",\n "extension_attributes": {\n "giftcard_created_codes": []\n }\n }\n }\n },\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "negotiable_quote_item": {\n "item_id": 0,\n "original_price": "",\n "original_tax_amount": "",\n "original_discount_amount": "",\n "extension_attributes": {}\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 \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/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/async/V1/guest-carts/:cartId/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({
cartItem: {
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {file_info: {base64_encoded_data: '', type: '', name: ''}}
}
],
bundle_options: [{option_id: 0, option_qty: 0, option_selections: [], extension_attributes: {}}],
configurable_item_options: [{option_id: '', option_value: 0, extension_attributes: {}}],
downloadable_option: {downloadable_links: []},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {giftcard_created_codes: []}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/items',
headers: {'content-type': 'application/json'},
body: {
cartItem: {
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {file_info: {base64_encoded_data: '', type: '', name: ''}}
}
],
bundle_options: [{option_id: 0, option_qty: 0, option_selections: [], extension_attributes: {}}],
configurable_item_options: [{option_id: '', option_value: 0, extension_attributes: {}}],
downloadable_option: {downloadable_links: []},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {giftcard_created_codes: []}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
},
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}}/async/V1/guest-carts/:cartId/items');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cartItem: {
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {
file_info: {
base64_encoded_data: '',
type: '',
name: ''
}
}
}
],
bundle_options: [
{
option_id: 0,
option_qty: 0,
option_selections: [],
extension_attributes: {}
}
],
configurable_item_options: [
{
option_id: '',
option_value: 0,
extension_attributes: {}
}
],
downloadable_option: {
downloadable_links: []
},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {
giftcard_created_codes: []
}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
});
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}}/async/V1/guest-carts/:cartId/items',
headers: {'content-type': 'application/json'},
data: {
cartItem: {
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {file_info: {base64_encoded_data: '', type: '', name: ''}}
}
],
bundle_options: [{option_id: 0, option_qty: 0, option_selections: [], extension_attributes: {}}],
configurable_item_options: [{option_id: '', option_value: 0, extension_attributes: {}}],
downloadable_option: {downloadable_links: []},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {giftcard_created_codes: []}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/items';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"cartItem":{"item_id":0,"sku":"","qty":"","name":"","price":"","product_type":"","quote_id":"","product_option":{"extension_attributes":{"custom_options":[{"option_id":"","option_value":"","extension_attributes":{"file_info":{"base64_encoded_data":"","type":"","name":""}}}],"bundle_options":[{"option_id":0,"option_qty":0,"option_selections":[],"extension_attributes":{}}],"configurable_item_options":[{"option_id":"","option_value":0,"extension_attributes":{}}],"downloadable_option":{"downloadable_links":[]},"giftcard_item_option":{"giftcard_amount":"","custom_giftcard_amount":"","giftcard_sender_name":"","giftcard_recipient_name":"","giftcard_sender_email":"","giftcard_recipient_email":"","giftcard_message":"","extension_attributes":{"giftcard_created_codes":[]}}}},"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"negotiable_quote_item":{"item_id":0,"original_price":"","original_tax_amount":"","original_discount_amount":"","extension_attributes":{}}}}}'
};
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 = @{ @"cartItem": @{ @"item_id": @0, @"sku": @"", @"qty": @"", @"name": @"", @"price": @"", @"product_type": @"", @"quote_id": @"", @"product_option": @{ @"extension_attributes": @{ @"custom_options": @[ @{ @"option_id": @"", @"option_value": @"", @"extension_attributes": @{ @"file_info": @{ @"base64_encoded_data": @"", @"type": @"", @"name": @"" } } } ], @"bundle_options": @[ @{ @"option_id": @0, @"option_qty": @0, @"option_selections": @[ ], @"extension_attributes": @{ } } ], @"configurable_item_options": @[ @{ @"option_id": @"", @"option_value": @0, @"extension_attributes": @{ } } ], @"downloadable_option": @{ @"downloadable_links": @[ ] }, @"giftcard_item_option": @{ @"giftcard_amount": @"", @"custom_giftcard_amount": @"", @"giftcard_sender_name": @"", @"giftcard_recipient_name": @"", @"giftcard_sender_email": @"", @"giftcard_recipient_email": @"", @"giftcard_message": @"", @"extension_attributes": @{ @"giftcard_created_codes": @[ ] } } } }, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"negotiable_quote_item": @{ @"item_id": @0, @"original_price": @"", @"original_tax_amount": @"", @"original_discount_amount": @"", @"extension_attributes": @{ } } } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/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}}/async/V1/guest-carts/:cartId/items" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/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([
'cartItem' => [
'item_id' => 0,
'sku' => '',
'qty' => '',
'name' => '',
'price' => '',
'product_type' => '',
'quote_id' => '',
'product_option' => [
'extension_attributes' => [
'custom_options' => [
[
'option_id' => '',
'option_value' => '',
'extension_attributes' => [
'file_info' => [
'base64_encoded_data' => '',
'type' => '',
'name' => ''
]
]
]
],
'bundle_options' => [
[
'option_id' => 0,
'option_qty' => 0,
'option_selections' => [
],
'extension_attributes' => [
]
]
],
'configurable_item_options' => [
[
'option_id' => '',
'option_value' => 0,
'extension_attributes' => [
]
]
],
'downloadable_option' => [
'downloadable_links' => [
]
],
'giftcard_item_option' => [
'giftcard_amount' => '',
'custom_giftcard_amount' => '',
'giftcard_sender_name' => '',
'giftcard_recipient_name' => '',
'giftcard_sender_email' => '',
'giftcard_recipient_email' => '',
'giftcard_message' => '',
'extension_attributes' => [
'giftcard_created_codes' => [
]
]
]
]
],
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
]),
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}}/async/V1/guest-carts/:cartId/items', [
'body' => '{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/items');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cartItem' => [
'item_id' => 0,
'sku' => '',
'qty' => '',
'name' => '',
'price' => '',
'product_type' => '',
'quote_id' => '',
'product_option' => [
'extension_attributes' => [
'custom_options' => [
[
'option_id' => '',
'option_value' => '',
'extension_attributes' => [
'file_info' => [
'base64_encoded_data' => '',
'type' => '',
'name' => ''
]
]
]
],
'bundle_options' => [
[
'option_id' => 0,
'option_qty' => 0,
'option_selections' => [
],
'extension_attributes' => [
]
]
],
'configurable_item_options' => [
[
'option_id' => '',
'option_value' => 0,
'extension_attributes' => [
]
]
],
'downloadable_option' => [
'downloadable_links' => [
]
],
'giftcard_item_option' => [
'giftcard_amount' => '',
'custom_giftcard_amount' => '',
'giftcard_sender_name' => '',
'giftcard_recipient_name' => '',
'giftcard_sender_email' => '',
'giftcard_recipient_email' => '',
'giftcard_message' => '',
'extension_attributes' => [
'giftcard_created_codes' => [
]
]
]
]
],
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cartItem' => [
'item_id' => 0,
'sku' => '',
'qty' => '',
'name' => '',
'price' => '',
'product_type' => '',
'quote_id' => '',
'product_option' => [
'extension_attributes' => [
'custom_options' => [
[
'option_id' => '',
'option_value' => '',
'extension_attributes' => [
'file_info' => [
'base64_encoded_data' => '',
'type' => '',
'name' => ''
]
]
]
],
'bundle_options' => [
[
'option_id' => 0,
'option_qty' => 0,
'option_selections' => [
],
'extension_attributes' => [
]
]
],
'configurable_item_options' => [
[
'option_id' => '',
'option_value' => 0,
'extension_attributes' => [
]
]
],
'downloadable_option' => [
'downloadable_links' => [
]
],
'giftcard_item_option' => [
'giftcard_amount' => '',
'custom_giftcard_amount' => '',
'giftcard_sender_name' => '',
'giftcard_recipient_name' => '',
'giftcard_sender_email' => '',
'giftcard_recipient_email' => '',
'giftcard_message' => '',
'extension_attributes' => [
'giftcard_created_codes' => [
]
]
]
]
],
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/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}}/async/V1/guest-carts/:cartId/items' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/items' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/guest-carts/:cartId/items", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/items"
payload = { "cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": { "extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": { "file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
} }
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": { "downloadable_links": [] },
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": { "giftcard_created_codes": [] }
}
} },
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/items"
payload <- "{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\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}}/async/V1/guest-carts/:cartId/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 \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\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/async/V1/guest-carts/:cartId/items') do |req|
req.body = "{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\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}}/async/V1/guest-carts/:cartId/items";
let payload = json!({"cartItem": json!({
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": json!({"extension_attributes": json!({
"custom_options": (
json!({
"option_id": "",
"option_value": "",
"extension_attributes": json!({"file_info": json!({
"base64_encoded_data": "",
"type": "",
"name": ""
})})
})
),
"bundle_options": (
json!({
"option_id": 0,
"option_qty": 0,
"option_selections": (),
"extension_attributes": json!({})
})
),
"configurable_item_options": (
json!({
"option_id": "",
"option_value": 0,
"extension_attributes": json!({})
})
),
"downloadable_option": json!({"downloadable_links": ()}),
"giftcard_item_option": json!({
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": json!({"giftcard_created_codes": ()})
})
})}),
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"negotiable_quote_item": json!({
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": 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}}/async/V1/guest-carts/:cartId/items \
--header 'content-type: application/json' \
--data '{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}'
echo '{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}' | \
http POST {{baseUrl}}/async/V1/guest-carts/:cartId/items \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "cartItem": {\n "item_id": 0,\n "sku": "",\n "qty": "",\n "name": "",\n "price": "",\n "product_type": "",\n "quote_id": "",\n "product_option": {\n "extension_attributes": {\n "custom_options": [\n {\n "option_id": "",\n "option_value": "",\n "extension_attributes": {\n "file_info": {\n "base64_encoded_data": "",\n "type": "",\n "name": ""\n }\n }\n }\n ],\n "bundle_options": [\n {\n "option_id": 0,\n "option_qty": 0,\n "option_selections": [],\n "extension_attributes": {}\n }\n ],\n "configurable_item_options": [\n {\n "option_id": "",\n "option_value": 0,\n "extension_attributes": {}\n }\n ],\n "downloadable_option": {\n "downloadable_links": []\n },\n "giftcard_item_option": {\n "giftcard_amount": "",\n "custom_giftcard_amount": "",\n "giftcard_sender_name": "",\n "giftcard_recipient_name": "",\n "giftcard_sender_email": "",\n "giftcard_recipient_email": "",\n "giftcard_message": "",\n "extension_attributes": {\n "giftcard_created_codes": []\n }\n }\n }\n },\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "negotiable_quote_item": {\n "item_id": 0,\n "original_price": "",\n "original_tax_amount": "",\n "original_discount_amount": "",\n "extension_attributes": {}\n }\n }\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/items
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["cartItem": [
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": ["extension_attributes": [
"custom_options": [
[
"option_id": "",
"option_value": "",
"extension_attributes": ["file_info": [
"base64_encoded_data": "",
"type": "",
"name": ""
]]
]
],
"bundle_options": [
[
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": []
]
],
"configurable_item_options": [
[
"option_id": "",
"option_value": 0,
"extension_attributes": []
]
],
"downloadable_option": ["downloadable_links": []],
"giftcard_item_option": [
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": ["giftcard_created_codes": []]
]
]],
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"negotiable_quote_item": [
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": []
]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/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()
DELETE
guest-carts-{cartId}-items-{itemId} (DELETE)
{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId
QUERY PARAMS
cartId
itemId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId")
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId"
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}}/async/V1/guest-carts/:cartId/items/:itemId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId"
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/async/V1/guest-carts/:cartId/items/:itemId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId"))
.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}}/async/V1/guest-carts/:cartId/items/:itemId")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId")
.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}}/async/V1/guest-carts/:cartId/items/:itemId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId';
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}}/async/V1/guest-carts/:cartId/items/:itemId',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/async/V1/guest-carts/:cartId/items/:itemId',
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}}/async/V1/guest-carts/:cartId/items/:itemId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId');
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}}/async/V1/guest-carts/:cartId/items/:itemId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId';
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}}/async/V1/guest-carts/:cartId/items/:itemId"]
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}}/async/V1/guest-carts/:cartId/items/:itemId" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId",
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}}/async/V1/guest-carts/:cartId/items/:itemId');
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/async/V1/guest-carts/:cartId/items/:itemId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId")
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/async/V1/guest-carts/:cartId/items/:itemId') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId";
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}}/async/V1/guest-carts/:cartId/items/:itemId
http DELETE {{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId")! 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()
PUT
guest-carts-{cartId}-items-{itemId}
{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId
QUERY PARAMS
cartId
itemId
BODY json
{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId");
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 \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId" {:content-type :json
:form-params {:cartItem {:item_id 0
:sku ""
:qty ""
:name ""
:price ""
:product_type ""
:quote_id ""
:product_option {:extension_attributes {:custom_options [{:option_id ""
:option_value ""
:extension_attributes {:file_info {:base64_encoded_data ""
:type ""
:name ""}}}]
:bundle_options [{:option_id 0
:option_qty 0
:option_selections []
:extension_attributes {}}]
:configurable_item_options [{:option_id ""
:option_value 0
:extension_attributes {}}]
:downloadable_option {:downloadable_links []}
:giftcard_item_option {:giftcard_amount ""
:custom_giftcard_amount ""
:giftcard_sender_name ""
:giftcard_recipient_name ""
:giftcard_sender_email ""
:giftcard_recipient_email ""
:giftcard_message ""
:extension_attributes {:giftcard_created_codes []}}}}
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:negotiable_quote_item {:item_id 0
:original_price ""
:original_tax_amount ""
:original_discount_amount ""
:extension_attributes {}}}}}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\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}}/async/V1/guest-carts/:cartId/items/:itemId"),
Content = new StringContent("{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\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}}/async/V1/guest-carts/:cartId/items/:itemId");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId"
payload := strings.NewReader("{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\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/async/V1/guest-carts/:cartId/items/:itemId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1899
{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId")
.setHeader("content-type", "application/json")
.setBody("{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\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 \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId")
.header("content-type", "application/json")
.body("{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}")
.asString();
const data = JSON.stringify({
cartItem: {
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {
file_info: {
base64_encoded_data: '',
type: '',
name: ''
}
}
}
],
bundle_options: [
{
option_id: 0,
option_qty: 0,
option_selections: [],
extension_attributes: {}
}
],
configurable_item_options: [
{
option_id: '',
option_value: 0,
extension_attributes: {}
}
],
downloadable_option: {
downloadable_links: []
},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {
giftcard_created_codes: []
}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId',
headers: {'content-type': 'application/json'},
data: {
cartItem: {
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {file_info: {base64_encoded_data: '', type: '', name: ''}}
}
],
bundle_options: [{option_id: 0, option_qty: 0, option_selections: [], extension_attributes: {}}],
configurable_item_options: [{option_id: '', option_value: 0, extension_attributes: {}}],
downloadable_option: {downloadable_links: []},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {giftcard_created_codes: []}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cartItem":{"item_id":0,"sku":"","qty":"","name":"","price":"","product_type":"","quote_id":"","product_option":{"extension_attributes":{"custom_options":[{"option_id":"","option_value":"","extension_attributes":{"file_info":{"base64_encoded_data":"","type":"","name":""}}}],"bundle_options":[{"option_id":0,"option_qty":0,"option_selections":[],"extension_attributes":{}}],"configurable_item_options":[{"option_id":"","option_value":0,"extension_attributes":{}}],"downloadable_option":{"downloadable_links":[]},"giftcard_item_option":{"giftcard_amount":"","custom_giftcard_amount":"","giftcard_sender_name":"","giftcard_recipient_name":"","giftcard_sender_email":"","giftcard_recipient_email":"","giftcard_message":"","extension_attributes":{"giftcard_created_codes":[]}}}},"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"negotiable_quote_item":{"item_id":0,"original_price":"","original_tax_amount":"","original_discount_amount":"","extension_attributes":{}}}}}'
};
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}}/async/V1/guest-carts/:cartId/items/:itemId',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "cartItem": {\n "item_id": 0,\n "sku": "",\n "qty": "",\n "name": "",\n "price": "",\n "product_type": "",\n "quote_id": "",\n "product_option": {\n "extension_attributes": {\n "custom_options": [\n {\n "option_id": "",\n "option_value": "",\n "extension_attributes": {\n "file_info": {\n "base64_encoded_data": "",\n "type": "",\n "name": ""\n }\n }\n }\n ],\n "bundle_options": [\n {\n "option_id": 0,\n "option_qty": 0,\n "option_selections": [],\n "extension_attributes": {}\n }\n ],\n "configurable_item_options": [\n {\n "option_id": "",\n "option_value": 0,\n "extension_attributes": {}\n }\n ],\n "downloadable_option": {\n "downloadable_links": []\n },\n "giftcard_item_option": {\n "giftcard_amount": "",\n "custom_giftcard_amount": "",\n "giftcard_sender_name": "",\n "giftcard_recipient_name": "",\n "giftcard_sender_email": "",\n "giftcard_recipient_email": "",\n "giftcard_message": "",\n "extension_attributes": {\n "giftcard_created_codes": []\n }\n }\n }\n },\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "negotiable_quote_item": {\n "item_id": 0,\n "original_price": "",\n "original_tax_amount": "",\n "original_discount_amount": "",\n "extension_attributes": {}\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 \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId")
.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/async/V1/guest-carts/:cartId/items/:itemId',
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({
cartItem: {
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {file_info: {base64_encoded_data: '', type: '', name: ''}}
}
],
bundle_options: [{option_id: 0, option_qty: 0, option_selections: [], extension_attributes: {}}],
configurable_item_options: [{option_id: '', option_value: 0, extension_attributes: {}}],
downloadable_option: {downloadable_links: []},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {giftcard_created_codes: []}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId',
headers: {'content-type': 'application/json'},
body: {
cartItem: {
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {file_info: {base64_encoded_data: '', type: '', name: ''}}
}
],
bundle_options: [{option_id: 0, option_qty: 0, option_selections: [], extension_attributes: {}}],
configurable_item_options: [{option_id: '', option_value: 0, extension_attributes: {}}],
downloadable_option: {downloadable_links: []},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {giftcard_created_codes: []}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
},
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}}/async/V1/guest-carts/:cartId/items/:itemId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
cartItem: {
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {
file_info: {
base64_encoded_data: '',
type: '',
name: ''
}
}
}
],
bundle_options: [
{
option_id: 0,
option_qty: 0,
option_selections: [],
extension_attributes: {}
}
],
configurable_item_options: [
{
option_id: '',
option_value: 0,
extension_attributes: {}
}
],
downloadable_option: {
downloadable_links: []
},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {
giftcard_created_codes: []
}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
});
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}}/async/V1/guest-carts/:cartId/items/:itemId',
headers: {'content-type': 'application/json'},
data: {
cartItem: {
item_id: 0,
sku: '',
qty: '',
name: '',
price: '',
product_type: '',
quote_id: '',
product_option: {
extension_attributes: {
custom_options: [
{
option_id: '',
option_value: '',
extension_attributes: {file_info: {base64_encoded_data: '', type: '', name: ''}}
}
],
bundle_options: [{option_id: 0, option_qty: 0, option_selections: [], extension_attributes: {}}],
configurable_item_options: [{option_id: '', option_value: 0, extension_attributes: {}}],
downloadable_option: {downloadable_links: []},
giftcard_item_option: {
giftcard_amount: '',
custom_giftcard_amount: '',
giftcard_sender_name: '',
giftcard_recipient_name: '',
giftcard_sender_email: '',
giftcard_recipient_email: '',
giftcard_message: '',
extension_attributes: {giftcard_created_codes: []}
}
}
},
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
negotiable_quote_item: {
item_id: 0,
original_price: '',
original_tax_amount: '',
original_discount_amount: '',
extension_attributes: {}
}
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"cartItem":{"item_id":0,"sku":"","qty":"","name":"","price":"","product_type":"","quote_id":"","product_option":{"extension_attributes":{"custom_options":[{"option_id":"","option_value":"","extension_attributes":{"file_info":{"base64_encoded_data":"","type":"","name":""}}}],"bundle_options":[{"option_id":0,"option_qty":0,"option_selections":[],"extension_attributes":{}}],"configurable_item_options":[{"option_id":"","option_value":0,"extension_attributes":{}}],"downloadable_option":{"downloadable_links":[]},"giftcard_item_option":{"giftcard_amount":"","custom_giftcard_amount":"","giftcard_sender_name":"","giftcard_recipient_name":"","giftcard_sender_email":"","giftcard_recipient_email":"","giftcard_message":"","extension_attributes":{"giftcard_created_codes":[]}}}},"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"negotiable_quote_item":{"item_id":0,"original_price":"","original_tax_amount":"","original_discount_amount":"","extension_attributes":{}}}}}'
};
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 = @{ @"cartItem": @{ @"item_id": @0, @"sku": @"", @"qty": @"", @"name": @"", @"price": @"", @"product_type": @"", @"quote_id": @"", @"product_option": @{ @"extension_attributes": @{ @"custom_options": @[ @{ @"option_id": @"", @"option_value": @"", @"extension_attributes": @{ @"file_info": @{ @"base64_encoded_data": @"", @"type": @"", @"name": @"" } } } ], @"bundle_options": @[ @{ @"option_id": @0, @"option_qty": @0, @"option_selections": @[ ], @"extension_attributes": @{ } } ], @"configurable_item_options": @[ @{ @"option_id": @"", @"option_value": @0, @"extension_attributes": @{ } } ], @"downloadable_option": @{ @"downloadable_links": @[ ] }, @"giftcard_item_option": @{ @"giftcard_amount": @"", @"custom_giftcard_amount": @"", @"giftcard_sender_name": @"", @"giftcard_recipient_name": @"", @"giftcard_sender_email": @"", @"giftcard_recipient_email": @"", @"giftcard_message": @"", @"extension_attributes": @{ @"giftcard_created_codes": @[ ] } } } }, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"negotiable_quote_item": @{ @"item_id": @0, @"original_price": @"", @"original_tax_amount": @"", @"original_discount_amount": @"", @"extension_attributes": @{ } } } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId"]
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}}/async/V1/guest-carts/:cartId/items/:itemId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId",
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([
'cartItem' => [
'item_id' => 0,
'sku' => '',
'qty' => '',
'name' => '',
'price' => '',
'product_type' => '',
'quote_id' => '',
'product_option' => [
'extension_attributes' => [
'custom_options' => [
[
'option_id' => '',
'option_value' => '',
'extension_attributes' => [
'file_info' => [
'base64_encoded_data' => '',
'type' => '',
'name' => ''
]
]
]
],
'bundle_options' => [
[
'option_id' => 0,
'option_qty' => 0,
'option_selections' => [
],
'extension_attributes' => [
]
]
],
'configurable_item_options' => [
[
'option_id' => '',
'option_value' => 0,
'extension_attributes' => [
]
]
],
'downloadable_option' => [
'downloadable_links' => [
]
],
'giftcard_item_option' => [
'giftcard_amount' => '',
'custom_giftcard_amount' => '',
'giftcard_sender_name' => '',
'giftcard_recipient_name' => '',
'giftcard_sender_email' => '',
'giftcard_recipient_email' => '',
'giftcard_message' => '',
'extension_attributes' => [
'giftcard_created_codes' => [
]
]
]
]
],
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
]),
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}}/async/V1/guest-carts/:cartId/items/:itemId', [
'body' => '{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'cartItem' => [
'item_id' => 0,
'sku' => '',
'qty' => '',
'name' => '',
'price' => '',
'product_type' => '',
'quote_id' => '',
'product_option' => [
'extension_attributes' => [
'custom_options' => [
[
'option_id' => '',
'option_value' => '',
'extension_attributes' => [
'file_info' => [
'base64_encoded_data' => '',
'type' => '',
'name' => ''
]
]
]
],
'bundle_options' => [
[
'option_id' => 0,
'option_qty' => 0,
'option_selections' => [
],
'extension_attributes' => [
]
]
],
'configurable_item_options' => [
[
'option_id' => '',
'option_value' => 0,
'extension_attributes' => [
]
]
],
'downloadable_option' => [
'downloadable_links' => [
]
],
'giftcard_item_option' => [
'giftcard_amount' => '',
'custom_giftcard_amount' => '',
'giftcard_sender_name' => '',
'giftcard_recipient_name' => '',
'giftcard_sender_email' => '',
'giftcard_recipient_email' => '',
'giftcard_message' => '',
'extension_attributes' => [
'giftcard_created_codes' => [
]
]
]
]
],
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'cartItem' => [
'item_id' => 0,
'sku' => '',
'qty' => '',
'name' => '',
'price' => '',
'product_type' => '',
'quote_id' => '',
'product_option' => [
'extension_attributes' => [
'custom_options' => [
[
'option_id' => '',
'option_value' => '',
'extension_attributes' => [
'file_info' => [
'base64_encoded_data' => '',
'type' => '',
'name' => ''
]
]
]
],
'bundle_options' => [
[
'option_id' => 0,
'option_qty' => 0,
'option_selections' => [
],
'extension_attributes' => [
]
]
],
'configurable_item_options' => [
[
'option_id' => '',
'option_value' => 0,
'extension_attributes' => [
]
]
],
'downloadable_option' => [
'downloadable_links' => [
]
],
'giftcard_item_option' => [
'giftcard_amount' => '',
'custom_giftcard_amount' => '',
'giftcard_sender_name' => '',
'giftcard_recipient_name' => '',
'giftcard_sender_email' => '',
'giftcard_recipient_email' => '',
'giftcard_message' => '',
'extension_attributes' => [
'giftcard_created_codes' => [
]
]
]
]
],
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId');
$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}}/async/V1/guest-carts/:cartId/items/:itemId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/async/V1/guest-carts/:cartId/items/:itemId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId"
payload = { "cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": { "extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": { "file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
} }
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": { "downloadable_links": [] },
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": { "giftcard_created_codes": [] }
}
} },
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId"
payload <- "{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\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}}/async/V1/guest-carts/:cartId/items/:itemId")
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 \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\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.put('/baseUrl/async/V1/guest-carts/:cartId/items/:itemId') do |req|
req.body = "{\n \"cartItem\": {\n \"item_id\": 0,\n \"sku\": \"\",\n \"qty\": \"\",\n \"name\": \"\",\n \"price\": \"\",\n \"product_type\": \"\",\n \"quote_id\": \"\",\n \"product_option\": {\n \"extension_attributes\": {\n \"custom_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": \"\",\n \"extension_attributes\": {\n \"file_info\": {\n \"base64_encoded_data\": \"\",\n \"type\": \"\",\n \"name\": \"\"\n }\n }\n }\n ],\n \"bundle_options\": [\n {\n \"option_id\": 0,\n \"option_qty\": 0,\n \"option_selections\": [],\n \"extension_attributes\": {}\n }\n ],\n \"configurable_item_options\": [\n {\n \"option_id\": \"\",\n \"option_value\": 0,\n \"extension_attributes\": {}\n }\n ],\n \"downloadable_option\": {\n \"downloadable_links\": []\n },\n \"giftcard_item_option\": {\n \"giftcard_amount\": \"\",\n \"custom_giftcard_amount\": \"\",\n \"giftcard_sender_name\": \"\",\n \"giftcard_recipient_name\": \"\",\n \"giftcard_sender_email\": \"\",\n \"giftcard_recipient_email\": \"\",\n \"giftcard_message\": \"\",\n \"extension_attributes\": {\n \"giftcard_created_codes\": []\n }\n }\n }\n },\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"negotiable_quote_item\": {\n \"item_id\": 0,\n \"original_price\": \"\",\n \"original_tax_amount\": \"\",\n \"original_discount_amount\": \"\",\n \"extension_attributes\": {}\n }\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}}/async/V1/guest-carts/:cartId/items/:itemId";
let payload = json!({"cartItem": json!({
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": json!({"extension_attributes": json!({
"custom_options": (
json!({
"option_id": "",
"option_value": "",
"extension_attributes": json!({"file_info": json!({
"base64_encoded_data": "",
"type": "",
"name": ""
})})
})
),
"bundle_options": (
json!({
"option_id": 0,
"option_qty": 0,
"option_selections": (),
"extension_attributes": json!({})
})
),
"configurable_item_options": (
json!({
"option_id": "",
"option_value": 0,
"extension_attributes": json!({})
})
),
"downloadable_option": json!({"downloadable_links": ()}),
"giftcard_item_option": json!({
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": json!({"giftcard_created_codes": ()})
})
})}),
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"negotiable_quote_item": json!({
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": json!({})
})
})
})});
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}}/async/V1/guest-carts/:cartId/items/:itemId \
--header 'content-type: application/json' \
--data '{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}'
echo '{
"cartItem": {
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": "",
"option_value": "",
"extension_attributes": {
"file_info": {
"base64_encoded_data": "",
"type": "",
"name": ""
}
}
}
],
"bundle_options": [
{
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": {}
}
],
"configurable_item_options": [
{
"option_id": "",
"option_value": 0,
"extension_attributes": {}
}
],
"downloadable_option": {
"downloadable_links": []
},
"giftcard_item_option": {
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": {
"giftcard_created_codes": []
}
}
}
},
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}' | \
http PUT {{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "cartItem": {\n "item_id": 0,\n "sku": "",\n "qty": "",\n "name": "",\n "price": "",\n "product_type": "",\n "quote_id": "",\n "product_option": {\n "extension_attributes": {\n "custom_options": [\n {\n "option_id": "",\n "option_value": "",\n "extension_attributes": {\n "file_info": {\n "base64_encoded_data": "",\n "type": "",\n "name": ""\n }\n }\n }\n ],\n "bundle_options": [\n {\n "option_id": 0,\n "option_qty": 0,\n "option_selections": [],\n "extension_attributes": {}\n }\n ],\n "configurable_item_options": [\n {\n "option_id": "",\n "option_value": 0,\n "extension_attributes": {}\n }\n ],\n "downloadable_option": {\n "downloadable_links": []\n },\n "giftcard_item_option": {\n "giftcard_amount": "",\n "custom_giftcard_amount": "",\n "giftcard_sender_name": "",\n "giftcard_recipient_name": "",\n "giftcard_sender_email": "",\n "giftcard_recipient_email": "",\n "giftcard_message": "",\n "extension_attributes": {\n "giftcard_created_codes": []\n }\n }\n }\n },\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "negotiable_quote_item": {\n "item_id": 0,\n "original_price": "",\n "original_tax_amount": "",\n "original_discount_amount": "",\n "extension_attributes": {}\n }\n }\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["cartItem": [
"item_id": 0,
"sku": "",
"qty": "",
"name": "",
"price": "",
"product_type": "",
"quote_id": "",
"product_option": ["extension_attributes": [
"custom_options": [
[
"option_id": "",
"option_value": "",
"extension_attributes": ["file_info": [
"base64_encoded_data": "",
"type": "",
"name": ""
]]
]
],
"bundle_options": [
[
"option_id": 0,
"option_qty": 0,
"option_selections": [],
"extension_attributes": []
]
],
"configurable_item_options": [
[
"option_id": "",
"option_value": 0,
"extension_attributes": []
]
],
"downloadable_option": ["downloadable_links": []],
"giftcard_item_option": [
"giftcard_amount": "",
"custom_giftcard_amount": "",
"giftcard_sender_name": "",
"giftcard_recipient_name": "",
"giftcard_sender_email": "",
"giftcard_recipient_email": "",
"giftcard_message": "",
"extension_attributes": ["giftcard_created_codes": []]
]
]],
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"negotiable_quote_item": [
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": []
]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/items/:itemId")! 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
guest-carts-{cartId}-order
{{baseUrl}}/async/V1/guest-carts/:cartId/order
QUERY PARAMS
cartId
BODY json
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/order");
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/guest-carts/:cartId/order" {:content-type :json
:form-params {:paymentMethod {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/order"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\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}}/async/V1/guest-carts/:cartId/order"),
Content = new StringContent("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_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}}/async/V1/guest-carts/:cartId/order");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/order"
payload := strings.NewReader("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\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/async/V1/guest-carts/:cartId/order HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 156
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/guest-carts/:cartId/order")
.setHeader("content-type", "application/json")
.setBody("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/order"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/order")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/guest-carts/:cartId/order")
.header("content-type", "application/json")
.body("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}")
.asString();
const data = JSON.stringify({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/async/V1/guest-carts/:cartId/order');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/order',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/order';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_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}}/async/V1/guest-carts/:cartId/order',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/order")
.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/async/V1/guest-carts/:cartId/order',
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({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/order',
headers: {'content-type': 'application/json'},
body: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_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('PUT', '{{baseUrl}}/async/V1/guest-carts/:cartId/order');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_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: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/order',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/order';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_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 = @{ @"paymentMethod": @{ @"po_number": @"", @"method": @"", @"additional_data": @[ ], @"extension_attributes": @{ @"agreement_ids": @[ ] } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/order"]
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}}/async/V1/guest-carts/:cartId/order" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/order",
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([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_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('PUT', '{{baseUrl}}/async/V1/guest-carts/:cartId/order', [
'body' => '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/order');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/order');
$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}}/async/V1/guest-carts/:cartId/order' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/order' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/async/V1/guest-carts/:cartId/order", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/order"
payload = { "paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": { "agreement_ids": [] }
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/order"
payload <- "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\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}}/async/V1/guest-carts/:cartId/order")
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_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.put('/baseUrl/async/V1/guest-carts/:cartId/order') do |req|
req.body = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\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}}/async/V1/guest-carts/:cartId/order";
let payload = json!({"paymentMethod": json!({
"po_number": "",
"method": "",
"additional_data": (),
"extension_attributes": json!({"agreement_ids": ()})
})});
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}}/async/V1/guest-carts/:cartId/order \
--header 'content-type: application/json' \
--data '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}'
echo '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}' | \
http PUT {{baseUrl}}/async/V1/guest-carts/:cartId/order \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/order
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["paymentMethod": [
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": ["agreement_ids": []]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/order")! 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
guest-carts-{cartId}-payment-information
{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information
QUERY PARAMS
cartId
BODY json
{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information");
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 \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information" {:content-type :json
:form-params {:email ""
:paymentMethod {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}
:billingAddress {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/payment-information"),
Content = new StringContent("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/payment-information");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information"
payload := strings.NewReader("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/guest-carts/:cartId/payment-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1084
{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information")
.setHeader("content-type", "application/json")
.setBody("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information")
.header("content-type", "application/json")
.body("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information',
headers: {'content-type': 'application/json'},
data: {
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"email":"","paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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}}/async/V1/guest-carts/:cartId/payment-information',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "email": "",\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\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 \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information")
.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/async/V1/guest-carts/:cartId/payment-information',
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({
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information',
headers: {'content-type': 'application/json'},
body: {
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
},
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}}/async/V1/guest-carts/:cartId/payment-information');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
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}}/async/V1/guest-carts/:cartId/payment-information',
headers: {'content-type': 'application/json'},
data: {
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"email":"","paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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 = @{ @"email": @"",
@"paymentMethod": @{ @"po_number": @"", @"method": @"", @"additional_data": @[ ], @"extension_attributes": @{ @"agreement_ids": @[ ] } },
@"billingAddress": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information"]
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}}/async/V1/guest-carts/:cartId/payment-information" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information",
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([
'email' => '',
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]),
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}}/async/V1/guest-carts/:cartId/payment-information', [
'body' => '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'email' => '',
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'email' => '',
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information');
$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}}/async/V1/guest-carts/:cartId/payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/guest-carts/:cartId/payment-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information"
payload = {
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": { "agreement_ids": [] }
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information"
payload <- "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/payment-information")
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 \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/guest-carts/:cartId/payment-information') do |req|
req.body = "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/payment-information";
let payload = json!({
"email": "",
"paymentMethod": json!({
"po_number": "",
"method": "",
"additional_data": (),
"extension_attributes": json!({"agreement_ids": ()})
}),
"billingAddress": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})
});
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}}/async/V1/guest-carts/:cartId/payment-information \
--header 'content-type: application/json' \
--data '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
echo '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}' | \
http POST {{baseUrl}}/async/V1/guest-carts/:cartId/payment-information \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "email": "",\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/payment-information
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"email": "",
"paymentMethod": [
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": ["agreement_ids": []]
],
"billingAddress": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/payment-information")! 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()
PUT
guest-carts-{cartId}-selected-payment-method
{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method
QUERY PARAMS
cartId
BODY json
{
"method": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method");
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 \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method" {:content-type :json
:form-params {:method {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\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}}/async/V1/guest-carts/:cartId/selected-payment-method"),
Content = new StringContent("{\n \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_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}}/async/V1/guest-carts/:cartId/selected-payment-method");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method"
payload := strings.NewReader("{\n \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\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/async/V1/guest-carts/:cartId/selected-payment-method HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 149
{
"method": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method")
.setHeader("content-type", "application/json")
.setBody("{\n \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_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 \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method")
.header("content-type", "application/json")
.body("{\n \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}")
.asString();
const data = JSON.stringify({
method: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method',
headers: {'content-type': 'application/json'},
data: {
method: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"method":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_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}}/async/V1/guest-carts/:cartId/selected-payment-method',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "method": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_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 \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method")
.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/async/V1/guest-carts/:cartId/selected-payment-method',
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({
method: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method',
headers: {'content-type': 'application/json'},
body: {
method: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_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('PUT', '{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
method: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_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: 'PUT',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method',
headers: {'content-type': 'application/json'},
data: {
method: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"method":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_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 = @{ @"method": @{ @"po_number": @"", @"method": @"", @"additional_data": @[ ], @"extension_attributes": @{ @"agreement_ids": @[ ] } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method"]
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}}/async/V1/guest-carts/:cartId/selected-payment-method" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method",
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([
'method' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_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('PUT', '{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method', [
'body' => '{
"method": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'method' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'method' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method');
$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}}/async/V1/guest-carts/:cartId/selected-payment-method' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"method": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"method": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/async/V1/guest-carts/:cartId/selected-payment-method", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method"
payload = { "method": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": { "agreement_ids": [] }
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method"
payload <- "{\n \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\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}}/async/V1/guest-carts/:cartId/selected-payment-method")
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 \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_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.put('/baseUrl/async/V1/guest-carts/:cartId/selected-payment-method') do |req|
req.body = "{\n \"method\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\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}}/async/V1/guest-carts/:cartId/selected-payment-method";
let payload = json!({"method": json!({
"po_number": "",
"method": "",
"additional_data": (),
"extension_attributes": json!({"agreement_ids": ()})
})});
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}}/async/V1/guest-carts/:cartId/selected-payment-method \
--header 'content-type: application/json' \
--data '{
"method": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}'
echo '{
"method": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}' | \
http PUT {{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "method": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["method": [
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": ["agreement_ids": []]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/selected-payment-method")! 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
guest-carts-{cartId}-set-payment-information
{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information
QUERY PARAMS
cartId
BODY json
{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information");
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 \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information" {:content-type :json
:form-params {:email ""
:paymentMethod {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}
:billingAddress {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/set-payment-information"),
Content = new StringContent("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/set-payment-information");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information"
payload := strings.NewReader("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/guest-carts/:cartId/set-payment-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1084
{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information")
.setHeader("content-type", "application/json")
.setBody("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information")
.header("content-type", "application/json")
.body("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information',
headers: {'content-type': 'application/json'},
data: {
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"email":"","paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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}}/async/V1/guest-carts/:cartId/set-payment-information',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "email": "",\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\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 \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information")
.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/async/V1/guest-carts/:cartId/set-payment-information',
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({
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information',
headers: {'content-type': 'application/json'},
body: {
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
},
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}}/async/V1/guest-carts/:cartId/set-payment-information');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
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}}/async/V1/guest-carts/:cartId/set-payment-information',
headers: {'content-type': 'application/json'},
data: {
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"email":"","paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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 = @{ @"email": @"",
@"paymentMethod": @{ @"po_number": @"", @"method": @"", @"additional_data": @[ ], @"extension_attributes": @{ @"agreement_ids": @[ ] } },
@"billingAddress": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information"]
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}}/async/V1/guest-carts/:cartId/set-payment-information" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information",
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([
'email' => '',
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]),
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}}/async/V1/guest-carts/:cartId/set-payment-information', [
'body' => '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'email' => '',
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'email' => '',
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information');
$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}}/async/V1/guest-carts/:cartId/set-payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/guest-carts/:cartId/set-payment-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information"
payload = {
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": { "agreement_ids": [] }
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information"
payload <- "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/set-payment-information")
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 \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/guest-carts/:cartId/set-payment-information') do |req|
req.body = "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/guest-carts/:cartId/set-payment-information";
let payload = json!({
"email": "",
"paymentMethod": json!({
"po_number": "",
"method": "",
"additional_data": (),
"extension_attributes": json!({"agreement_ids": ()})
}),
"billingAddress": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})
});
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}}/async/V1/guest-carts/:cartId/set-payment-information \
--header 'content-type: application/json' \
--data '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
echo '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}' | \
http POST {{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "email": "",\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"email": "",
"paymentMethod": [
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": ["agreement_ids": []]
],
"billingAddress": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/set-payment-information")! 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
guest-carts-{cartId}-shipping-information
{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information
QUERY PARAMS
cartId
BODY json
{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information");
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 \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information" {:content-type :json
:form-params {:addressInformation {:shipping_address {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}
:billing_address {}
:shipping_method_code ""
:shipping_carrier_code ""
:extension_attributes {}
:custom_attributes [{}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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}}/async/V1/guest-carts/:cartId/shipping-information"),
Content = new StringContent("{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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}}/async/V1/guest-carts/:cartId/shipping-information");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information"
payload := strings.NewReader("{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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/async/V1/guest-carts/:cartId/shipping-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1204
{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information")
.setHeader("content-type", "application/json")
.setBody("{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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 \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information")
.header("content-type", "application/json")
.body("{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}")
.asString();
const data = JSON.stringify({
addressInformation: {
shipping_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [
{}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information',
headers: {'content-type': 'application/json'},
data: {
addressInformation: {
shipping_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"addressInformation":{"shipping_address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]},"billing_address":{},"shipping_method_code":"","shipping_carrier_code":"","extension_attributes":{},"custom_attributes":[{}]}}'
};
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}}/async/V1/guest-carts/:cartId/shipping-information',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "addressInformation": {\n "shipping_address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "billing_address": {},\n "shipping_method_code": "",\n "shipping_carrier_code": "",\n "extension_attributes": {},\n "custom_attributes": [\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 \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information")
.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/async/V1/guest-carts/:cartId/shipping-information',
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({
addressInformation: {
shipping_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information',
headers: {'content-type': 'application/json'},
body: {
addressInformation: {
shipping_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
},
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}}/async/V1/guest-carts/:cartId/shipping-information');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
addressInformation: {
shipping_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [
{}
]
}
});
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}}/async/V1/guest-carts/:cartId/shipping-information',
headers: {'content-type': 'application/json'},
data: {
addressInformation: {
shipping_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"addressInformation":{"shipping_address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]},"billing_address":{},"shipping_method_code":"","shipping_carrier_code":"","extension_attributes":{},"custom_attributes":[{}]}}'
};
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 = @{ @"addressInformation": @{ @"shipping_address": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"billing_address": @{ }, @"shipping_method_code": @"", @"shipping_carrier_code": @"", @"extension_attributes": @{ }, @"custom_attributes": @[ @{ } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information"]
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}}/async/V1/guest-carts/:cartId/shipping-information" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information",
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([
'addressInformation' => [
'shipping_address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'billing_address' => [
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]),
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}}/async/V1/guest-carts/:cartId/shipping-information', [
'body' => '{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'addressInformation' => [
'shipping_address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'billing_address' => [
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'addressInformation' => [
'shipping_address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'billing_address' => [
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information');
$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}}/async/V1/guest-carts/:cartId/shipping-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/guest-carts/:cartId/shipping-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information"
payload = { "addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [{}]
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information"
payload <- "{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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}}/async/V1/guest-carts/:cartId/shipping-information")
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 \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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/async/V1/guest-carts/:cartId/shipping-information') do |req|
req.body = "{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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}}/async/V1/guest-carts/:cartId/shipping-information";
let payload = json!({"addressInformation": json!({
"shipping_address": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"billing_address": json!({}),
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": json!({}),
"custom_attributes": (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}}/async/V1/guest-carts/:cartId/shipping-information \
--header 'content-type: application/json' \
--data '{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
echo '{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}' | \
http POST {{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "addressInformation": {\n "shipping_address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "billing_address": {},\n "shipping_method_code": "",\n "shipping_carrier_code": "",\n "extension_attributes": {},\n "custom_attributes": [\n {}\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["addressInformation": [
"shipping_address": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
],
"billing_address": [],
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": [],
"custom_attributes": [[]]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/shipping-information")! 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
guest-carts-{cartId}-totals-information
{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information
QUERY PARAMS
cartId
BODY json
{
"addressInformation": {
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information");
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 \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information" {:content-type :json
:form-params {:addressInformation {:address {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}
:shipping_method_code ""
:shipping_carrier_code ""
:extension_attributes {}
:custom_attributes [{}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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}}/async/V1/guest-carts/:cartId/totals-information"),
Content = new StringContent("{\n \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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}}/async/V1/guest-carts/:cartId/totals-information");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information"
payload := strings.NewReader("{\n \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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/async/V1/guest-carts/:cartId/totals-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1168
{
"addressInformation": {
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information")
.setHeader("content-type", "application/json")
.setBody("{\n \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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 \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information")
.header("content-type", "application/json")
.body("{\n \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}")
.asString();
const data = JSON.stringify({
addressInformation: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [
{}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information',
headers: {'content-type': 'application/json'},
data: {
addressInformation: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"addressInformation":{"address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]},"shipping_method_code":"","shipping_carrier_code":"","extension_attributes":{},"custom_attributes":[{}]}}'
};
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}}/async/V1/guest-carts/:cartId/totals-information',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "addressInformation": {\n "address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "shipping_method_code": "",\n "shipping_carrier_code": "",\n "extension_attributes": {},\n "custom_attributes": [\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 \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information")
.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/async/V1/guest-carts/:cartId/totals-information',
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({
addressInformation: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information',
headers: {'content-type': 'application/json'},
body: {
addressInformation: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
},
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}}/async/V1/guest-carts/:cartId/totals-information');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
addressInformation: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [
{}
]
}
});
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}}/async/V1/guest-carts/:cartId/totals-information',
headers: {'content-type': 'application/json'},
data: {
addressInformation: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"addressInformation":{"address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]},"shipping_method_code":"","shipping_carrier_code":"","extension_attributes":{},"custom_attributes":[{}]}}'
};
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 = @{ @"addressInformation": @{ @"address": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"shipping_method_code": @"", @"shipping_carrier_code": @"", @"extension_attributes": @{ }, @"custom_attributes": @[ @{ } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information"]
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}}/async/V1/guest-carts/:cartId/totals-information" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information",
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([
'addressInformation' => [
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]),
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}}/async/V1/guest-carts/:cartId/totals-information', [
'body' => '{
"addressInformation": {
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'addressInformation' => [
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'addressInformation' => [
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information');
$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}}/async/V1/guest-carts/:cartId/totals-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"addressInformation": {
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"addressInformation": {
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/guest-carts/:cartId/totals-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information"
payload = { "addressInformation": {
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [{}]
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information"
payload <- "{\n \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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}}/async/V1/guest-carts/:cartId/totals-information")
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 \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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/async/V1/guest-carts/:cartId/totals-information') do |req|
req.body = "{\n \"addressInformation\": {\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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}}/async/V1/guest-carts/:cartId/totals-information";
let payload = json!({"addressInformation": json!({
"address": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": json!({}),
"custom_attributes": (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}}/async/V1/guest-carts/:cartId/totals-information \
--header 'content-type: application/json' \
--data '{
"addressInformation": {
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
echo '{
"addressInformation": {
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}' | \
http POST {{baseUrl}}/async/V1/guest-carts/:cartId/totals-information \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "addressInformation": {\n "address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "shipping_method_code": "",\n "shipping_carrier_code": "",\n "extension_attributes": {},\n "custom_attributes": [\n {}\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-carts/:cartId/totals-information
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["addressInformation": [
"address": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
],
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": [],
"custom_attributes": [[]]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-carts/:cartId/totals-information")! 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
guest-giftregistry-{cartId}-estimate-shipping-methods
{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods
QUERY PARAMS
cartId
BODY json
{
"registryId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods");
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 \"registryId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods" {:content-type :json
:form-params {:registryId 0}})
require "http/client"
url = "{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"registryId\": 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}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods"),
Content = new StringContent("{\n \"registryId\": 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}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"registryId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods"
payload := strings.NewReader("{\n \"registryId\": 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/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 21
{
"registryId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods")
.setHeader("content-type", "application/json")
.setBody("{\n \"registryId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"registryId\": 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 \"registryId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods")
.header("content-type", "application/json")
.body("{\n \"registryId\": 0\n}")
.asString();
const data = JSON.stringify({
registryId: 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}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods',
headers: {'content-type': 'application/json'},
data: {registryId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"registryId":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}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "registryId": 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 \"registryId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods")
.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/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods',
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({registryId: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods',
headers: {'content-type': 'application/json'},
body: {registryId: 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}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
registryId: 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}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods',
headers: {'content-type': 'application/json'},
data: {registryId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"registryId":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 = @{ @"registryId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods"]
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}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"registryId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods",
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([
'registryId' => 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}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods', [
'body' => '{
"registryId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'registryId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'registryId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods');
$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}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"registryId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"registryId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"registryId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods"
payload = { "registryId": 0 }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods"
payload <- "{\n \"registryId\": 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}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods")
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 \"registryId\": 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/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods') do |req|
req.body = "{\n \"registryId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods";
let payload = json!({"registryId": 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}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods \
--header 'content-type: application/json' \
--data '{
"registryId": 0
}'
echo '{
"registryId": 0
}' | \
http POST {{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "registryId": 0\n}' \
--output-document \
- {{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["registryId": 0] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/guest-giftregistry/:cartId/estimate-shipping-methods")! 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
integration-admin-token
{{baseUrl}}/async/V1/integration/admin/token
BODY json
{
"username": "",
"password": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/integration/admin/token");
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 \"username\": \"\",\n \"password\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/integration/admin/token" {:content-type :json
:form-params {:username ""
:password ""}})
require "http/client"
url = "{{baseUrl}}/async/V1/integration/admin/token"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"username\": \"\",\n \"password\": \"\"\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}}/async/V1/integration/admin/token"),
Content = new StringContent("{\n \"username\": \"\",\n \"password\": \"\"\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}}/async/V1/integration/admin/token");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"username\": \"\",\n \"password\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/integration/admin/token"
payload := strings.NewReader("{\n \"username\": \"\",\n \"password\": \"\"\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/async/V1/integration/admin/token HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 38
{
"username": "",
"password": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/integration/admin/token")
.setHeader("content-type", "application/json")
.setBody("{\n \"username\": \"\",\n \"password\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/integration/admin/token"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"username\": \"\",\n \"password\": \"\"\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 \"username\": \"\",\n \"password\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/integration/admin/token")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/integration/admin/token")
.header("content-type", "application/json")
.body("{\n \"username\": \"\",\n \"password\": \"\"\n}")
.asString();
const data = JSON.stringify({
username: '',
password: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/integration/admin/token');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/integration/admin/token',
headers: {'content-type': 'application/json'},
data: {username: '', password: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/integration/admin/token';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"username":"","password":""}'
};
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}}/async/V1/integration/admin/token',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "username": "",\n "password": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"username\": \"\",\n \"password\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/integration/admin/token")
.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/async/V1/integration/admin/token',
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({username: '', password: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/integration/admin/token',
headers: {'content-type': 'application/json'},
body: {username: '', password: ''},
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}}/async/V1/integration/admin/token');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
username: '',
password: ''
});
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}}/async/V1/integration/admin/token',
headers: {'content-type': 'application/json'},
data: {username: '', password: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/integration/admin/token';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"username":"","password":""}'
};
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 = @{ @"username": @"",
@"password": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/integration/admin/token"]
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}}/async/V1/integration/admin/token" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"username\": \"\",\n \"password\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/integration/admin/token",
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([
'username' => '',
'password' => ''
]),
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}}/async/V1/integration/admin/token', [
'body' => '{
"username": "",
"password": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/integration/admin/token');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'username' => '',
'password' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'username' => '',
'password' => ''
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/integration/admin/token');
$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}}/async/V1/integration/admin/token' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"username": "",
"password": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/integration/admin/token' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"username": "",
"password": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"username\": \"\",\n \"password\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/integration/admin/token", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/integration/admin/token"
payload = {
"username": "",
"password": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/integration/admin/token"
payload <- "{\n \"username\": \"\",\n \"password\": \"\"\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}}/async/V1/integration/admin/token")
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 \"username\": \"\",\n \"password\": \"\"\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/async/V1/integration/admin/token') do |req|
req.body = "{\n \"username\": \"\",\n \"password\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/integration/admin/token";
let payload = json!({
"username": "",
"password": ""
});
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}}/async/V1/integration/admin/token \
--header 'content-type: application/json' \
--data '{
"username": "",
"password": ""
}'
echo '{
"username": "",
"password": ""
}' | \
http POST {{baseUrl}}/async/V1/integration/admin/token \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "username": "",\n "password": ""\n}' \
--output-document \
- {{baseUrl}}/async/V1/integration/admin/token
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"username": "",
"password": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/integration/admin/token")! 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
integration-customer-token
{{baseUrl}}/async/V1/integration/customer/token
BODY json
{
"username": "",
"password": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/integration/customer/token");
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 \"username\": \"\",\n \"password\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/integration/customer/token" {:content-type :json
:form-params {:username ""
:password ""}})
require "http/client"
url = "{{baseUrl}}/async/V1/integration/customer/token"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"username\": \"\",\n \"password\": \"\"\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}}/async/V1/integration/customer/token"),
Content = new StringContent("{\n \"username\": \"\",\n \"password\": \"\"\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}}/async/V1/integration/customer/token");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"username\": \"\",\n \"password\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/integration/customer/token"
payload := strings.NewReader("{\n \"username\": \"\",\n \"password\": \"\"\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/async/V1/integration/customer/token HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 38
{
"username": "",
"password": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/integration/customer/token")
.setHeader("content-type", "application/json")
.setBody("{\n \"username\": \"\",\n \"password\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/integration/customer/token"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"username\": \"\",\n \"password\": \"\"\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 \"username\": \"\",\n \"password\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/integration/customer/token")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/integration/customer/token")
.header("content-type", "application/json")
.body("{\n \"username\": \"\",\n \"password\": \"\"\n}")
.asString();
const data = JSON.stringify({
username: '',
password: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/integration/customer/token');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/integration/customer/token',
headers: {'content-type': 'application/json'},
data: {username: '', password: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/integration/customer/token';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"username":"","password":""}'
};
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}}/async/V1/integration/customer/token',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "username": "",\n "password": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"username\": \"\",\n \"password\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/integration/customer/token")
.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/async/V1/integration/customer/token',
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({username: '', password: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/integration/customer/token',
headers: {'content-type': 'application/json'},
body: {username: '', password: ''},
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}}/async/V1/integration/customer/token');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
username: '',
password: ''
});
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}}/async/V1/integration/customer/token',
headers: {'content-type': 'application/json'},
data: {username: '', password: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/integration/customer/token';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"username":"","password":""}'
};
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 = @{ @"username": @"",
@"password": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/integration/customer/token"]
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}}/async/V1/integration/customer/token" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"username\": \"\",\n \"password\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/integration/customer/token",
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([
'username' => '',
'password' => ''
]),
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}}/async/V1/integration/customer/token', [
'body' => '{
"username": "",
"password": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/integration/customer/token');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'username' => '',
'password' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'username' => '',
'password' => ''
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/integration/customer/token');
$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}}/async/V1/integration/customer/token' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"username": "",
"password": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/integration/customer/token' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"username": "",
"password": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"username\": \"\",\n \"password\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/integration/customer/token", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/integration/customer/token"
payload = {
"username": "",
"password": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/integration/customer/token"
payload <- "{\n \"username\": \"\",\n \"password\": \"\"\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}}/async/V1/integration/customer/token")
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 \"username\": \"\",\n \"password\": \"\"\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/async/V1/integration/customer/token') do |req|
req.body = "{\n \"username\": \"\",\n \"password\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/integration/customer/token";
let payload = json!({
"username": "",
"password": ""
});
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}}/async/V1/integration/customer/token \
--header 'content-type: application/json' \
--data '{
"username": "",
"password": ""
}'
echo '{
"username": "",
"password": ""
}' | \
http POST {{baseUrl}}/async/V1/integration/customer/token \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "username": "",\n "password": ""\n}' \
--output-document \
- {{baseUrl}}/async/V1/integration/customer/token
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"username": "",
"password": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/integration/customer/token")! 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
negotiable-carts-{cartId}-billing-address
{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address
QUERY PARAMS
cartId
BODY json
{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address");
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 \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address" {:content-type :json
:form-params {:address {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}
:useForShipping false}})
require "http/client"
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": 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}}/async/V1/negotiable-carts/:cartId/billing-address"),
Content = new StringContent("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": 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}}/async/V1/negotiable-carts/:cartId/billing-address");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address"
payload := strings.NewReader("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": 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/async/V1/negotiable-carts/:cartId/billing-address HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 935
{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address")
.setHeader("content-type", "application/json")
.setBody("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": 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 \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address")
.header("content-type", "application/json")
.body("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}")
.asString();
const data = JSON.stringify({
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
},
useForShipping: 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}}/async/V1/negotiable-carts/:cartId/billing-address');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address',
headers: {'content-type': 'application/json'},
data: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
useForShipping: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]},"useForShipping":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}}/async/V1/negotiable-carts/:cartId/billing-address',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "useForShipping": 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 \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address")
.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/async/V1/negotiable-carts/:cartId/billing-address',
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: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
useForShipping: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address',
headers: {'content-type': 'application/json'},
body: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
useForShipping: 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}}/async/V1/negotiable-carts/:cartId/billing-address');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
},
useForShipping: 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}}/async/V1/negotiable-carts/:cartId/billing-address',
headers: {'content-type': 'application/json'},
data: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
useForShipping: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]},"useForShipping":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 = @{ @"address": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] },
@"useForShipping": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address"]
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}}/async/V1/negotiable-carts/:cartId/billing-address" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address",
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' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'useForShipping' => 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}}/async/V1/negotiable-carts/:cartId/billing-address', [
'body' => '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'useForShipping' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'useForShipping' => null
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address');
$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}}/async/V1/negotiable-carts/:cartId/billing-address' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/negotiable-carts/:cartId/billing-address", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address"
payload = {
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address"
payload <- "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": 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}}/async/V1/negotiable-carts/:cartId/billing-address")
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 \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": 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/async/V1/negotiable-carts/:cartId/billing-address') do |req|
req.body = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"useForShipping\": false\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address";
let payload = json!({
"address": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"useForShipping": 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}}/async/V1/negotiable-carts/:cartId/billing-address \
--header 'content-type: application/json' \
--data '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}'
echo '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"useForShipping": false
}' | \
http POST {{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "useForShipping": false\n}' \
--output-document \
- {{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"address": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
],
"useForShipping": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/negotiable-carts/:cartId/billing-address")! 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()
DELETE
negotiable-carts-{cartId}-coupons
{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons
QUERY PARAMS
cartId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons")
require "http/client"
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons"
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}}/async/V1/negotiable-carts/:cartId/coupons"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons"
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/async/V1/negotiable-carts/:cartId/coupons HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons"))
.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}}/async/V1/negotiable-carts/:cartId/coupons")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons")
.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}}/async/V1/negotiable-carts/:cartId/coupons');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons';
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}}/async/V1/negotiable-carts/:cartId/coupons',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/async/V1/negotiable-carts/:cartId/coupons',
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}}/async/V1/negotiable-carts/:cartId/coupons'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons');
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}}/async/V1/negotiable-carts/:cartId/coupons'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons';
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}}/async/V1/negotiable-carts/:cartId/coupons"]
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}}/async/V1/negotiable-carts/:cartId/coupons" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons",
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}}/async/V1/negotiable-carts/:cartId/coupons');
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/async/V1/negotiable-carts/:cartId/coupons")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons")
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/async/V1/negotiable-carts/:cartId/coupons') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons";
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}}/async/V1/negotiable-carts/:cartId/coupons
http DELETE {{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons")! 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()
PUT
negotiable-carts-{cartId}-coupons-{couponCode}
{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode
QUERY PARAMS
cartId
couponCode
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode")
require "http/client"
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode"
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}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode");
var request = new RestRequest("", Method.Put);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode"
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/async/V1/negotiable-carts/:cartId/coupons/:couponCode HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode"))
.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}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode")
.put(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode")
.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}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode';
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}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode',
method: 'PUT',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode")
.put(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/async/V1/negotiable-carts/:cartId/coupons/:couponCode',
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}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode');
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}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode';
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}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode"]
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}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode" in
Client.call `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode",
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}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode');
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode');
$request->setRequestMethod('PUT');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode' -Method PUT
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode' -Method PUT
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("PUT", "/baseUrl/async/V1/negotiable-carts/:cartId/coupons/:couponCode")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode"
response = requests.put(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode"
response <- VERB("PUT", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode")
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/async/V1/negotiable-carts/:cartId/coupons/:couponCode') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode";
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}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode
http PUT {{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode
wget --quiet \
--method PUT \
--output-document \
- {{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/negotiable-carts/:cartId/coupons/:couponCode")! 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()
POST
negotiable-carts-{cartId}-estimate-shipping-methods
{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods
QUERY PARAMS
cartId
BODY json
{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods");
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 \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods" {:content-type :json
:form-params {:address {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods"),
Content = new StringContent("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods"
payload := strings.NewReader("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/negotiable-carts/:cartId/estimate-shipping-methods HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 908
{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods")
.setHeader("content-type", "application/json")
.setBody("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods")
.header("content-type", "application/json")
.body("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods',
headers: {'content-type': 'application/json'},
data: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\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 \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods")
.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/async/V1/negotiable-carts/:cartId/estimate-shipping-methods',
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: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods',
headers: {'content-type': 'application/json'},
body: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
},
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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods',
headers: {'content-type': 'application/json'},
data: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods"]
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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods",
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' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]),
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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods', [
'body' => '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods');
$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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/negotiable-carts/:cartId/estimate-shipping-methods", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods"
payload = { "address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods"
payload <- "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods")
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 \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/negotiable-carts/:cartId/estimate-shipping-methods') do |req|
req.body = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods";
let payload = json!({"address": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})});
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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods \
--header 'content-type: application/json' \
--data '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
echo '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}' | \
http POST {{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["address": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods")! 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
negotiable-carts-{cartId}-estimate-shipping-methods-by-address-id
{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id
QUERY PARAMS
cartId
BODY json
{
"addressId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-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 \"addressId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id" {:content-type :json
:form-params {:addressId 0}})
require "http/client"
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"addressId\": 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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id"),
Content = new StringContent("{\n \"addressId\": 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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"addressId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id"
payload := strings.NewReader("{\n \"addressId\": 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/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 20
{
"addressId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id")
.setHeader("content-type", "application/json")
.setBody("{\n \"addressId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"addressId\": 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 \"addressId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id")
.header("content-type", "application/json")
.body("{\n \"addressId\": 0\n}")
.asString();
const data = JSON.stringify({
addressId: 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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id',
headers: {'content-type': 'application/json'},
data: {addressId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"addressId":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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "addressId": 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 \"addressId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id")
.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/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-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({addressId: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id',
headers: {'content-type': 'application/json'},
body: {addressId: 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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
addressId: 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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id',
headers: {'content-type': 'application/json'},
data: {addressId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"addressId":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 = @{ @"addressId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id"]
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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"addressId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id",
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([
'addressId' => 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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id', [
'body' => '{
"addressId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'addressId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'addressId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id');
$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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"addressId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"addressId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"addressId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id"
payload = { "addressId": 0 }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id"
payload <- "{\n \"addressId\": 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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id")
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 \"addressId\": 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/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id') do |req|
req.body = "{\n \"addressId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id";
let payload = json!({"addressId": 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}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id \
--header 'content-type: application/json' \
--data '{
"addressId": 0
}'
echo '{
"addressId": 0
}' | \
http POST {{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "addressId": 0\n}' \
--output-document \
- {{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["addressId": 0] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/negotiable-carts/:cartId/estimate-shipping-methods-by-address-id")! 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
negotiable-carts-{cartId}-giftCards
{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards
QUERY PARAMS
cartId
BODY json
{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards");
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 \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards" {:content-type :json
:form-params {:giftCardAccountData {:gift_cards []
:gift_cards_amount ""
:base_gift_cards_amount ""
:gift_cards_amount_used ""
:base_gift_cards_amount_used ""
:extension_attributes {}}}})
require "http/client"
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\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}}/async/V1/negotiable-carts/:cartId/giftCards"),
Content = new StringContent("{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\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}}/async/V1/negotiable-carts/:cartId/giftCards");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards"
payload := strings.NewReader("{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\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/async/V1/negotiable-carts/:cartId/giftCards HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 223
{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards")
.setHeader("content-type", "application/json")
.setBody("{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\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 \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards")
.header("content-type", "application/json")
.body("{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}")
.asString();
const data = JSON.stringify({
giftCardAccountData: {
gift_cards: [],
gift_cards_amount: '',
base_gift_cards_amount: '',
gift_cards_amount_used: '',
base_gift_cards_amount_used: '',
extension_attributes: {}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards',
headers: {'content-type': 'application/json'},
data: {
giftCardAccountData: {
gift_cards: [],
gift_cards_amount: '',
base_gift_cards_amount: '',
gift_cards_amount_used: '',
base_gift_cards_amount_used: '',
extension_attributes: {}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"giftCardAccountData":{"gift_cards":[],"gift_cards_amount":"","base_gift_cards_amount":"","gift_cards_amount_used":"","base_gift_cards_amount_used":"","extension_attributes":{}}}'
};
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}}/async/V1/negotiable-carts/:cartId/giftCards',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "giftCardAccountData": {\n "gift_cards": [],\n "gift_cards_amount": "",\n "base_gift_cards_amount": "",\n "gift_cards_amount_used": "",\n "base_gift_cards_amount_used": "",\n "extension_attributes": {}\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 \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards")
.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/async/V1/negotiable-carts/:cartId/giftCards',
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({
giftCardAccountData: {
gift_cards: [],
gift_cards_amount: '',
base_gift_cards_amount: '',
gift_cards_amount_used: '',
base_gift_cards_amount_used: '',
extension_attributes: {}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards',
headers: {'content-type': 'application/json'},
body: {
giftCardAccountData: {
gift_cards: [],
gift_cards_amount: '',
base_gift_cards_amount: '',
gift_cards_amount_used: '',
base_gift_cards_amount_used: '',
extension_attributes: {}
}
},
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}}/async/V1/negotiable-carts/:cartId/giftCards');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
giftCardAccountData: {
gift_cards: [],
gift_cards_amount: '',
base_gift_cards_amount: '',
gift_cards_amount_used: '',
base_gift_cards_amount_used: '',
extension_attributes: {}
}
});
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}}/async/V1/negotiable-carts/:cartId/giftCards',
headers: {'content-type': 'application/json'},
data: {
giftCardAccountData: {
gift_cards: [],
gift_cards_amount: '',
base_gift_cards_amount: '',
gift_cards_amount_used: '',
base_gift_cards_amount_used: '',
extension_attributes: {}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"giftCardAccountData":{"gift_cards":[],"gift_cards_amount":"","base_gift_cards_amount":"","gift_cards_amount_used":"","base_gift_cards_amount_used":"","extension_attributes":{}}}'
};
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 = @{ @"giftCardAccountData": @{ @"gift_cards": @[ ], @"gift_cards_amount": @"", @"base_gift_cards_amount": @"", @"gift_cards_amount_used": @"", @"base_gift_cards_amount_used": @"", @"extension_attributes": @{ } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards"]
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}}/async/V1/negotiable-carts/:cartId/giftCards" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards",
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([
'giftCardAccountData' => [
'gift_cards' => [
],
'gift_cards_amount' => '',
'base_gift_cards_amount' => '',
'gift_cards_amount_used' => '',
'base_gift_cards_amount_used' => '',
'extension_attributes' => [
]
]
]),
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}}/async/V1/negotiable-carts/:cartId/giftCards', [
'body' => '{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'giftCardAccountData' => [
'gift_cards' => [
],
'gift_cards_amount' => '',
'base_gift_cards_amount' => '',
'gift_cards_amount_used' => '',
'base_gift_cards_amount_used' => '',
'extension_attributes' => [
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'giftCardAccountData' => [
'gift_cards' => [
],
'gift_cards_amount' => '',
'base_gift_cards_amount' => '',
'gift_cards_amount_used' => '',
'base_gift_cards_amount_used' => '',
'extension_attributes' => [
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards');
$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}}/async/V1/negotiable-carts/:cartId/giftCards' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/negotiable-carts/:cartId/giftCards", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards"
payload = { "giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards"
payload <- "{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\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}}/async/V1/negotiable-carts/:cartId/giftCards")
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 \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\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/async/V1/negotiable-carts/:cartId/giftCards') do |req|
req.body = "{\n \"giftCardAccountData\": {\n \"gift_cards\": [],\n \"gift_cards_amount\": \"\",\n \"base_gift_cards_amount\": \"\",\n \"gift_cards_amount_used\": \"\",\n \"base_gift_cards_amount_used\": \"\",\n \"extension_attributes\": {}\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards";
let payload = json!({"giftCardAccountData": json!({
"gift_cards": (),
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": 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}}/async/V1/negotiable-carts/:cartId/giftCards \
--header 'content-type: application/json' \
--data '{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}'
echo '{
"giftCardAccountData": {
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": {}
}
}' | \
http POST {{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "giftCardAccountData": {\n "gift_cards": [],\n "gift_cards_amount": "",\n "base_gift_cards_amount": "",\n "gift_cards_amount_used": "",\n "base_gift_cards_amount_used": "",\n "extension_attributes": {}\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["giftCardAccountData": [
"gift_cards": [],
"gift_cards_amount": "",
"base_gift_cards_amount": "",
"gift_cards_amount_used": "",
"base_gift_cards_amount_used": "",
"extension_attributes": []
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards")! 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()
DELETE
negotiable-carts-{cartId}-giftCards-{giftCardCode}
{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode
QUERY PARAMS
cartId
giftCardCode
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode")
require "http/client"
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode"
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}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode"
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/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode"))
.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}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode")
.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}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode';
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}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode',
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}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode');
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}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode';
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}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode"]
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}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode",
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}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode');
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode")
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/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode";
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}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode
http DELETE {{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/negotiable-carts/:cartId/giftCards/:giftCardCode")! 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()
POST
negotiable-carts-{cartId}-payment-information
{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information
QUERY PARAMS
cartId
BODY json
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information");
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information" {:content-type :json
:form-params {:paymentMethod {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}
:billingAddress {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/negotiable-carts/:cartId/payment-information"),
Content = new StringContent("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/negotiable-carts/:cartId/payment-information");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information"
payload := strings.NewReader("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/negotiable-carts/:cartId/payment-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1069
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information")
.setHeader("content-type", "application/json")
.setBody("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information")
.header("content-type", "application/json")
.body("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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}}/async/V1/negotiable-carts/:cartId/payment-information',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information")
.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/async/V1/negotiable-carts/:cartId/payment-information',
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({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information',
headers: {'content-type': 'application/json'},
body: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
},
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}}/async/V1/negotiable-carts/:cartId/payment-information');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
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}}/async/V1/negotiable-carts/:cartId/payment-information',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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 = @{ @"paymentMethod": @{ @"po_number": @"", @"method": @"", @"additional_data": @[ ], @"extension_attributes": @{ @"agreement_ids": @[ ] } },
@"billingAddress": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information"]
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}}/async/V1/negotiable-carts/:cartId/payment-information" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information",
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([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]),
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}}/async/V1/negotiable-carts/:cartId/payment-information', [
'body' => '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information');
$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}}/async/V1/negotiable-carts/:cartId/payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/negotiable-carts/:cartId/payment-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information"
payload = {
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": { "agreement_ids": [] }
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information"
payload <- "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/negotiable-carts/:cartId/payment-information")
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/negotiable-carts/:cartId/payment-information') do |req|
req.body = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/negotiable-carts/:cartId/payment-information";
let payload = json!({
"paymentMethod": json!({
"po_number": "",
"method": "",
"additional_data": (),
"extension_attributes": json!({"agreement_ids": ()})
}),
"billingAddress": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})
});
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}}/async/V1/negotiable-carts/:cartId/payment-information \
--header 'content-type: application/json' \
--data '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
echo '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}' | \
http POST {{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"paymentMethod": [
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": ["agreement_ids": []]
],
"billingAddress": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/negotiable-carts/:cartId/payment-information")! 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
negotiable-carts-{cartId}-set-payment-information
{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information
QUERY PARAMS
cartId
BODY json
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information");
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information" {:content-type :json
:form-params {:paymentMethod {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}
:billingAddress {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/negotiable-carts/:cartId/set-payment-information"),
Content = new StringContent("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/negotiable-carts/:cartId/set-payment-information");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information"
payload := strings.NewReader("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/negotiable-carts/:cartId/set-payment-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1069
{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information")
.setHeader("content-type", "application/json")
.setBody("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information")
.header("content-type", "application/json")
.body("{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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}}/async/V1/negotiable-carts/:cartId/set-payment-information',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information")
.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/async/V1/negotiable-carts/:cartId/set-payment-information',
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({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information',
headers: {'content-type': 'application/json'},
body: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
},
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}}/async/V1/negotiable-carts/:cartId/set-payment-information');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
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}}/async/V1/negotiable-carts/:cartId/set-payment-information',
headers: {'content-type': 'application/json'},
data: {
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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 = @{ @"paymentMethod": @{ @"po_number": @"", @"method": @"", @"additional_data": @[ ], @"extension_attributes": @{ @"agreement_ids": @[ ] } },
@"billingAddress": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information"]
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}}/async/V1/negotiable-carts/:cartId/set-payment-information" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information",
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([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]),
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}}/async/V1/negotiable-carts/:cartId/set-payment-information', [
'body' => '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information');
$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}}/async/V1/negotiable-carts/:cartId/set-payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/negotiable-carts/:cartId/set-payment-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information"
payload = {
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": { "agreement_ids": [] }
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information"
payload <- "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/negotiable-carts/:cartId/set-payment-information")
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 \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/negotiable-carts/:cartId/set-payment-information') do |req|
req.body = "{\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/negotiable-carts/:cartId/set-payment-information";
let payload = json!({
"paymentMethod": json!({
"po_number": "",
"method": "",
"additional_data": (),
"extension_attributes": json!({"agreement_ids": ()})
}),
"billingAddress": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})
});
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}}/async/V1/negotiable-carts/:cartId/set-payment-information \
--header 'content-type: application/json' \
--data '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
echo '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}' | \
http POST {{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"paymentMethod": [
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": ["agreement_ids": []]
],
"billingAddress": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/negotiable-carts/:cartId/set-payment-information")! 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
negotiable-carts-{cartId}-shipping-information
{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information
QUERY PARAMS
cartId
BODY json
{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information");
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 \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information" {:content-type :json
:form-params {:addressInformation {:shipping_address {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}
:billing_address {}
:shipping_method_code ""
:shipping_carrier_code ""
:extension_attributes {}
:custom_attributes [{}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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}}/async/V1/negotiable-carts/:cartId/shipping-information"),
Content = new StringContent("{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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}}/async/V1/negotiable-carts/:cartId/shipping-information");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information"
payload := strings.NewReader("{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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/async/V1/negotiable-carts/:cartId/shipping-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1204
{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information")
.setHeader("content-type", "application/json")
.setBody("{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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 \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information")
.header("content-type", "application/json")
.body("{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}")
.asString();
const data = JSON.stringify({
addressInformation: {
shipping_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [
{}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information',
headers: {'content-type': 'application/json'},
data: {
addressInformation: {
shipping_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"addressInformation":{"shipping_address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]},"billing_address":{},"shipping_method_code":"","shipping_carrier_code":"","extension_attributes":{},"custom_attributes":[{}]}}'
};
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}}/async/V1/negotiable-carts/:cartId/shipping-information',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "addressInformation": {\n "shipping_address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "billing_address": {},\n "shipping_method_code": "",\n "shipping_carrier_code": "",\n "extension_attributes": {},\n "custom_attributes": [\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 \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information")
.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/async/V1/negotiable-carts/:cartId/shipping-information',
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({
addressInformation: {
shipping_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information',
headers: {'content-type': 'application/json'},
body: {
addressInformation: {
shipping_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
},
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}}/async/V1/negotiable-carts/:cartId/shipping-information');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
addressInformation: {
shipping_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [
{}
]
}
});
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}}/async/V1/negotiable-carts/:cartId/shipping-information',
headers: {'content-type': 'application/json'},
data: {
addressInformation: {
shipping_address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"addressInformation":{"shipping_address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]},"billing_address":{},"shipping_method_code":"","shipping_carrier_code":"","extension_attributes":{},"custom_attributes":[{}]}}'
};
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 = @{ @"addressInformation": @{ @"shipping_address": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"billing_address": @{ }, @"shipping_method_code": @"", @"shipping_carrier_code": @"", @"extension_attributes": @{ }, @"custom_attributes": @[ @{ } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information"]
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}}/async/V1/negotiable-carts/:cartId/shipping-information" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information",
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([
'addressInformation' => [
'shipping_address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'billing_address' => [
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]),
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}}/async/V1/negotiable-carts/:cartId/shipping-information', [
'body' => '{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'addressInformation' => [
'shipping_address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'billing_address' => [
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'addressInformation' => [
'shipping_address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'billing_address' => [
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information');
$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}}/async/V1/negotiable-carts/:cartId/shipping-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\n {}\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/negotiable-carts/:cartId/shipping-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information"
payload = { "addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [{}]
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information"
payload <- "{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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}}/async/V1/negotiable-carts/:cartId/shipping-information")
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 \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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/async/V1/negotiable-carts/:cartId/shipping-information') do |req|
req.body = "{\n \"addressInformation\": {\n \"shipping_address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"billing_address\": {},\n \"shipping_method_code\": \"\",\n \"shipping_carrier_code\": \"\",\n \"extension_attributes\": {},\n \"custom_attributes\": [\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}}/async/V1/negotiable-carts/:cartId/shipping-information";
let payload = json!({"addressInformation": json!({
"shipping_address": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"billing_address": json!({}),
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": json!({}),
"custom_attributes": (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}}/async/V1/negotiable-carts/:cartId/shipping-information \
--header 'content-type: application/json' \
--data '{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
echo '{
"addressInformation": {
"shipping_address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}' | \
http POST {{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "addressInformation": {\n "shipping_address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "billing_address": {},\n "shipping_method_code": "",\n "shipping_carrier_code": "",\n "extension_attributes": {},\n "custom_attributes": [\n {}\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["addressInformation": [
"shipping_address": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
],
"billing_address": [],
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": [],
"custom_attributes": [[]]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/negotiable-carts/:cartId/shipping-information")! 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
requisition_lists
{{baseUrl}}/async/V1/requisition_lists
BODY json
{
"requisitionList": {
"id": 0,
"customer_id": 0,
"name": "",
"updated_at": "",
"description": "",
"items": [
{
"id": 0,
"sku": 0,
"requisition_list_id": 0,
"qty": "",
"options": [],
"store_id": 0,
"added_at": "",
"extension_attributes": {}
}
],
"extension_attributes": {}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/requisition_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 \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/requisition_lists" {:content-type :json
:form-params {:requisitionList {:id 0
:customer_id 0
:name ""
:updated_at ""
:description ""
:items [{:id 0
:sku 0
:requisition_list_id 0
:qty ""
:options []
:store_id 0
:added_at ""
:extension_attributes {}}]
:extension_attributes {}}}})
require "http/client"
url = "{{baseUrl}}/async/V1/requisition_lists"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\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}}/async/V1/requisition_lists"),
Content = new StringContent("{\n \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\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}}/async/V1/requisition_lists");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/requisition_lists"
payload := strings.NewReader("{\n \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\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/async/V1/requisition_lists HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 388
{
"requisitionList": {
"id": 0,
"customer_id": 0,
"name": "",
"updated_at": "",
"description": "",
"items": [
{
"id": 0,
"sku": 0,
"requisition_list_id": 0,
"qty": "",
"options": [],
"store_id": 0,
"added_at": "",
"extension_attributes": {}
}
],
"extension_attributes": {}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/requisition_lists")
.setHeader("content-type", "application/json")
.setBody("{\n \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/requisition_lists"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\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 \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/requisition_lists")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/requisition_lists")
.header("content-type", "application/json")
.body("{\n \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\n }\n}")
.asString();
const data = JSON.stringify({
requisitionList: {
id: 0,
customer_id: 0,
name: '',
updated_at: '',
description: '',
items: [
{
id: 0,
sku: 0,
requisition_list_id: 0,
qty: '',
options: [],
store_id: 0,
added_at: '',
extension_attributes: {}
}
],
extension_attributes: {}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/requisition_lists');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/requisition_lists',
headers: {'content-type': 'application/json'},
data: {
requisitionList: {
id: 0,
customer_id: 0,
name: '',
updated_at: '',
description: '',
items: [
{
id: 0,
sku: 0,
requisition_list_id: 0,
qty: '',
options: [],
store_id: 0,
added_at: '',
extension_attributes: {}
}
],
extension_attributes: {}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/requisition_lists';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"requisitionList":{"id":0,"customer_id":0,"name":"","updated_at":"","description":"","items":[{"id":0,"sku":0,"requisition_list_id":0,"qty":"","options":[],"store_id":0,"added_at":"","extension_attributes":{}}],"extension_attributes":{}}}'
};
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}}/async/V1/requisition_lists',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "requisitionList": {\n "id": 0,\n "customer_id": 0,\n "name": "",\n "updated_at": "",\n "description": "",\n "items": [\n {\n "id": 0,\n "sku": 0,\n "requisition_list_id": 0,\n "qty": "",\n "options": [],\n "store_id": 0,\n "added_at": "",\n "extension_attributes": {}\n }\n ],\n "extension_attributes": {}\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 \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/requisition_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/async/V1/requisition_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({
requisitionList: {
id: 0,
customer_id: 0,
name: '',
updated_at: '',
description: '',
items: [
{
id: 0,
sku: 0,
requisition_list_id: 0,
qty: '',
options: [],
store_id: 0,
added_at: '',
extension_attributes: {}
}
],
extension_attributes: {}
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/requisition_lists',
headers: {'content-type': 'application/json'},
body: {
requisitionList: {
id: 0,
customer_id: 0,
name: '',
updated_at: '',
description: '',
items: [
{
id: 0,
sku: 0,
requisition_list_id: 0,
qty: '',
options: [],
store_id: 0,
added_at: '',
extension_attributes: {}
}
],
extension_attributes: {}
}
},
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}}/async/V1/requisition_lists');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
requisitionList: {
id: 0,
customer_id: 0,
name: '',
updated_at: '',
description: '',
items: [
{
id: 0,
sku: 0,
requisition_list_id: 0,
qty: '',
options: [],
store_id: 0,
added_at: '',
extension_attributes: {}
}
],
extension_attributes: {}
}
});
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}}/async/V1/requisition_lists',
headers: {'content-type': 'application/json'},
data: {
requisitionList: {
id: 0,
customer_id: 0,
name: '',
updated_at: '',
description: '',
items: [
{
id: 0,
sku: 0,
requisition_list_id: 0,
qty: '',
options: [],
store_id: 0,
added_at: '',
extension_attributes: {}
}
],
extension_attributes: {}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/requisition_lists';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"requisitionList":{"id":0,"customer_id":0,"name":"","updated_at":"","description":"","items":[{"id":0,"sku":0,"requisition_list_id":0,"qty":"","options":[],"store_id":0,"added_at":"","extension_attributes":{}}],"extension_attributes":{}}}'
};
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 = @{ @"requisitionList": @{ @"id": @0, @"customer_id": @0, @"name": @"", @"updated_at": @"", @"description": @"", @"items": @[ @{ @"id": @0, @"sku": @0, @"requisition_list_id": @0, @"qty": @"", @"options": @[ ], @"store_id": @0, @"added_at": @"", @"extension_attributes": @{ } } ], @"extension_attributes": @{ } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/requisition_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}}/async/V1/requisition_lists" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/requisition_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([
'requisitionList' => [
'id' => 0,
'customer_id' => 0,
'name' => '',
'updated_at' => '',
'description' => '',
'items' => [
[
'id' => 0,
'sku' => 0,
'requisition_list_id' => 0,
'qty' => '',
'options' => [
],
'store_id' => 0,
'added_at' => '',
'extension_attributes' => [
]
]
],
'extension_attributes' => [
]
]
]),
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}}/async/V1/requisition_lists', [
'body' => '{
"requisitionList": {
"id": 0,
"customer_id": 0,
"name": "",
"updated_at": "",
"description": "",
"items": [
{
"id": 0,
"sku": 0,
"requisition_list_id": 0,
"qty": "",
"options": [],
"store_id": 0,
"added_at": "",
"extension_attributes": {}
}
],
"extension_attributes": {}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/requisition_lists');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'requisitionList' => [
'id' => 0,
'customer_id' => 0,
'name' => '',
'updated_at' => '',
'description' => '',
'items' => [
[
'id' => 0,
'sku' => 0,
'requisition_list_id' => 0,
'qty' => '',
'options' => [
],
'store_id' => 0,
'added_at' => '',
'extension_attributes' => [
]
]
],
'extension_attributes' => [
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'requisitionList' => [
'id' => 0,
'customer_id' => 0,
'name' => '',
'updated_at' => '',
'description' => '',
'items' => [
[
'id' => 0,
'sku' => 0,
'requisition_list_id' => 0,
'qty' => '',
'options' => [
],
'store_id' => 0,
'added_at' => '',
'extension_attributes' => [
]
]
],
'extension_attributes' => [
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/requisition_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}}/async/V1/requisition_lists' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"requisitionList": {
"id": 0,
"customer_id": 0,
"name": "",
"updated_at": "",
"description": "",
"items": [
{
"id": 0,
"sku": 0,
"requisition_list_id": 0,
"qty": "",
"options": [],
"store_id": 0,
"added_at": "",
"extension_attributes": {}
}
],
"extension_attributes": {}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/requisition_lists' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"requisitionList": {
"id": 0,
"customer_id": 0,
"name": "",
"updated_at": "",
"description": "",
"items": [
{
"id": 0,
"sku": 0,
"requisition_list_id": 0,
"qty": "",
"options": [],
"store_id": 0,
"added_at": "",
"extension_attributes": {}
}
],
"extension_attributes": {}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/requisition_lists", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/requisition_lists"
payload = { "requisitionList": {
"id": 0,
"customer_id": 0,
"name": "",
"updated_at": "",
"description": "",
"items": [
{
"id": 0,
"sku": 0,
"requisition_list_id": 0,
"qty": "",
"options": [],
"store_id": 0,
"added_at": "",
"extension_attributes": {}
}
],
"extension_attributes": {}
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/requisition_lists"
payload <- "{\n \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\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}}/async/V1/requisition_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 \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\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/async/V1/requisition_lists') do |req|
req.body = "{\n \"requisitionList\": {\n \"id\": 0,\n \"customer_id\": 0,\n \"name\": \"\",\n \"updated_at\": \"\",\n \"description\": \"\",\n \"items\": [\n {\n \"id\": 0,\n \"sku\": 0,\n \"requisition_list_id\": 0,\n \"qty\": \"\",\n \"options\": [],\n \"store_id\": 0,\n \"added_at\": \"\",\n \"extension_attributes\": {}\n }\n ],\n \"extension_attributes\": {}\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/requisition_lists";
let payload = json!({"requisitionList": json!({
"id": 0,
"customer_id": 0,
"name": "",
"updated_at": "",
"description": "",
"items": (
json!({
"id": 0,
"sku": 0,
"requisition_list_id": 0,
"qty": "",
"options": (),
"store_id": 0,
"added_at": "",
"extension_attributes": json!({})
})
),
"extension_attributes": 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}}/async/V1/requisition_lists \
--header 'content-type: application/json' \
--data '{
"requisitionList": {
"id": 0,
"customer_id": 0,
"name": "",
"updated_at": "",
"description": "",
"items": [
{
"id": 0,
"sku": 0,
"requisition_list_id": 0,
"qty": "",
"options": [],
"store_id": 0,
"added_at": "",
"extension_attributes": {}
}
],
"extension_attributes": {}
}
}'
echo '{
"requisitionList": {
"id": 0,
"customer_id": 0,
"name": "",
"updated_at": "",
"description": "",
"items": [
{
"id": 0,
"sku": 0,
"requisition_list_id": 0,
"qty": "",
"options": [],
"store_id": 0,
"added_at": "",
"extension_attributes": {}
}
],
"extension_attributes": {}
}
}' | \
http POST {{baseUrl}}/async/V1/requisition_lists \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "requisitionList": {\n "id": 0,\n "customer_id": 0,\n "name": "",\n "updated_at": "",\n "description": "",\n "items": [\n {\n "id": 0,\n "sku": 0,\n "requisition_list_id": 0,\n "qty": "",\n "options": [],\n "store_id": 0,\n "added_at": "",\n "extension_attributes": {}\n }\n ],\n "extension_attributes": {}\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/requisition_lists
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["requisitionList": [
"id": 0,
"customer_id": 0,
"name": "",
"updated_at": "",
"description": "",
"items": [
[
"id": 0,
"sku": 0,
"requisition_list_id": 0,
"qty": "",
"options": [],
"store_id": 0,
"added_at": "",
"extension_attributes": []
]
],
"extension_attributes": []
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/requisition_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()
POST
reward-mine-use-reward
{{baseUrl}}/async/V1/reward/mine/use-reward
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/reward/mine/use-reward");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/reward/mine/use-reward")
require "http/client"
url = "{{baseUrl}}/async/V1/reward/mine/use-reward"
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}}/async/V1/reward/mine/use-reward"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/async/V1/reward/mine/use-reward");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/reward/mine/use-reward"
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/async/V1/reward/mine/use-reward HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/reward/mine/use-reward")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/reward/mine/use-reward"))
.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}}/async/V1/reward/mine/use-reward")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/reward/mine/use-reward")
.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}}/async/V1/reward/mine/use-reward');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/reward/mine/use-reward'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/reward/mine/use-reward';
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}}/async/V1/reward/mine/use-reward',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/reward/mine/use-reward")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/async/V1/reward/mine/use-reward',
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}}/async/V1/reward/mine/use-reward'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/async/V1/reward/mine/use-reward');
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}}/async/V1/reward/mine/use-reward'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/reward/mine/use-reward';
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}}/async/V1/reward/mine/use-reward"]
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}}/async/V1/reward/mine/use-reward" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/reward/mine/use-reward",
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}}/async/V1/reward/mine/use-reward');
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/reward/mine/use-reward');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/async/V1/reward/mine/use-reward');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/async/V1/reward/mine/use-reward' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/reward/mine/use-reward' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/async/V1/reward/mine/use-reward")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/reward/mine/use-reward"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/reward/mine/use-reward"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/async/V1/reward/mine/use-reward")
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/async/V1/reward/mine/use-reward') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/async/V1/reward/mine/use-reward";
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}}/async/V1/reward/mine/use-reward
http POST {{baseUrl}}/async/V1/reward/mine/use-reward
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/async/V1/reward/mine/use-reward
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/reward/mine/use-reward")! 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
vertex-address-validation-vertex-address
{{baseUrl}}/async/V1/vertex-address-validation/vertex-address
BODY json
{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/vertex-address-validation/vertex-address");
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 \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/vertex-address-validation/vertex-address" {:content-type :json
:form-params {:address {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/vertex-address-validation/vertex-address"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/vertex-address-validation/vertex-address"),
Content = new StringContent("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/vertex-address-validation/vertex-address");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/vertex-address-validation/vertex-address"
payload := strings.NewReader("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/vertex-address-validation/vertex-address HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 908
{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/vertex-address-validation/vertex-address")
.setHeader("content-type", "application/json")
.setBody("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/vertex-address-validation/vertex-address"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/vertex-address-validation/vertex-address")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/vertex-address-validation/vertex-address")
.header("content-type", "application/json")
.body("{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/vertex-address-validation/vertex-address');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/vertex-address-validation/vertex-address',
headers: {'content-type': 'application/json'},
data: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/vertex-address-validation/vertex-address';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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}}/async/V1/vertex-address-validation/vertex-address',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\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 \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/vertex-address-validation/vertex-address")
.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/async/V1/vertex-address-validation/vertex-address',
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: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/vertex-address-validation/vertex-address',
headers: {'content-type': 'application/json'},
body: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
},
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}}/async/V1/vertex-address-validation/vertex-address');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
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}}/async/V1/vertex-address-validation/vertex-address',
headers: {'content-type': 'application/json'},
data: {
address: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/vertex-address-validation/vertex-address';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"address":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/vertex-address-validation/vertex-address"]
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}}/async/V1/vertex-address-validation/vertex-address" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/vertex-address-validation/vertex-address",
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' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]),
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}}/async/V1/vertex-address-validation/vertex-address', [
'body' => '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/vertex-address-validation/vertex-address');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'address' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/vertex-address-validation/vertex-address');
$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}}/async/V1/vertex-address-validation/vertex-address' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/vertex-address-validation/vertex-address' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/vertex-address-validation/vertex-address", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/vertex-address-validation/vertex-address"
payload = { "address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/vertex-address-validation/vertex-address"
payload <- "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/vertex-address-validation/vertex-address")
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 \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/vertex-address-validation/vertex-address') do |req|
req.body = "{\n \"address\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/vertex-address-validation/vertex-address";
let payload = json!({"address": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})});
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}}/async/V1/vertex-address-validation/vertex-address \
--header 'content-type: application/json' \
--data '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
echo '{
"address": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}' | \
http POST {{baseUrl}}/async/V1/vertex-address-validation/vertex-address \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "address": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/vertex-address-validation/vertex-address
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["address": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/vertex-address-validation/vertex-address")! 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
worldpay-guest-carts-{cartId}-payment-information
{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information
QUERY PARAMS
cartId
BODY json
{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information");
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 \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information" {:content-type :json
:form-params {:email ""
:paymentMethod {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}
:billingAddress {:id 0
:region ""
:region_id 0
:region_code ""
:country_id ""
:street []
:company ""
:telephone ""
:fax ""
:postcode ""
:city ""
:firstname ""
:lastname ""
:middlename ""
:prefix ""
:suffix ""
:vat_id ""
:customer_id 0
:email ""
:same_as_billing 0
:customer_address_id 0
:save_in_address_book 0
:extension_attributes {:discounts [{:discount_data {:amount ""
:base_amount ""
:original_amount ""
:base_original_amount ""}
:rule_label ""
:rule_id 0}]
:gift_registry_id 0}
:custom_attributes [{:attribute_code ""
:value ""}]}}})
require "http/client"
url = "{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/worldpay-guest-carts/:cartId/payment-information"),
Content = new StringContent("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/worldpay-guest-carts/:cartId/payment-information");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information"
payload := strings.NewReader("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/worldpay-guest-carts/:cartId/payment-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1084
{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information")
.setHeader("content-type", "application/json")
.setBody("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information")
.header("content-type", "application/json")
.body("{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information',
headers: {'content-type': 'application/json'},
data: {
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"email":"","paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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}}/async/V1/worldpay-guest-carts/:cartId/payment-information',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "email": "",\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\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 \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information")
.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/async/V1/worldpay-guest-carts/:cartId/payment-information',
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({
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information',
headers: {'content-type': 'application/json'},
body: {
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
},
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}}/async/V1/worldpay-guest-carts/:cartId/payment-information');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {
agreement_ids: []
}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {
amount: '',
base_amount: '',
original_amount: '',
base_original_amount: ''
},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [
{
attribute_code: '',
value: ''
}
]
}
});
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}}/async/V1/worldpay-guest-carts/:cartId/payment-information',
headers: {'content-type': 'application/json'},
data: {
email: '',
paymentMethod: {
po_number: '',
method: '',
additional_data: [],
extension_attributes: {agreement_ids: []}
},
billingAddress: {
id: 0,
region: '',
region_id: 0,
region_code: '',
country_id: '',
street: [],
company: '',
telephone: '',
fax: '',
postcode: '',
city: '',
firstname: '',
lastname: '',
middlename: '',
prefix: '',
suffix: '',
vat_id: '',
customer_id: 0,
email: '',
same_as_billing: 0,
customer_address_id: 0,
save_in_address_book: 0,
extension_attributes: {
discounts: [
{
discount_data: {amount: '', base_amount: '', original_amount: '', base_original_amount: ''},
rule_label: '',
rule_id: 0
}
],
gift_registry_id: 0
},
custom_attributes: [{attribute_code: '', value: ''}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"email":"","paymentMethod":{"po_number":"","method":"","additional_data":[],"extension_attributes":{"agreement_ids":[]}},"billingAddress":{"id":0,"region":"","region_id":0,"region_code":"","country_id":"","street":[],"company":"","telephone":"","fax":"","postcode":"","city":"","firstname":"","lastname":"","middlename":"","prefix":"","suffix":"","vat_id":"","customer_id":0,"email":"","same_as_billing":0,"customer_address_id":0,"save_in_address_book":0,"extension_attributes":{"discounts":[{"discount_data":{"amount":"","base_amount":"","original_amount":"","base_original_amount":""},"rule_label":"","rule_id":0}],"gift_registry_id":0},"custom_attributes":[{"attribute_code":"","value":""}]}}'
};
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 = @{ @"email": @"",
@"paymentMethod": @{ @"po_number": @"", @"method": @"", @"additional_data": @[ ], @"extension_attributes": @{ @"agreement_ids": @[ ] } },
@"billingAddress": @{ @"id": @0, @"region": @"", @"region_id": @0, @"region_code": @"", @"country_id": @"", @"street": @[ ], @"company": @"", @"telephone": @"", @"fax": @"", @"postcode": @"", @"city": @"", @"firstname": @"", @"lastname": @"", @"middlename": @"", @"prefix": @"", @"suffix": @"", @"vat_id": @"", @"customer_id": @0, @"email": @"", @"same_as_billing": @0, @"customer_address_id": @0, @"save_in_address_book": @0, @"extension_attributes": @{ @"discounts": @[ @{ @"discount_data": @{ @"amount": @"", @"base_amount": @"", @"original_amount": @"", @"base_original_amount": @"" }, @"rule_label": @"", @"rule_id": @0 } ], @"gift_registry_id": @0 }, @"custom_attributes": @[ @{ @"attribute_code": @"", @"value": @"" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information"]
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}}/async/V1/worldpay-guest-carts/:cartId/payment-information" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information",
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([
'email' => '',
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]),
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}}/async/V1/worldpay-guest-carts/:cartId/payment-information', [
'body' => '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'email' => '',
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'email' => '',
'paymentMethod' => [
'po_number' => '',
'method' => '',
'additional_data' => [
],
'extension_attributes' => [
'agreement_ids' => [
]
]
],
'billingAddress' => [
'id' => 0,
'region' => '',
'region_id' => 0,
'region_code' => '',
'country_id' => '',
'street' => [
],
'company' => '',
'telephone' => '',
'fax' => '',
'postcode' => '',
'city' => '',
'firstname' => '',
'lastname' => '',
'middlename' => '',
'prefix' => '',
'suffix' => '',
'vat_id' => '',
'customer_id' => 0,
'email' => '',
'same_as_billing' => 0,
'customer_address_id' => 0,
'save_in_address_book' => 0,
'extension_attributes' => [
'discounts' => [
[
'discount_data' => [
'amount' => '',
'base_amount' => '',
'original_amount' => '',
'base_original_amount' => ''
],
'rule_label' => '',
'rule_id' => 0
]
],
'gift_registry_id' => 0
],
'custom_attributes' => [
[
'attribute_code' => '',
'value' => ''
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information');
$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}}/async/V1/worldpay-guest-carts/:cartId/payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/async/V1/worldpay-guest-carts/:cartId/payment-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information"
payload = {
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": { "agreement_ids": [] }
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information"
payload <- "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/worldpay-guest-carts/:cartId/payment-information")
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 \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/async/V1/worldpay-guest-carts/:cartId/payment-information') do |req|
req.body = "{\n \"email\": \"\",\n \"paymentMethod\": {\n \"po_number\": \"\",\n \"method\": \"\",\n \"additional_data\": [],\n \"extension_attributes\": {\n \"agreement_ids\": []\n }\n },\n \"billingAddress\": {\n \"id\": 0,\n \"region\": \"\",\n \"region_id\": 0,\n \"region_code\": \"\",\n \"country_id\": \"\",\n \"street\": [],\n \"company\": \"\",\n \"telephone\": \"\",\n \"fax\": \"\",\n \"postcode\": \"\",\n \"city\": \"\",\n \"firstname\": \"\",\n \"lastname\": \"\",\n \"middlename\": \"\",\n \"prefix\": \"\",\n \"suffix\": \"\",\n \"vat_id\": \"\",\n \"customer_id\": 0,\n \"email\": \"\",\n \"same_as_billing\": 0,\n \"customer_address_id\": 0,\n \"save_in_address_book\": 0,\n \"extension_attributes\": {\n \"discounts\": [\n {\n \"discount_data\": {\n \"amount\": \"\",\n \"base_amount\": \"\",\n \"original_amount\": \"\",\n \"base_original_amount\": \"\"\n },\n \"rule_label\": \"\",\n \"rule_id\": 0\n }\n ],\n \"gift_registry_id\": 0\n },\n \"custom_attributes\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/async/V1/worldpay-guest-carts/:cartId/payment-information";
let payload = json!({
"email": "",
"paymentMethod": json!({
"po_number": "",
"method": "",
"additional_data": (),
"extension_attributes": json!({"agreement_ids": ()})
}),
"billingAddress": json!({
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": (),
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": json!({
"discounts": (
json!({
"discount_data": json!({
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
}),
"rule_label": "",
"rule_id": 0
})
),
"gift_registry_id": 0
}),
"custom_attributes": (
json!({
"attribute_code": "",
"value": ""
})
)
})
});
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}}/async/V1/worldpay-guest-carts/:cartId/payment-information \
--header 'content-type: application/json' \
--data '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}'
echo '{
"email": "",
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
},
"billingAddress": {
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": {
"discounts": [
{
"discount_data": {
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
},
"rule_label": "",
"rule_id": 0
}
],
"gift_registry_id": 0
},
"custom_attributes": [
{
"attribute_code": "",
"value": ""
}
]
}
}' | \
http POST {{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "email": "",\n "paymentMethod": {\n "po_number": "",\n "method": "",\n "additional_data": [],\n "extension_attributes": {\n "agreement_ids": []\n }\n },\n "billingAddress": {\n "id": 0,\n "region": "",\n "region_id": 0,\n "region_code": "",\n "country_id": "",\n "street": [],\n "company": "",\n "telephone": "",\n "fax": "",\n "postcode": "",\n "city": "",\n "firstname": "",\n "lastname": "",\n "middlename": "",\n "prefix": "",\n "suffix": "",\n "vat_id": "",\n "customer_id": 0,\n "email": "",\n "same_as_billing": 0,\n "customer_address_id": 0,\n "save_in_address_book": 0,\n "extension_attributes": {\n "discounts": [\n {\n "discount_data": {\n "amount": "",\n "base_amount": "",\n "original_amount": "",\n "base_original_amount": ""\n },\n "rule_label": "",\n "rule_id": 0\n }\n ],\n "gift_registry_id": 0\n },\n "custom_attributes": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"email": "",
"paymentMethod": [
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": ["agreement_ids": []]
],
"billingAddress": [
"id": 0,
"region": "",
"region_id": 0,
"region_code": "",
"country_id": "",
"street": [],
"company": "",
"telephone": "",
"fax": "",
"postcode": "",
"city": "",
"firstname": "",
"lastname": "",
"middlename": "",
"prefix": "",
"suffix": "",
"vat_id": "",
"customer_id": 0,
"email": "",
"same_as_billing": 0,
"customer_address_id": 0,
"save_in_address_book": 0,
"extension_attributes": [
"discounts": [
[
"discount_data": [
"amount": "",
"base_amount": "",
"original_amount": "",
"base_original_amount": ""
],
"rule_label": "",
"rule_id": 0
]
],
"gift_registry_id": 0
],
"custom_attributes": [
[
"attribute_code": "",
"value": ""
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/async/V1/worldpay-guest-carts/:cartId/payment-information")! 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()