Magento B2B
POST
Creates an empty cart and quote for a guest
{{baseUrl}}/V1/carts/
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/V1/carts/")
require "http/client"
url = "{{baseUrl}}/V1/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}}/V1/carts/"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/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/V1/carts/ HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/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}}/V1/carts/")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/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}}/V1/carts/');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/V1/carts/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/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}}/V1/carts/',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/carts/'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/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}}/V1/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}}/V1/carts/" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/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}}/V1/carts/');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/V1/carts/")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/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/V1/carts/') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/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}}/V1/carts/
http POST {{baseUrl}}/V1/carts/
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/V1/carts/
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/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
Assigns a specified customer to a specified shopping cart
{{baseUrl}}/V1/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}}/V1/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}}/V1/carts/:cartId" {:content-type :json
:form-params {:customerId 0
:storeId 0}})
require "http/client"
url = "{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/carts/:cartId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/V1/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}}/V1/carts/:cartId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/carts/:cartId', [
'body' => '{
"customerId": 0,
"storeId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/carts/:cartId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/carts/:cartId \
--header 'content-type: application/json' \
--data '{
"customerId": 0,
"storeId": 0
}'
echo '{
"customerId": 0,
"storeId": 0
}' | \
http PUT {{baseUrl}}/V1/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}}/V1/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}}/V1/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()
GET
Enables an administrative user to return information for a specified cart
{{baseUrl}}/V1/carts/:cartId
QUERY PARAMS
cartId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/:cartId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/:cartId")
require "http/client"
url = "{{baseUrl}}/V1/carts/:cartId"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/:cartId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/:cartId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/:cartId"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/:cartId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/:cartId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/:cartId"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/:cartId")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/:cartId');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:cartId'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/:cartId';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/:cartId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/:cartId',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:cartId'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/:cartId');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:cartId'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/:cartId';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/:cartId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/:cartId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/:cartId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/:cartId');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/:cartId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/:cartId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/:cartId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/:cartId";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/:cartId
http GET {{baseUrl}}/V1/carts/:cartId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/:cartId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/:cartId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Assigns a specified billing address to a specified cart (POST)
{{baseUrl}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"useForShipping": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"useForShipping\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/V1/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 {:gift_registry_id 0
:checkout_fields [{:attribute_code ""
:value ""}]}
:custom_attributes [{}]}
:useForShipping false}})
require "http/client"
url = "{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/:cartId/billing-address HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 714
{
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"useForShipping": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"useForShipping\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"useForShipping\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/billing-address")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
custom_attributes: [
{}
]
},
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}}/V1/carts/:cartId/billing-address');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
useForShipping: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"custom_attributes":[{}]},"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}}/V1/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"useForShipping\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/V1/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/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
useForShipping: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
custom_attributes: [
{}
]
},
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}}/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"custom_attributes":[{}]},"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": @{ @"gift_registry_id": @0, @"checkout_fields": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"custom_attributes": @[ @{ } ] },
@"useForShipping": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"useForShipping\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'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}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"useForShipping": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'useForShipping' => null
]));
$request->setRequestUrl('{{baseUrl}}/V1/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}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"useForShipping": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"useForShipping\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/V1/carts/:cartId/billing-address", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [{}]
},
"useForShipping": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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!({
"gift_registry_id": 0,
"checkout_fields": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"custom_attributes": (json!({}))
}),
"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}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"useForShipping": false
}' | \
http POST {{baseUrl}}/V1/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\n {}\n ]\n },\n "useForShipping": false\n}' \
--output-document \
- {{baseUrl}}/V1/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": [
"gift_registry_id": 0,
"checkout_fields": [
[
"attribute_code": "",
"value": ""
]
]
],
"custom_attributes": [[]]
],
"useForShipping": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/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()
GET
Returns the billing address for a specified quote (GET)
{{baseUrl}}/V1/carts/:cartId/billing-address
QUERY PARAMS
cartId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/:cartId/billing-address");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/:cartId/billing-address")
require "http/client"
url = "{{baseUrl}}/V1/carts/:cartId/billing-address"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/:cartId/billing-address"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/:cartId/billing-address");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/:cartId/billing-address"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/:cartId/billing-address HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/:cartId/billing-address")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/:cartId/billing-address"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/billing-address")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/:cartId/billing-address")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/:cartId/billing-address');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/billing-address'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/:cartId/billing-address';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/:cartId/billing-address',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/billing-address")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/:cartId/billing-address',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/billing-address'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/:cartId/billing-address');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/billing-address'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/:cartId/billing-address';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/:cartId/billing-address"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/:cartId/billing-address" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/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 => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/:cartId/billing-address');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/billing-address');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/billing-address');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/billing-address' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/billing-address' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/:cartId/billing-address")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/billing-address"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/billing-address"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/:cartId/billing-address")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/:cartId/billing-address') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/:cartId/billing-address";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/:cartId/billing-address
http GET {{baseUrl}}/V1/carts/:cartId/billing-address
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/billing-address
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/:cartId/billing-address")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Deletes a coupon from a specified cart (DELETE)
{{baseUrl}}/V1/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}}/V1/carts/:cartId/coupons");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/V1/carts/:cartId/coupons")
require "http/client"
url = "{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/carts/:cartId/coupons HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/V1/carts/:cartId/coupons")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/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}}/V1/carts/:cartId/coupons")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/V1/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}}/V1/carts/:cartId/coupons');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/V1/carts/:cartId/coupons'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/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}}/V1/carts/:cartId/coupons',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/carts/:cartId/coupons" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/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}}/V1/carts/:cartId/coupons');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/coupons');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/coupons');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/coupons' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/coupons' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/V1/carts/:cartId/coupons")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/coupons"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/coupons"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/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/V1/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}}/V1/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}}/V1/carts/:cartId/coupons
http DELETE {{baseUrl}}/V1/carts/:cartId/coupons
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/coupons
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/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()
GET
Returns information for a coupon in a specified cart (GET)
{{baseUrl}}/V1/carts/:cartId/coupons
QUERY PARAMS
cartId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/:cartId/coupons");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/:cartId/coupons")
require "http/client"
url = "{{baseUrl}}/V1/carts/:cartId/coupons"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/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}}/V1/carts/:cartId/coupons");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/:cartId/coupons"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/:cartId/coupons HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/:cartId/coupons")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/:cartId/coupons"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/coupons")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/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('GET', '{{baseUrl}}/V1/carts/:cartId/coupons');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:cartId/coupons'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/:cartId/coupons';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/:cartId/coupons',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/coupons")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/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: 'GET', url: '{{baseUrl}}/V1/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('GET', '{{baseUrl}}/V1/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: 'GET', url: '{{baseUrl}}/V1/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}}/V1/carts/:cartId/coupons';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/:cartId/coupons"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/:cartId/coupons" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/:cartId/coupons",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/:cartId/coupons');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/coupons');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/coupons');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/coupons' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/coupons' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/:cartId/coupons")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/coupons"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/coupons"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/:cartId/coupons")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/:cartId/coupons') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/:cartId/coupons";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/:cartId/coupons
http GET {{baseUrl}}/V1/carts/:cartId/coupons
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/coupons
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/:cartId/coupons")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Adds a coupon by code to a specified cart (PUT)
{{baseUrl}}/V1/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}}/V1/carts/:cartId/coupons/:couponCode");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/V1/carts/:cartId/coupons/:couponCode")
require "http/client"
url = "{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/carts/:cartId/coupons/:couponCode HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/V1/carts/:cartId/coupons/:couponCode")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/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}}/V1/carts/:cartId/coupons/:couponCode")
.put(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/V1/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}}/V1/carts/:cartId/coupons/:couponCode');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/carts/:cartId/coupons/:couponCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/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}}/V1/carts/:cartId/coupons/:couponCode',
method: 'PUT',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/carts/:cartId/coupons/:couponCode" in
Client.call `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/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}}/V1/carts/:cartId/coupons/:couponCode');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/coupons/:couponCode');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/coupons/:couponCode');
$request->setRequestMethod('PUT');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/coupons/:couponCode' -Method PUT
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/coupons/:couponCode' -Method PUT
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("PUT", "/baseUrl/V1/carts/:cartId/coupons/:couponCode")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/coupons/:couponCode"
response = requests.put(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/coupons/:couponCode"
response <- VERB("PUT", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/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/V1/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}}/V1/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}}/V1/carts/:cartId/coupons/:couponCode
http PUT {{baseUrl}}/V1/carts/:cartId/coupons/:couponCode
wget --quiet \
--method PUT \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/coupons/:couponCode
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/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
Estimates shipping by address and return list of available shipping methods (POST)
{{baseUrl}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/V1/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 {:gift_registry_id 0
:checkout_fields [{:attribute_code ""
:value ""}]}
:custom_attributes [{}]}}})
require "http/client"
url = "{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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/V1/carts/:cartId/estimate-shipping-methods HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 687
{
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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 \"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/estimate-shipping-methods")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
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}}/V1/carts/:cartId/estimate-shipping-methods');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"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}}/V1/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\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 \"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/V1/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/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
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}}/V1/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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
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}}/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
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}}/V1/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"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 = @{ @"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": @{ @"gift_registry_id": @0, @"checkout_fields": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"custom_attributes": @[ @{ } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'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}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
]
]));
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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/V1/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}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}'
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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/V1/carts/:cartId/estimate-shipping-methods", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [{}]
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/V1/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!({
"gift_registry_id": 0,
"checkout_fields": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"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}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}'
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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}' | \
http POST {{baseUrl}}/V1/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\n {}\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/V1/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": [
"gift_registry_id": 0,
"checkout_fields": [
[
"attribute_code": "",
"value": ""
]
]
],
"custom_attributes": [[]]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/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
Estimates shipping (POST)
{{baseUrl}}/V1/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}}/V1/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}}/V1/carts/:cartId/estimate-shipping-methods-by-address-id" {:content-type :json
:form-params {:addressId 0}})
require "http/client"
url = "{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/carts/:cartId/estimate-shipping-methods-by-address-id', [
'body' => '{
"addressId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/carts/:cartId/estimate-shipping-methods-by-address-id \
--header 'content-type: application/json' \
--data '{
"addressId": 0
}'
echo '{
"addressId": 0
}' | \
http POST {{baseUrl}}/V1/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}}/V1/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}}/V1/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()
GET
Returns the gift message for a specified order (GET)
{{baseUrl}}/V1/carts/:cartId/gift-message
QUERY PARAMS
cartId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/:cartId/gift-message");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/:cartId/gift-message")
require "http/client"
url = "{{baseUrl}}/V1/carts/:cartId/gift-message"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/:cartId/gift-message"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/:cartId/gift-message");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/:cartId/gift-message"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/:cartId/gift-message HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/:cartId/gift-message")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/:cartId/gift-message"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/gift-message")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/:cartId/gift-message")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/:cartId/gift-message');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/gift-message'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/:cartId/gift-message';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/:cartId/gift-message',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/gift-message")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/:cartId/gift-message',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/gift-message'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/:cartId/gift-message');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/gift-message'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/:cartId/gift-message';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/:cartId/gift-message"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/:cartId/gift-message" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/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 => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/:cartId/gift-message');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/gift-message');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/gift-message');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/gift-message' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/gift-message' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/:cartId/gift-message")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/gift-message"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/gift-message"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/:cartId/gift-message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/:cartId/gift-message') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/:cartId/gift-message";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/:cartId/gift-message
http GET {{baseUrl}}/V1/carts/:cartId/gift-message
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/gift-message
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/:cartId/gift-message")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Sets the gift message for an entire order (POST)
{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/carts/:cartId/gift-message")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/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}}/V1/carts/:cartId/gift-message');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/carts/:cartId/gift-message", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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()
GET
Returns the gift message for a specified item in a specified shopping cart (GET)
{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId
QUERY PARAMS
cartId
itemId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId")
require "http/client"
url = "{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/:cartId/gift-message/:itemId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/:cartId/gift-message/: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('GET', '{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/:cartId/gift-message/: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: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/:cartId/gift-message/: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: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/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 => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/:cartId/gift-message/:itemId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/:cartId/gift-message/:itemId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/:cartId/gift-message/:itemId
http GET {{baseUrl}}/V1/carts/:cartId/gift-message/:itemId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/gift-message/:itemId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/:cartId/gift-message/:itemId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Sets the gift message for a specified item in a specified shopping cart (POST)
{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/carts/:cartId/gift-message/:itemId")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/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}}/V1/carts/:cartId/gift-message/:itemId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/carts/:cartId/gift-message/:itemId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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()
DELETE
Removes GiftCard Account entity (1)
{{baseUrl}}/V1/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}}/V1/carts/:cartId/giftCards/:giftCardCode");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/V1/carts/:cartId/giftCards/:giftCardCode")
require "http/client"
url = "{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/carts/:cartId/giftCards/:giftCardCode HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/V1/carts/:cartId/giftCards/:giftCardCode")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/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}}/V1/carts/:cartId/giftCards/:giftCardCode")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/V1/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}}/V1/carts/:cartId/giftCards/:giftCardCode');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/V1/carts/:cartId/giftCards/:giftCardCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/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}}/V1/carts/:cartId/giftCards/:giftCardCode',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/carts/:cartId/giftCards/:giftCardCode" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/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}}/V1/carts/:cartId/giftCards/:giftCardCode');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/giftCards/:giftCardCode');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/giftCards/:giftCardCode');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/giftCards/:giftCardCode' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/giftCards/:giftCardCode' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/V1/carts/:cartId/giftCards/:giftCardCode")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/giftCards/:giftCardCode"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/giftCards/:giftCardCode"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/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/V1/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}}/V1/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}}/V1/carts/:cartId/giftCards/:giftCardCode
http DELETE {{baseUrl}}/V1/carts/:cartId/giftCards/:giftCardCode
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/giftCards/:giftCardCode
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/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()
GET
Lists items that are assigned to a specified cart (GET)
{{baseUrl}}/V1/carts/:cartId/items
QUERY PARAMS
cartId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/:cartId/items");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/:cartId/items")
require "http/client"
url = "{{baseUrl}}/V1/carts/:cartId/items"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/:cartId/items"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/:cartId/items");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/:cartId/items"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/:cartId/items HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/:cartId/items")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/:cartId/items"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/items")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/:cartId/items")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/:cartId/items');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:cartId/items'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/:cartId/items';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/:cartId/items',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/items")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/:cartId/items',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:cartId/items'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/:cartId/items');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:cartId/items'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/:cartId/items';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/:cartId/items"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/:cartId/items" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/:cartId/items",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/:cartId/items');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/items');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/items');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/items' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/items' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/:cartId/items")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/items"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/items"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/:cartId/items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/:cartId/items') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/:cartId/items";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/:cartId/items
http GET {{baseUrl}}/V1/carts/:cartId/items
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/items
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/:cartId/items")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Adds-updates the specified cart item (1)
{{baseUrl}}/V1/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": {}
}
}
},
"extension_attributes": {
"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}}/V1/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/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 {}}}}
:extension_attributes {:negotiable_quote_item {:item_id 0
:original_price ""
:original_tax_amount ""
:original_discount_amount ""
:extension_attributes {}}}}}})
require "http/client"
url = "{{baseUrl}}/V1/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/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 }\n }\n },\n \"extension_attributes\": {\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/V1/carts/:cartId/items/:itemId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1573
{
"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": {}
}
}
},
"extension_attributes": {
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/V1/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/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 }\n }\n },\n \"extension_attributes\": {\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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/:cartId/items/:itemId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/V1/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 }\n }\n },\n \"extension_attributes\": {\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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/:cartId/items/:itemId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/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: {}
}
}
},
extension_attributes: {
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}}/V1/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":{}}}},"extension_attributes":{"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}}/V1/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 }\n }\n },\n "extension_attributes": {\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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/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/V1/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: {}
}
}
},
extension_attributes: {
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}}/V1/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: {}
}
}
},
extension_attributes: {
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}}/V1/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: {}
}
}
},
extension_attributes: {
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}}/V1/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: {}
}
}
},
extension_attributes: {
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}}/V1/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":{}}}},"extension_attributes":{"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": @{ } } } }, @"extension_attributes": @{ @"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}}/V1/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}}/V1/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/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' => [
]
]
]
],
'extension_attributes' => [
'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}}/V1/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": {}
}
}
},
"extension_attributes": {
"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}}/V1/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' => [
]
]
]
],
'extension_attributes' => [
'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' => [
]
]
]
],
'extension_attributes' => [
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/V1/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}}/V1/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": {}
}
}
},
"extension_attributes": {
"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}}/V1/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": {}
}
}
},
"extension_attributes": {
"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 }\n }\n },\n \"extension_attributes\": {\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/V1/carts/:cartId/items/:itemId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/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": {}
}
} },
"extension_attributes": { "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}}/V1/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/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 }\n }\n },\n \"extension_attributes\": {\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/V1/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/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!({})
})
})}),
"extension_attributes": json!({"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}}/V1/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": {}
}
}
},
"extension_attributes": {
"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": {}
}
}
},
"extension_attributes": {
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}' | \
http PUT {{baseUrl}}/V1/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 }\n }\n },\n "extension_attributes": {\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}}/V1/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": []
]
]],
"extension_attributes": ["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}}/V1/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()
DELETE
Removes the specified item from the specified cart (DELETE)
{{baseUrl}}/V1/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}}/V1/carts/:cartId/items/:itemId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/V1/carts/:cartId/items/:itemId")
require "http/client"
url = "{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/carts/:cartId/items/:itemId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/V1/carts/:cartId/items/:itemId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/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}}/V1/carts/:cartId/items/:itemId")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/V1/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}}/V1/carts/:cartId/items/:itemId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/V1/carts/:cartId/items/:itemId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/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}}/V1/carts/:cartId/items/:itemId',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/carts/:cartId/items/:itemId" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/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}}/V1/carts/:cartId/items/:itemId');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/items/:itemId');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/items/:itemId');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/items/:itemId' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/items/:itemId' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/V1/carts/:cartId/items/:itemId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/items/:itemId"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/items/:itemId"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/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/V1/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}}/V1/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}}/V1/carts/:cartId/items/:itemId
http DELETE {{baseUrl}}/V1/carts/:cartId/items/:itemId
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/items/:itemId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/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
Places an order for a specified cart (PUT)
{{baseUrl}}/V1/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}}/V1/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}}/V1/carts/:cartId/order" {:content-type :json
:form-params {:paymentMethod {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}}})
require "http/client"
url = "{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/carts/:cartId/order")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/V1/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}}/V1/carts/:cartId/order');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/carts/:cartId/order', [
'body' => '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/carts/:cartId/order", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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()
GET
Lists available payment methods for a specified shopping cart (GET)
{{baseUrl}}/V1/carts/:cartId/payment-methods
QUERY PARAMS
cartId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/:cartId/payment-methods");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/:cartId/payment-methods")
require "http/client"
url = "{{baseUrl}}/V1/carts/:cartId/payment-methods"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/:cartId/payment-methods"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/:cartId/payment-methods");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/:cartId/payment-methods"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/:cartId/payment-methods HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/:cartId/payment-methods")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/:cartId/payment-methods"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/payment-methods")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/:cartId/payment-methods")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/:cartId/payment-methods');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/payment-methods'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/:cartId/payment-methods';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/:cartId/payment-methods',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/payment-methods")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/:cartId/payment-methods',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/payment-methods'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/:cartId/payment-methods');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/payment-methods'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/:cartId/payment-methods';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/:cartId/payment-methods"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/:cartId/payment-methods" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/:cartId/payment-methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/:cartId/payment-methods');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/payment-methods');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/payment-methods');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/payment-methods' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/payment-methods' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/:cartId/payment-methods")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/payment-methods"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/payment-methods"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/:cartId/payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/:cartId/payment-methods') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/:cartId/payment-methods";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/:cartId/payment-methods
http GET {{baseUrl}}/V1/carts/:cartId/payment-methods
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/payment-methods
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/:cartId/payment-methods")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Adds a specified payment method to a specified shopping cart (PUT)
{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/carts/:cartId/selected-payment-method")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/V1/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}}/V1/carts/:cartId/selected-payment-method');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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/V1/carts/:cartId/selected-payment-method", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/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}}/V1/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}}/V1/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/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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}}/V1/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()
GET
Returns the payment method for a specified shopping cart (GET)
{{baseUrl}}/V1/carts/:cartId/selected-payment-method
QUERY PARAMS
cartId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/:cartId/selected-payment-method");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/:cartId/selected-payment-method")
require "http/client"
url = "{{baseUrl}}/V1/carts/:cartId/selected-payment-method"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/:cartId/selected-payment-method"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/:cartId/selected-payment-method");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/:cartId/selected-payment-method"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/:cartId/selected-payment-method HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/:cartId/selected-payment-method")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/:cartId/selected-payment-method"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/selected-payment-method")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/:cartId/selected-payment-method")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/:cartId/selected-payment-method');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/selected-payment-method'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/:cartId/selected-payment-method';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/:cartId/selected-payment-method',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/selected-payment-method")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/:cartId/selected-payment-method',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/selected-payment-method'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/:cartId/selected-payment-method');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/selected-payment-method'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/:cartId/selected-payment-method';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/:cartId/selected-payment-method"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/:cartId/selected-payment-method" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/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 => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/:cartId/selected-payment-method');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/selected-payment-method');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/selected-payment-method');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/selected-payment-method' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/selected-payment-method' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/:cartId/selected-payment-method")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/selected-payment-method"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/selected-payment-method"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/:cartId/selected-payment-method")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/:cartId/selected-payment-method') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/:cartId/selected-payment-method";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/:cartId/selected-payment-method
http GET {{baseUrl}}/V1/carts/:cartId/selected-payment-method
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/selected-payment-method
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/:cartId/selected-payment-method")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
checks out Shipping Information By ID
{{baseUrl}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 {:gift_registry_id 0
:checkout_fields [{:attribute_code ""
:value ""}]}
:custom_attributes [{}]}
:billing_address {}
:shipping_method_code ""
:shipping_carrier_code ""
:extension_attributes {}
:custom_attributes [{}]}}})
require "http/client"
url = "{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/:cartId/shipping-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 965
{
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/:cartId/shipping-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
custom_attributes: [
{}
]
},
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}}/V1/carts/:cartId/shipping-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"custom_attributes":[{}]},"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}}/V1/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
custom_attributes: [
{}
]
},
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}}/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"custom_attributes":[{}]},"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": @{ @"gift_registry_id": @0, @"checkout_fields": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"custom_attributes": @[ @{ } ] }, @"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}}/V1/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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'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}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'billing_address' => [
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/V1/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}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/:cartId/shipping-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [{}]
},
"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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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!({
"gift_registry_id": 0,
"checkout_fields": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"custom_attributes": (json!({}))
}),
"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}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}' | \
http POST {{baseUrl}}/V1/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\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}}/V1/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": [
"gift_registry_id": 0,
"checkout_fields": [
[
"attribute_code": "",
"value": ""
]
]
],
"custom_attributes": [[]]
],
"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}}/V1/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()
GET
Lists applicable shipping methods for a specified quote (GET)
{{baseUrl}}/V1/carts/:cartId/shipping-methods
QUERY PARAMS
cartId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/:cartId/shipping-methods");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/:cartId/shipping-methods")
require "http/client"
url = "{{baseUrl}}/V1/carts/:cartId/shipping-methods"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/:cartId/shipping-methods"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/:cartId/shipping-methods");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/:cartId/shipping-methods"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/:cartId/shipping-methods HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/:cartId/shipping-methods")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/:cartId/shipping-methods"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/shipping-methods")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/:cartId/shipping-methods")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/:cartId/shipping-methods');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/shipping-methods'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/:cartId/shipping-methods';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/:cartId/shipping-methods',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/shipping-methods")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/:cartId/shipping-methods',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/shipping-methods'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/:cartId/shipping-methods');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/:cartId/shipping-methods'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/:cartId/shipping-methods';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/:cartId/shipping-methods"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/:cartId/shipping-methods" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/:cartId/shipping-methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/:cartId/shipping-methods');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/shipping-methods');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/shipping-methods');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/shipping-methods' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/shipping-methods' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/:cartId/shipping-methods")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/shipping-methods"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/shipping-methods"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/:cartId/shipping-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/:cartId/shipping-methods') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/:cartId/shipping-methods";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/:cartId/shipping-methods
http GET {{baseUrl}}/V1/carts/:cartId/shipping-methods
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/shipping-methods
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/:cartId/shipping-methods")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Returns quote totals data for a specified cart (GET)
{{baseUrl}}/V1/carts/:cartId/totals
QUERY PARAMS
cartId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/:cartId/totals");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/:cartId/totals")
require "http/client"
url = "{{baseUrl}}/V1/carts/:cartId/totals"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/:cartId/totals"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/:cartId/totals");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/:cartId/totals"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/:cartId/totals HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/:cartId/totals")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/:cartId/totals"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/totals")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/:cartId/totals")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/:cartId/totals');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:cartId/totals'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/:cartId/totals';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/:cartId/totals',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/:cartId/totals")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/:cartId/totals',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:cartId/totals'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/:cartId/totals');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:cartId/totals'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/:cartId/totals';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/:cartId/totals"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/:cartId/totals" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/:cartId/totals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/:cartId/totals');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:cartId/totals');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:cartId/totals');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:cartId/totals' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:cartId/totals' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/:cartId/totals")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:cartId/totals"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:cartId/totals"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/:cartId/totals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/:cartId/totals') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/:cartId/totals";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/:cartId/totals
http GET {{baseUrl}}/V1/carts/:cartId/totals
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/:cartId/totals
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/:cartId/totals")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Calculates quote totals based on address and shipping method (POST)
{{baseUrl}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 {:gift_registry_id 0
:checkout_fields [{:attribute_code ""
:value ""}]}
:custom_attributes [{}]}
:shipping_method_code ""
:shipping_carrier_code ""
:extension_attributes {}
:custom_attributes [{}]}}})
require "http/client"
url = "{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/:cartId/totals-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 929
{
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/:cartId/totals-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
custom_attributes: [
{}
]
},
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}}/V1/carts/:cartId/totals-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"custom_attributes":[{}]},"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}}/V1/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
custom_attributes: [
{}
]
},
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}}/V1/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"custom_attributes":[{}]},"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": @{ @"gift_registry_id": @0, @"checkout_fields": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"custom_attributes": @[ @{ } ] }, @"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}}/V1/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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'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}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/V1/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}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/:cartId/totals-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [{}]
},
"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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/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!({
"gift_registry_id": 0,
"checkout_fields": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"custom_attributes": (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}}/V1/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}' | \
http POST {{baseUrl}}/V1/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\n {}\n ]\n },\n "shipping_method_code": "",\n "shipping_carrier_code": "",\n "extension_attributes": {},\n "custom_attributes": [\n {}\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/V1/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": [
"gift_registry_id": 0,
"checkout_fields": [
[
"attribute_code": "",
"value": ""
]
]
],
"custom_attributes": [[]]
],
"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}}/V1/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()
GET
Returns GiftCard Account cards
{{baseUrl}}/V1/carts/:quoteId/giftCards
QUERY PARAMS
quoteId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/:quoteId/giftCards");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/:quoteId/giftCards")
require "http/client"
url = "{{baseUrl}}/V1/carts/:quoteId/giftCards"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/:quoteId/giftCards"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/:quoteId/giftCards");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/:quoteId/giftCards"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/:quoteId/giftCards HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/:quoteId/giftCards")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/:quoteId/giftCards"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/:quoteId/giftCards")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/:quoteId/giftCards")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/:quoteId/giftCards');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:quoteId/giftCards'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/:quoteId/giftCards';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/:quoteId/giftCards',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/:quoteId/giftCards")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/:quoteId/giftCards',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:quoteId/giftCards'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/:quoteId/giftCards');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/:quoteId/giftCards'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/:quoteId/giftCards';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/:quoteId/giftCards"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/:quoteId/giftCards" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/:quoteId/giftCards",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/:quoteId/giftCards');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/:quoteId/giftCards');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/:quoteId/giftCards');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/:quoteId/giftCards' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/:quoteId/giftCards' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/:quoteId/giftCards")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:quoteId/giftCards"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/:quoteId/giftCards"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/:quoteId/giftCards")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/:quoteId/giftCards') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/:quoteId/giftCards";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/:quoteId/giftCards
http GET {{baseUrl}}/V1/carts/:quoteId/giftCards
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/:quoteId/giftCards
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/:quoteId/giftCards")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Adds-updates the specified cart item (POST)
{{baseUrl}}/V1/carts/:quoteId/items
QUERY PARAMS
quoteId
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": {}
}
}
},
"extension_attributes": {
"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}}/V1/carts/:quoteId/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/:quoteId/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 {}}}}
:extension_attributes {:negotiable_quote_item {:item_id 0
:original_price ""
:original_tax_amount ""
:original_discount_amount ""
:extension_attributes {}}}}}})
require "http/client"
url = "{{baseUrl}}/V1/carts/:quoteId/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/:quoteId/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/:quoteId/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/:quoteId/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 }\n }\n },\n \"extension_attributes\": {\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/V1/carts/:quoteId/items HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1573
{
"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": {}
}
}
},
"extension_attributes": {
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/:quoteId/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/:quoteId/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 }\n }\n },\n \"extension_attributes\": {\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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/:quoteId/items")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/:quoteId/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 }\n }\n },\n \"extension_attributes\": {\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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/:quoteId/items');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/:quoteId/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/:quoteId/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":{}}}},"extension_attributes":{"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}}/V1/carts/:quoteId/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 }\n }\n },\n "extension_attributes": {\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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/:quoteId/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/V1/carts/:quoteId/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/:quoteId/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/:quoteId/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/:quoteId/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/:quoteId/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":{}}}},"extension_attributes":{"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": @{ } } } }, @"extension_attributes": @{ @"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}}/V1/carts/:quoteId/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}}/V1/carts/:quoteId/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/:quoteId/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' => [
]
]
]
],
'extension_attributes' => [
'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}}/V1/carts/:quoteId/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": {}
}
}
},
"extension_attributes": {
"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}}/V1/carts/:quoteId/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' => [
]
]
]
],
'extension_attributes' => [
'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' => [
]
]
]
],
'extension_attributes' => [
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/V1/carts/:quoteId/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}}/V1/carts/:quoteId/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": {}
}
}
},
"extension_attributes": {
"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}}/V1/carts/:quoteId/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": {}
}
}
},
"extension_attributes": {
"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 }\n }\n },\n \"extension_attributes\": {\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/V1/carts/:quoteId/items", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/:quoteId/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": {}
}
} },
"extension_attributes": { "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}}/V1/carts/:quoteId/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/:quoteId/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 }\n }\n },\n \"extension_attributes\": {\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/V1/carts/:quoteId/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/:quoteId/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!({})
})
})}),
"extension_attributes": json!({"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}}/V1/carts/:quoteId/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": {}
}
}
},
"extension_attributes": {
"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": {}
}
}
},
"extension_attributes": {
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}' | \
http POST {{baseUrl}}/V1/carts/:quoteId/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 }\n }\n },\n "extension_attributes": {\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}}/V1/carts/:quoteId/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": []
]
]],
"extension_attributes": ["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}}/V1/carts/:quoteId/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()
GET
Checks gift card balance if added to the cart
{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode
QUERY PARAMS
cartId
giftCardCode
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode")
require "http/client"
url = "{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/: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('GET', '{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/guest-carts/:cartId/checkGiftCard/: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: 'GET',
url: '{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/: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: 'GET',
url: '{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode
http GET {{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/guest-carts/:cartId/checkGiftCard/:giftCardCode")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Adds gift card to the cart
{{baseUrl}}/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}}/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}}/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}}/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}}/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}}/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}}/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/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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/V1/carts/guest-carts/:cartId/giftCards", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/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}}/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}}/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/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}}/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}}/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}}/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}}/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}}/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
Removes GiftCard Account entity
{{baseUrl}}/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}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode")
require "http/client"
url = "{{baseUrl}}/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}}/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}}/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}}/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/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/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}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/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}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/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}}/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}}/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}}/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/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}}/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}}/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}}/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}}/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}}/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}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/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}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode');
echo $response->getBody();
setUrl('{{baseUrl}}/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}}/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}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/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}}/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/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}}/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}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode
http DELETE {{baseUrl}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/V1/carts/guest-carts/:cartId/giftCards/:giftCardCode
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/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()
GET
Lists active checkout agreements.
{{baseUrl}}/V1/carts/licence
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/licence");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/licence")
require "http/client"
url = "{{baseUrl}}/V1/carts/licence"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/licence"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/licence");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/licence"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/licence HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/licence")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/licence"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/licence")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/licence")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/licence');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/licence'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/licence';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/licence',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/licence")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/licence',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/licence'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/licence');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/licence'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/licence';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/licence"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/licence" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/licence",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/licence');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/licence');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/licence');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/licence' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/licence' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/licence")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/licence"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/licence"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/licence")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/licence') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/licence";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/licence
http GET {{baseUrl}}/V1/carts/licence
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/licence
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/licence")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Creates an empty cart and quote for a specified customer if customer does not have a cart yet.
{{baseUrl}}/V1/carts/mine
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/V1/carts/mine")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine"
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}}/V1/carts/mine"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine"
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/V1/carts/mine HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/mine")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine"))
.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}}/V1/carts/mine")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine")
.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}}/V1/carts/mine');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/V1/carts/mine'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine';
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}}/V1/carts/mine',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine',
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}}/V1/carts/mine'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/V1/carts/mine');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'POST', url: '{{baseUrl}}/V1/carts/mine'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine';
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}}/V1/carts/mine"]
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}}/V1/carts/mine" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine",
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}}/V1/carts/mine');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/V1/carts/mine")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine")
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/V1/carts/mine') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine";
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}}/V1/carts/mine
http POST {{baseUrl}}/V1/carts/mine
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/V1/carts/mine
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine")! 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()
GET
Returns information for the cart for a specified customer
{{baseUrl}}/V1/carts/mine
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/mine');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine
http GET {{baseUrl}}/V1/carts/mine
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Saves quote
{{baseUrl}}/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": {}
}
}
},
"extension_attributes": {
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{}
]
},
"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": ""
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/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 {}}}}
:extension_attributes {: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 {:gift_registry_id 0
:checkout_fields [{}]}
: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 ""}}}})
require "http/client"
url = "{{baseUrl}}/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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\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}}/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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\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}}/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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\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/V1/carts/mine HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 6133
{
"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": {}
}
}
},
"extension_attributes": {
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{}
]
},
"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": ""
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\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: {}
}
}
},
extension_attributes: {
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: {
gift_registry_id: 0,
checkout_fields: [
{}
]
},
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: ''
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/V1/carts/mine');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/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: {}
}
}
},
extension_attributes: {
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: {gift_registry_id: 0, checkout_fields: [{}]},
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: ''
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/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":{}}}},"extension_attributes":{"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":{"gift_registry_id":0,"checkout_fields":[{}]},"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":""}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/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 }\n }\n },\n "extension_attributes": {\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 "gift_registry_id": 0,\n "checkout_fields": [\n {}\n ]\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 }\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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/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/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: {}
}
}
},
extension_attributes: {
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: {gift_registry_id: 0, checkout_fields: [{}]},
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: ''
}
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/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: {}
}
}
},
extension_attributes: {
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: {gift_registry_id: 0, checkout_fields: [{}]},
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: ''
}
}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/V1/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: {}
}
}
},
extension_attributes: {
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: {
gift_registry_id: 0,
checkout_fields: [
{}
]
},
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: ''
}
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/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: {}
}
}
},
extension_attributes: {
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: {gift_registry_id: 0, checkout_fields: [{}]},
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: ''
}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/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":{}}}},"extension_attributes":{"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":{"gift_registry_id":0,"checkout_fields":[{}]},"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":""}}}'
};
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": @{ } } } }, @"extension_attributes": @{ @"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": @{ @"gift_registry_id": @0, @"checkout_fields": @[ @{ } ] }, @"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": @"" } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/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}}/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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/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' => [
]
]
]
],
'extension_attributes' => [
'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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
]
]
],
'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' => ''
]
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/V1/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": {}
}
}
},
"extension_attributes": {
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{}
]
},
"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": ""
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/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' => [
]
]
]
],
'extension_attributes' => [
'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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
]
]
],
'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' => ''
]
]
]));
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' => [
]
]
]
],
'extension_attributes' => [
'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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
]
]
],
'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' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/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}}/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": {}
}
}
},
"extension_attributes": {
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{}
]
},
"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": ""
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/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": {}
}
}
},
"extension_attributes": {
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{}
]
},
"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": ""
}
}
}'
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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/V1/carts/mine", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/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": {}
}
} },
"extension_attributes": { "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": {
"gift_registry_id": 0,
"checkout_fields": [{}]
},
"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": ""
}
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\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}}/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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\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/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 }\n }\n },\n \"extension_attributes\": {\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {}\n ]\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 }\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}}/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!({})
})
})}),
"extension_attributes": json!({"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!({
"gift_registry_id": 0,
"checkout_fields": (json!({}))
}),
"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": ""
})
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/V1/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": {}
}
}
},
"extension_attributes": {
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{}
]
},
"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": ""
}
}
}'
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": {}
}
}
},
"extension_attributes": {
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{}
]
},
"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": ""
}
}
}' | \
http PUT {{baseUrl}}/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 }\n }\n },\n "extension_attributes": {\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 "gift_registry_id": 0,\n "checkout_fields": [\n {}\n ]\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 }\n }\n}' \
--output-document \
- {{baseUrl}}/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": []
]
]],
"extension_attributes": ["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": [
"gift_registry_id": 0,
"checkout_fields": [[]]
],
"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": ""
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/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
Applies store credit
{{baseUrl}}/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}}/V1/carts/mine/balance/apply");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/V1/carts/mine/balance/apply")
require "http/client"
url = "{{baseUrl}}/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}}/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}}/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}}/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/V1/carts/mine/balance/apply HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/mine/balance/apply")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/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}}/V1/carts/mine/balance/apply")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/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}}/V1/carts/mine/balance/apply');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/V1/carts/mine/balance/apply'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/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}}/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}}/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/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}}/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}}/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}}/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}}/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}}/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}}/V1/carts/mine/balance/apply" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/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}}/V1/carts/mine/balance/apply');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/balance/apply');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/balance/apply');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/balance/apply' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/balance/apply' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/V1/carts/mine/balance/apply")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/balance/apply"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/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}}/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/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}}/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}}/V1/carts/mine/balance/apply
http POST {{baseUrl}}/V1/carts/mine/balance/apply
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/V1/carts/mine/balance/apply
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/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()
POST
Unapplies store credit.
{{baseUrl}}/V1/carts/mine/balance/unapply
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/balance/unapply");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/V1/carts/mine/balance/unapply")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/balance/unapply"
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}}/V1/carts/mine/balance/unapply"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/balance/unapply");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/balance/unapply"
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/V1/carts/mine/balance/unapply HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/mine/balance/unapply")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/balance/unapply"))
.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}}/V1/carts/mine/balance/unapply")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine/balance/unapply")
.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}}/V1/carts/mine/balance/unapply');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/balance/unapply'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/balance/unapply';
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}}/V1/carts/mine/balance/unapply',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/balance/unapply")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/balance/unapply',
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}}/V1/carts/mine/balance/unapply'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/V1/carts/mine/balance/unapply');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/balance/unapply'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/balance/unapply';
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}}/V1/carts/mine/balance/unapply"]
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}}/V1/carts/mine/balance/unapply" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/balance/unapply",
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}}/V1/carts/mine/balance/unapply');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/balance/unapply');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/balance/unapply');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/balance/unapply' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/balance/unapply' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/V1/carts/mine/balance/unapply")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/balance/unapply"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/balance/unapply"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/balance/unapply")
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/V1/carts/mine/balance/unapply') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/balance/unapply";
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}}/V1/carts/mine/balance/unapply
http POST {{baseUrl}}/V1/carts/mine/balance/unapply
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/V1/carts/mine/balance/unapply
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/balance/unapply")! 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
Assigns a specified billing address to a specified cart
{{baseUrl}}/V1/carts/mine/billing-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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"useForShipping": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"useForShipping\": false\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/V1/carts/mine/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 {:gift_registry_id 0
:checkout_fields [{:attribute_code ""
:value ""}]}
:custom_attributes [{}]}
:useForShipping false}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/mine/billing-address HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 714
{
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"useForShipping": false
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"useForShipping\": false\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"useForShipping\": false\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/billing-address")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
custom_attributes: [
{}
]
},
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}}/V1/carts/mine/billing-address');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
useForShipping: false
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"custom_attributes":[{}]},"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}}/V1/carts/mine/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"useForShipping\": false\n}")
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
useForShipping: false
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/carts/mine/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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
custom_attributes: [
{}
]
},
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}}/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/carts/mine/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"custom_attributes":[{}]},"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": @{ @"gift_registry_id": @0, @"checkout_fields": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"custom_attributes": @[ @{ } ] },
@"useForShipping": @NO };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"useForShipping\": false\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'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}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"useForShipping": false
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'useForShipping' => null
]));
$request->setRequestUrl('{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"useForShipping": false
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n },\n \"useForShipping\": false\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/V1/carts/mine/billing-address", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [{}]
},
"useForShipping": False
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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!({
"gift_registry_id": 0,
"checkout_fields": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"custom_attributes": (json!({}))
}),
"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}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"useForShipping": false
}' | \
http POST {{baseUrl}}/V1/carts/mine/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\n {}\n ]\n },\n "useForShipping": false\n}' \
--output-document \
- {{baseUrl}}/V1/carts/mine/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": [
"gift_registry_id": 0,
"checkout_fields": [
[
"attribute_code": "",
"value": ""
]
]
],
"custom_attributes": [[]]
],
"useForShipping": false
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/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()
GET
Returns the billing address for a specified quote
{{baseUrl}}/V1/carts/mine/billing-address
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/billing-address");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine/billing-address")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/billing-address"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/billing-address"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/billing-address");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/billing-address"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine/billing-address HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine/billing-address")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/billing-address"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/billing-address")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine/billing-address")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/mine/billing-address');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/billing-address'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/billing-address';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/billing-address',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/billing-address")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/billing-address',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/billing-address'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine/billing-address');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/billing-address'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/billing-address';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/billing-address"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/billing-address" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/billing-address",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine/billing-address');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/billing-address');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/billing-address');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/billing-address' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/billing-address' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine/billing-address")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/billing-address"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/billing-address"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/billing-address")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine/billing-address') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/billing-address";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine/billing-address
http GET {{baseUrl}}/V1/carts/mine/billing-address
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine/billing-address
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/billing-address")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Checks gift card balance if applied to given cart
{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode
QUERY PARAMS
giftCardCode
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine/checkGiftCard/:giftCardCode HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine/checkGiftCard/: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('GET', '{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/checkGiftCard/: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: 'GET',
url: '{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine/checkGiftCard/: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: 'GET',
url: '{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine/checkGiftCard/:giftCardCode")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine/checkGiftCard/:giftCardCode') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode
http GET {{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/checkGiftCard/:giftCardCode")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Saves Checkout Fields
{{baseUrl}}/V1/carts/mine/checkout-fields
BODY json
{
"serviceSelection": [
{
"attribute_code": "",
"value": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/checkout-fields");
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 \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/V1/carts/mine/checkout-fields" {:content-type :json
:form-params {:serviceSelection [{:attribute_code ""
:value ""}]}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/checkout-fields"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/V1/carts/mine/checkout-fields"),
Content = new StringContent("{\n \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/V1/carts/mine/checkout-fields");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/checkout-fields"
payload := strings.NewReader("{\n \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/V1/carts/mine/checkout-fields HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 89
{
"serviceSelection": [
{
"attribute_code": "",
"value": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/mine/checkout-fields")
.setHeader("content-type", "application/json")
.setBody("{\n \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/checkout-fields"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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 \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/checkout-fields")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine/checkout-fields")
.header("content-type", "application/json")
.body("{\n \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
serviceSelection: [
{
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}}/V1/carts/mine/checkout-fields');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/checkout-fields',
headers: {'content-type': 'application/json'},
data: {serviceSelection: [{attribute_code: '', value: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/checkout-fields';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"serviceSelection":[{"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}}/V1/carts/mine/checkout-fields',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "serviceSelection": [\n {\n "attribute_code": "",\n "value": ""\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 \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/checkout-fields")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/checkout-fields',
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({serviceSelection: [{attribute_code: '', value: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/checkout-fields',
headers: {'content-type': 'application/json'},
body: {serviceSelection: [{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}}/V1/carts/mine/checkout-fields');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
serviceSelection: [
{
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}}/V1/carts/mine/checkout-fields',
headers: {'content-type': 'application/json'},
data: {serviceSelection: [{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}}/V1/carts/mine/checkout-fields';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"serviceSelection":[{"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 = @{ @"serviceSelection": @[ @{ @"attribute_code": @"", @"value": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/checkout-fields"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/checkout-fields" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/checkout-fields",
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([
'serviceSelection' => [
[
'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}}/V1/carts/mine/checkout-fields', [
'body' => '{
"serviceSelection": [
{
"attribute_code": "",
"value": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/checkout-fields');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'serviceSelection' => [
[
'attribute_code' => '',
'value' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'serviceSelection' => [
[
'attribute_code' => '',
'value' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/V1/carts/mine/checkout-fields');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/checkout-fields' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"serviceSelection": [
{
"attribute_code": "",
"value": ""
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/checkout-fields' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"serviceSelection": [
{
"attribute_code": "",
"value": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/V1/carts/mine/checkout-fields", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/checkout-fields"
payload = { "serviceSelection": [
{
"attribute_code": "",
"value": ""
}
] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/checkout-fields"
payload <- "{\n \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/V1/carts/mine/checkout-fields")
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 \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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/V1/carts/mine/checkout-fields') do |req|
req.body = "{\n \"serviceSelection\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\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}}/V1/carts/mine/checkout-fields";
let payload = json!({"serviceSelection": (
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}}/V1/carts/mine/checkout-fields \
--header 'content-type: application/json' \
--data '{
"serviceSelection": [
{
"attribute_code": "",
"value": ""
}
]
}'
echo '{
"serviceSelection": [
{
"attribute_code": "",
"value": ""
}
]
}' | \
http POST {{baseUrl}}/V1/carts/mine/checkout-fields \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "serviceSelection": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/V1/carts/mine/checkout-fields
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["serviceSelection": [
[
"attribute_code": "",
"value": ""
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/checkout-fields")! 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
Sets shipping-billing methods and additional data for cart and collect totals.
{{baseUrl}}/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}}/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}}/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}}/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}}/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}}/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}}/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/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}}/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}}/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}}/V1/carts/mine/collect-totals")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/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}}/V1/carts/mine/collect-totals');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/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}}/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}}/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}}/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/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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}}/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/V1/carts/mine/collect-totals", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/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}}/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}}/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/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}}/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}}/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}}/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}}/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}}/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()
DELETE
Deletes cart collection point search request
{{baseUrl}}/V1/carts/mine/collection-point/search-request
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/collection-point/search-request");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/V1/carts/mine/collection-point/search-request")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/collection-point/search-request"
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}}/V1/carts/mine/collection-point/search-request"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/collection-point/search-request");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/collection-point/search-request"
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/V1/carts/mine/collection-point/search-request HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/V1/carts/mine/collection-point/search-request")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/collection-point/search-request"))
.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}}/V1/carts/mine/collection-point/search-request")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/V1/carts/mine/collection-point/search-request")
.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}}/V1/carts/mine/collection-point/search-request');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/V1/carts/mine/collection-point/search-request'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/collection-point/search-request';
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}}/V1/carts/mine/collection-point/search-request',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/collection-point/search-request")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/collection-point/search-request',
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}}/V1/carts/mine/collection-point/search-request'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/V1/carts/mine/collection-point/search-request');
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}}/V1/carts/mine/collection-point/search-request'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/collection-point/search-request';
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}}/V1/carts/mine/collection-point/search-request"]
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}}/V1/carts/mine/collection-point/search-request" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/collection-point/search-request",
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}}/V1/carts/mine/collection-point/search-request');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/collection-point/search-request');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/collection-point/search-request');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/collection-point/search-request' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/collection-point/search-request' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/V1/carts/mine/collection-point/search-request")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/collection-point/search-request"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/collection-point/search-request"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/collection-point/search-request")
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/V1/carts/mine/collection-point/search-request') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/collection-point/search-request";
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}}/V1/carts/mine/collection-point/search-request
http DELETE {{baseUrl}}/V1/carts/mine/collection-point/search-request
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/V1/carts/mine/collection-point/search-request
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/collection-point/search-request")! 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
Shipping collection point search request
{{baseUrl}}/V1/carts/mine/collection-point/search-request
BODY json
{
"countryId": "",
"postcode": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/collection-point/search-request");
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 \"countryId\": \"\",\n \"postcode\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/V1/carts/mine/collection-point/search-request" {:content-type :json
:form-params {:countryId ""
:postcode ""}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/collection-point/search-request"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"countryId\": \"\",\n \"postcode\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/collection-point/search-request"),
Content = new StringContent("{\n \"countryId\": \"\",\n \"postcode\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/collection-point/search-request");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"countryId\": \"\",\n \"postcode\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/collection-point/search-request"
payload := strings.NewReader("{\n \"countryId\": \"\",\n \"postcode\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/V1/carts/mine/collection-point/search-request HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 39
{
"countryId": "",
"postcode": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/V1/carts/mine/collection-point/search-request")
.setHeader("content-type", "application/json")
.setBody("{\n \"countryId\": \"\",\n \"postcode\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/collection-point/search-request"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"countryId\": \"\",\n \"postcode\": \"\"\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 \"countryId\": \"\",\n \"postcode\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/collection-point/search-request")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/V1/carts/mine/collection-point/search-request")
.header("content-type", "application/json")
.body("{\n \"countryId\": \"\",\n \"postcode\": \"\"\n}")
.asString();
const data = JSON.stringify({
countryId: '',
postcode: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/V1/carts/mine/collection-point/search-request');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/carts/mine/collection-point/search-request',
headers: {'content-type': 'application/json'},
data: {countryId: '', postcode: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/collection-point/search-request';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"countryId":"","postcode":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/collection-point/search-request',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "countryId": "",\n "postcode": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"countryId\": \"\",\n \"postcode\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/collection-point/search-request")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/collection-point/search-request',
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({countryId: '', postcode: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/carts/mine/collection-point/search-request',
headers: {'content-type': 'application/json'},
body: {countryId: '', postcode: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/V1/carts/mine/collection-point/search-request');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
countryId: '',
postcode: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/carts/mine/collection-point/search-request',
headers: {'content-type': 'application/json'},
data: {countryId: '', postcode: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/collection-point/search-request';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"countryId":"","postcode":""}'
};
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 = @{ @"countryId": @"",
@"postcode": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/collection-point/search-request"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/collection-point/search-request" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"countryId\": \"\",\n \"postcode\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/collection-point/search-request",
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([
'countryId' => '',
'postcode' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/V1/carts/mine/collection-point/search-request', [
'body' => '{
"countryId": "",
"postcode": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/collection-point/search-request');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'countryId' => '',
'postcode' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'countryId' => '',
'postcode' => ''
]));
$request->setRequestUrl('{{baseUrl}}/V1/carts/mine/collection-point/search-request');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/collection-point/search-request' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"countryId": "",
"postcode": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/collection-point/search-request' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"countryId": "",
"postcode": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"countryId\": \"\",\n \"postcode\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/V1/carts/mine/collection-point/search-request", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/collection-point/search-request"
payload = {
"countryId": "",
"postcode": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/collection-point/search-request"
payload <- "{\n \"countryId\": \"\",\n \"postcode\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/collection-point/search-request")
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 \"countryId\": \"\",\n \"postcode\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/V1/carts/mine/collection-point/search-request') do |req|
req.body = "{\n \"countryId\": \"\",\n \"postcode\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/collection-point/search-request";
let payload = json!({
"countryId": "",
"postcode": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/V1/carts/mine/collection-point/search-request \
--header 'content-type: application/json' \
--data '{
"countryId": "",
"postcode": ""
}'
echo '{
"countryId": "",
"postcode": ""
}' | \
http PUT {{baseUrl}}/V1/carts/mine/collection-point/search-request \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "countryId": "",\n "postcode": ""\n}' \
--output-document \
- {{baseUrl}}/V1/carts/mine/collection-point/search-request
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"countryId": "",
"postcode": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/collection-point/search-request")! 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()
GET
Gets collection points search request
{{baseUrl}}/V1/carts/mine/collection-point/search-result
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/collection-point/search-result");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine/collection-point/search-result")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/collection-point/search-result"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/collection-point/search-result"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/collection-point/search-result");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/collection-point/search-result"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine/collection-point/search-result HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine/collection-point/search-result")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/collection-point/search-result"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/collection-point/search-result")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine/collection-point/search-result")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/mine/collection-point/search-result');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/collection-point/search-result'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/collection-point/search-result';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/collection-point/search-result',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/collection-point/search-result")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/collection-point/search-result',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/collection-point/search-result'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine/collection-point/search-result');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/collection-point/search-result'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/collection-point/search-result';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/collection-point/search-result"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/collection-point/search-result" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/collection-point/search-result",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine/collection-point/search-result');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/collection-point/search-result');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/collection-point/search-result');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/collection-point/search-result' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/collection-point/search-result' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine/collection-point/search-result")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/collection-point/search-result"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/collection-point/search-result"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/collection-point/search-result")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine/collection-point/search-result') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/collection-point/search-result";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine/collection-point/search-result
http GET {{baseUrl}}/V1/carts/mine/collection-point/search-result
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine/collection-point/search-result
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/collection-point/search-result")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Selects cart collection point
{{baseUrl}}/V1/carts/mine/collection-point/select
BODY json
{
"entityId": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/collection-point/select");
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 \"entityId\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/V1/carts/mine/collection-point/select" {:content-type :json
:form-params {:entityId 0}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/collection-point/select"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"entityId\": 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}}/V1/carts/mine/collection-point/select"),
Content = new StringContent("{\n \"entityId\": 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}}/V1/carts/mine/collection-point/select");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"entityId\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/collection-point/select"
payload := strings.NewReader("{\n \"entityId\": 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/V1/carts/mine/collection-point/select HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 19
{
"entityId": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/mine/collection-point/select")
.setHeader("content-type", "application/json")
.setBody("{\n \"entityId\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/collection-point/select"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"entityId\": 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 \"entityId\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/collection-point/select")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine/collection-point/select")
.header("content-type", "application/json")
.body("{\n \"entityId\": 0\n}")
.asString();
const data = JSON.stringify({
entityId: 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}}/V1/carts/mine/collection-point/select');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/collection-point/select',
headers: {'content-type': 'application/json'},
data: {entityId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/collection-point/select';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"entityId":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}}/V1/carts/mine/collection-point/select',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "entityId": 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 \"entityId\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/collection-point/select")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/collection-point/select',
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({entityId: 0}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/collection-point/select',
headers: {'content-type': 'application/json'},
body: {entityId: 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}}/V1/carts/mine/collection-point/select');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
entityId: 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}}/V1/carts/mine/collection-point/select',
headers: {'content-type': 'application/json'},
data: {entityId: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/collection-point/select';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"entityId":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 = @{ @"entityId": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/collection-point/select"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/collection-point/select" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"entityId\": 0\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/collection-point/select",
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([
'entityId' => 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}}/V1/carts/mine/collection-point/select', [
'body' => '{
"entityId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/collection-point/select');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'entityId' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'entityId' => 0
]));
$request->setRequestUrl('{{baseUrl}}/V1/carts/mine/collection-point/select');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/collection-point/select' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"entityId": 0
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/collection-point/select' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"entityId": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"entityId\": 0\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/V1/carts/mine/collection-point/select", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/collection-point/select"
payload = { "entityId": 0 }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/collection-point/select"
payload <- "{\n \"entityId\": 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}}/V1/carts/mine/collection-point/select")
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 \"entityId\": 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/V1/carts/mine/collection-point/select') do |req|
req.body = "{\n \"entityId\": 0\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/collection-point/select";
let payload = json!({"entityId": 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}}/V1/carts/mine/collection-point/select \
--header 'content-type: application/json' \
--data '{
"entityId": 0
}'
echo '{
"entityId": 0
}' | \
http POST {{baseUrl}}/V1/carts/mine/collection-point/select \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "entityId": 0\n}' \
--output-document \
- {{baseUrl}}/V1/carts/mine/collection-point/select
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["entityId": 0] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/collection-point/select")! 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
Deletes a coupon from a specified cart
{{baseUrl}}/V1/carts/mine/coupons
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/coupons");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/V1/carts/mine/coupons")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/coupons"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/coupons");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/coupons HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/V1/carts/mine/coupons")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/coupons")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/coupons');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/V1/carts/mine/coupons'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/coupons',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/coupons'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/coupons" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/coupons');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/coupons');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/coupons');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/coupons' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/coupons' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/V1/carts/mine/coupons")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/coupons"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/coupons"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/coupons
http DELETE {{baseUrl}}/V1/carts/mine/coupons
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/V1/carts/mine/coupons
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/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()
GET
Returns information for a coupon in a specified cart
{{baseUrl}}/V1/carts/mine/coupons
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/coupons");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine/coupons")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/coupons"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/coupons"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/coupons");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/coupons"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine/coupons HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine/coupons")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/coupons"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/coupons")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine/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('GET', '{{baseUrl}}/V1/carts/mine/coupons');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine/coupons'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/coupons';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/coupons',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/coupons")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/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: 'GET', url: '{{baseUrl}}/V1/carts/mine/coupons'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine/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: 'GET', url: '{{baseUrl}}/V1/carts/mine/coupons'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/coupons';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/coupons"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/coupons" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/coupons",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine/coupons');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/coupons');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/coupons');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/coupons' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/coupons' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine/coupons")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/coupons"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/coupons"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/coupons")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine/coupons') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/coupons";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine/coupons
http GET {{baseUrl}}/V1/carts/mine/coupons
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine/coupons
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/coupons")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Adds a coupon by code to a specified cart
{{baseUrl}}/V1/carts/mine/coupons/:couponCode
QUERY PARAMS
couponCode
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/coupons/:couponCode");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/V1/carts/mine/coupons/:couponCode")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/coupons/:couponCode");
var request = new RestRequest("", Method.Put);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/coupons/:couponCode HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/V1/carts/mine/coupons/:couponCode")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/coupons/:couponCode")
.put(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/coupons/:couponCode');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/carts/mine/coupons/:couponCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/coupons/:couponCode',
method: 'PUT',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/coupons/:couponCode" in
Client.call `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/coupons/:couponCode');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/coupons/:couponCode');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/coupons/:couponCode');
$request->setRequestMethod('PUT');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/coupons/:couponCode' -Method PUT
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/coupons/:couponCode' -Method PUT
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("PUT", "/baseUrl/V1/carts/mine/coupons/:couponCode")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/coupons/:couponCode"
response = requests.put(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/coupons/:couponCode"
response <- VERB("PUT", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/coupons/:couponCode
http PUT {{baseUrl}}/V1/carts/mine/coupons/:couponCode
wget --quiet \
--method PUT \
--output-document \
- {{baseUrl}}/V1/carts/mine/coupons/:couponCode
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/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
Handles selected delivery option
{{baseUrl}}/V1/carts/mine/delivery-option
BODY json
{
"selectedOption": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/delivery-option");
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 \"selectedOption\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/V1/carts/mine/delivery-option" {:content-type :json
:form-params {:selectedOption ""}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/delivery-option"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"selectedOption\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/delivery-option"),
Content = new StringContent("{\n \"selectedOption\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/delivery-option");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"selectedOption\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/delivery-option"
payload := strings.NewReader("{\n \"selectedOption\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/V1/carts/mine/delivery-option HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 26
{
"selectedOption": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/mine/delivery-option")
.setHeader("content-type", "application/json")
.setBody("{\n \"selectedOption\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/delivery-option"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"selectedOption\": \"\"\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 \"selectedOption\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/delivery-option")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine/delivery-option")
.header("content-type", "application/json")
.body("{\n \"selectedOption\": \"\"\n}")
.asString();
const data = JSON.stringify({
selectedOption: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/V1/carts/mine/delivery-option');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/delivery-option',
headers: {'content-type': 'application/json'},
data: {selectedOption: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/delivery-option';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"selectedOption":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/delivery-option',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "selectedOption": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"selectedOption\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/delivery-option")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/delivery-option',
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({selectedOption: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/delivery-option',
headers: {'content-type': 'application/json'},
body: {selectedOption: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/V1/carts/mine/delivery-option');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
selectedOption: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/delivery-option',
headers: {'content-type': 'application/json'},
data: {selectedOption: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/delivery-option';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"selectedOption":""}'
};
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 = @{ @"selectedOption": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/delivery-option"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/delivery-option" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"selectedOption\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/delivery-option",
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([
'selectedOption' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/V1/carts/mine/delivery-option', [
'body' => '{
"selectedOption": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/delivery-option');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'selectedOption' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'selectedOption' => ''
]));
$request->setRequestUrl('{{baseUrl}}/V1/carts/mine/delivery-option');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/delivery-option' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"selectedOption": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/delivery-option' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"selectedOption": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"selectedOption\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/V1/carts/mine/delivery-option", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/delivery-option"
payload = { "selectedOption": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/delivery-option"
payload <- "{\n \"selectedOption\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/delivery-option")
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 \"selectedOption\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/V1/carts/mine/delivery-option') do |req|
req.body = "{\n \"selectedOption\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/delivery-option";
let payload = json!({"selectedOption": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/V1/carts/mine/delivery-option \
--header 'content-type: application/json' \
--data '{
"selectedOption": ""
}'
echo '{
"selectedOption": ""
}' | \
http POST {{baseUrl}}/V1/carts/mine/delivery-option \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "selectedOption": ""\n}' \
--output-document \
- {{baseUrl}}/V1/carts/mine/delivery-option
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["selectedOption": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/delivery-option")! 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
Estimates shipping by address and return list of available shipping methods
{{baseUrl}}/V1/carts/mine/estimate-shipping-methods
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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/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 \"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/V1/carts/mine/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 {:gift_registry_id 0
:checkout_fields [{:attribute_code ""
:value ""}]}
:custom_attributes [{}]}}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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/V1/carts/mine/estimate-shipping-methods HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 687
{
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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 \"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/estimate-shipping-methods")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
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}}/V1/carts/mine/estimate-shipping-methods');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"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}}/V1/carts/mine/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\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 \"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/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/V1/carts/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({
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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
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}}/V1/carts/mine/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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
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}}/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
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}}/V1/carts/mine/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"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 = @{ @"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": @{ @"gift_registry_id": @0, @"checkout_fields": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"custom_attributes": @[ @{ } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/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([
'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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'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}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
]
]));
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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/V1/carts/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}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}'
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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/V1/carts/mine/estimate-shipping-methods", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [{}]
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/V1/carts/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 \"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/V1/carts/mine/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!({
"gift_registry_id": 0,
"checkout_fields": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"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}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}'
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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}' | \
http POST {{baseUrl}}/V1/carts/mine/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\n {}\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/V1/carts/mine/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": [
"gift_registry_id": 0,
"checkout_fields": [
[
"attribute_code": "",
"value": ""
]
]
],
"custom_attributes": [[]]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/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
Estimates shipping
{{baseUrl}}/V1/carts/mine/estimate-shipping-methods-by-address-id
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}}/V1/carts/mine/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}}/V1/carts/mine/estimate-shipping-methods-by-address-id" {:content-type :json
:form-params {:addressId 0}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/estimate-shipping-methods-by-address-id', [
'body' => '{
"addressId": 0
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/estimate-shipping-methods-by-address-id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/estimate-shipping-methods-by-address-id \
--header 'content-type: application/json' \
--data '{
"addressId": 0
}'
echo '{
"addressId": 0
}' | \
http POST {{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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()
GET
Returns the gift message for a specified order
{{baseUrl}}/V1/carts/mine/gift-message
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/gift-message");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine/gift-message")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/gift-message"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/gift-message"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/gift-message");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/gift-message"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine/gift-message HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine/gift-message")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/gift-message"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/gift-message")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine/gift-message")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/mine/gift-message');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine/gift-message'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/gift-message';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/gift-message',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/gift-message")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/gift-message',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine/gift-message'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine/gift-message');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine/gift-message'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/gift-message';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/gift-message"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/gift-message" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/gift-message",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine/gift-message');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/gift-message');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/gift-message');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/gift-message' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/gift-message' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine/gift-message")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/gift-message"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/gift-message"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/gift-message")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine/gift-message') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/gift-message";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine/gift-message
http GET {{baseUrl}}/V1/carts/mine/gift-message
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine/gift-message
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/gift-message")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Sets the gift message for an entire order
{{baseUrl}}/V1/carts/mine/gift-message
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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/gift-message")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/gift-message');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/gift-message", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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()
GET
Returns the gift message for a specified item in a specified shopping cart
{{baseUrl}}/V1/carts/mine/gift-message/:itemId
QUERY PARAMS
itemId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/gift-message/:itemId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine/gift-message/:itemId")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/gift-message/:itemId"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/gift-message/:itemId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/gift-message/:itemId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/gift-message/:itemId"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine/gift-message/:itemId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine/gift-message/:itemId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/gift-message/:itemId"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/gift-message/:itemId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine/gift-message/: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('GET', '{{baseUrl}}/V1/carts/mine/gift-message/:itemId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/gift-message/:itemId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/gift-message/:itemId';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/gift-message/:itemId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/gift-message/:itemId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/gift-message/: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: 'GET',
url: '{{baseUrl}}/V1/carts/mine/gift-message/:itemId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine/gift-message/: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: 'GET',
url: '{{baseUrl}}/V1/carts/mine/gift-message/:itemId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/gift-message/:itemId';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/gift-message/:itemId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/gift-message/:itemId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/gift-message/:itemId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine/gift-message/:itemId');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/gift-message/:itemId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/gift-message/:itemId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/gift-message/:itemId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/gift-message/:itemId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine/gift-message/:itemId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/gift-message/:itemId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/gift-message/:itemId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/gift-message/:itemId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine/gift-message/:itemId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/gift-message/:itemId";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine/gift-message/:itemId
http GET {{baseUrl}}/V1/carts/mine/gift-message/:itemId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine/gift-message/:itemId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/gift-message/:itemId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Sets the gift message for a specified item in a specified shopping cart
{{baseUrl}}/V1/carts/mine/gift-message/:itemId
QUERY PARAMS
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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/gift-message/:itemId")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/gift-message/:itemId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/gift-message/:itemId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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
Adds gift card to the cart (POST)
{{baseUrl}}/V1/carts/mine/giftCards
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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/giftCards")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/giftCards');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/giftCards", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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
Removes GiftCard Account entity (DELETE)
{{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode
QUERY PARAMS
giftCardCode
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/giftCards/:giftCardCode");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/giftCards/:giftCardCode HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/giftCards/:giftCardCode")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/giftCards/:giftCardCode');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/giftCards/:giftCardCode',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/giftCards/:giftCardCode" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/giftCards/:giftCardCode');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/V1/carts/mine/giftCards/:giftCardCode")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/giftCards/:giftCardCode
http DELETE {{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/V1/carts/mine/giftCards/:giftCardCode
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/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
Adds-updates the specified cart item
{{baseUrl}}/V1/carts/mine/items
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": {}
}
}
},
"extension_attributes": {
"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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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 {}}}}
:extension_attributes {:negotiable_quote_item {:item_id 0
:original_price ""
:original_tax_amount ""
:original_discount_amount ""
:extension_attributes {}}}}}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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/V1/carts/mine/items HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1573
{
"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": {}
}
}
},
"extension_attributes": {
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/items")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/mine/items');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/mine/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":{}}}},"extension_attributes":{"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}}/V1/carts/mine/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 }\n }\n },\n "extension_attributes": {\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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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/V1/carts/mine/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/mine/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/mine/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/mine/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/mine/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":{}}}},"extension_attributes":{"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": @{ } } } }, @"extension_attributes": @{ @"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}}/V1/carts/mine/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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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' => [
]
]
]
],
'extension_attributes' => [
'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}}/V1/carts/mine/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": {}
}
}
},
"extension_attributes": {
"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}}/V1/carts/mine/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' => [
]
]
]
],
'extension_attributes' => [
'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' => [
]
]
]
],
'extension_attributes' => [
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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": {}
}
}
},
"extension_attributes": {
"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}}/V1/carts/mine/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": {}
}
}
},
"extension_attributes": {
"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 }\n }\n },\n \"extension_attributes\": {\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/V1/carts/mine/items", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/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": {}
}
} },
"extension_attributes": { "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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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!({})
})
})}),
"extension_attributes": json!({"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}}/V1/carts/mine/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": {}
}
}
},
"extension_attributes": {
"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": {}
}
}
},
"extension_attributes": {
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}' | \
http POST {{baseUrl}}/V1/carts/mine/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 }\n }\n },\n "extension_attributes": {\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}}/V1/carts/mine/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": []
]
]],
"extension_attributes": ["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}}/V1/carts/mine/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()
GET
Lists items that are assigned to a specified cart
{{baseUrl}}/V1/carts/mine/items
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/items");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine/items")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/items"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/items"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/items");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/items"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine/items HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine/items")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/items"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/items")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine/items")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/mine/items');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine/items'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/items';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/items',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/items")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/items',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine/items'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine/items');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine/items'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/items';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/items"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/items" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/items",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine/items');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/items');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/items');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/items' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/items' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine/items")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/items"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/items"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/items")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine/items') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/items";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine/items
http GET {{baseUrl}}/V1/carts/mine/items
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine/items
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/items")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Adds-updates the specified cart item (PUT)
{{baseUrl}}/V1/carts/mine/items/:itemId
QUERY PARAMS
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": {}
}
}
},
"extension_attributes": {
"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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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 {}}}}
:extension_attributes {:negotiable_quote_item {:item_id 0
:original_price ""
:original_tax_amount ""
:original_discount_amount ""
:extension_attributes {}}}}}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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/V1/carts/mine/items/:itemId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 1573
{
"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": {}
}
}
},
"extension_attributes": {
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/items/:itemId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/mine/items/:itemId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/carts/mine/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/mine/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":{}}}},"extension_attributes":{"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}}/V1/carts/mine/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 }\n }\n },\n "extension_attributes": {\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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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/V1/carts/mine/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/mine/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/mine/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/mine/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: {}
}
}
},
extension_attributes: {
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}}/V1/carts/mine/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":{}}}},"extension_attributes":{"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": @{ } } } }, @"extension_attributes": @{ @"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}}/V1/carts/mine/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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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' => [
]
]
]
],
'extension_attributes' => [
'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}}/V1/carts/mine/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": {}
}
}
},
"extension_attributes": {
"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}}/V1/carts/mine/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' => [
]
]
]
],
'extension_attributes' => [
'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' => [
]
]
]
],
'extension_attributes' => [
'negotiable_quote_item' => [
'item_id' => 0,
'original_price' => '',
'original_tax_amount' => '',
'original_discount_amount' => '',
'extension_attributes' => [
]
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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": {}
}
}
},
"extension_attributes": {
"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}}/V1/carts/mine/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": {}
}
}
},
"extension_attributes": {
"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 }\n }\n },\n \"extension_attributes\": {\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/V1/carts/mine/items/:itemId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/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": {}
}
} },
"extension_attributes": { "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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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/V1/carts/mine/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 }\n }\n },\n \"extension_attributes\": {\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}}/V1/carts/mine/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!({})
})
})}),
"extension_attributes": json!({"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}}/V1/carts/mine/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": {}
}
}
},
"extension_attributes": {
"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": {}
}
}
},
"extension_attributes": {
"negotiable_quote_item": {
"item_id": 0,
"original_price": "",
"original_tax_amount": "",
"original_discount_amount": "",
"extension_attributes": {}
}
}
}
}' | \
http PUT {{baseUrl}}/V1/carts/mine/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 }\n }\n },\n "extension_attributes": {\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}}/V1/carts/mine/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": []
]
]],
"extension_attributes": ["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}}/V1/carts/mine/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()
DELETE
Removes the specified item from the specified cart
{{baseUrl}}/V1/carts/mine/items/:itemId
QUERY PARAMS
itemId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/items/:itemId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/V1/carts/mine/items/:itemId")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/items/:itemId");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/items/:itemId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/V1/carts/mine/items/:itemId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/items/:itemId")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/items/:itemId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/V1/carts/mine/items/:itemId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/items/:itemId',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/items/:itemId" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/items/:itemId');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/items/:itemId');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/items/:itemId');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/items/:itemId' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/items/:itemId' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/V1/carts/mine/items/:itemId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/items/:itemId"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/items/:itemId"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/items/:itemId
http DELETE {{baseUrl}}/V1/carts/mine/items/:itemId
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/V1/carts/mine/items/:itemId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/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
Places an order for a specified cart
{{baseUrl}}/V1/carts/mine/order
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}}/V1/carts/mine/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}}/V1/carts/mine/order" {:content-type :json
:form-params {:paymentMethod {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/order")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/order');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/order', [
'body' => '{
"paymentMethod": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/order", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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()
GET
Gets payment information
{{baseUrl}}/V1/carts/mine/payment-information
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/payment-information");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine/payment-information")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/payment-information"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/payment-information"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/payment-information");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/payment-information"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine/payment-information HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine/payment-information")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/payment-information"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/payment-information")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine/payment-information")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/mine/payment-information');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/payment-information'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/payment-information';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/payment-information',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/payment-information")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/payment-information',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/payment-information'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine/payment-information');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/payment-information'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/payment-information';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/payment-information"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/payment-information" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/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 => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine/payment-information');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/payment-information');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/payment-information');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/payment-information' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/payment-information' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine/payment-information")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/payment-information"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/payment-information"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/payment-information")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine/payment-information') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/payment-information";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine/payment-information
http GET {{baseUrl}}/V1/carts/mine/payment-information
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine/payment-information
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/payment-information")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Sets payment information and place order for a specified cart
{{baseUrl}}/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/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 {:gift_registry_id 0
:checkout_fields [{:attribute_code ""
:value ""}]}
:custom_attributes [{}]}}})
require "http/client"
url = "{{baseUrl}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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/V1/carts/mine/payment-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 848
{
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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 \"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/payment-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
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}}/V1/carts/mine/payment-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"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}}/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\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 \"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/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/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
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}}/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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
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}}/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
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}}/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"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 = @{ @"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": @{ @"gift_registry_id": @0, @"checkout_fields": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"custom_attributes": @[ @{ } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/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}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'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}}/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
]
]));
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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/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}}/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}'
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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/V1/carts/mine/payment-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [{}]
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/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!({
"gift_registry_id": 0,
"checkout_fields": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"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}}/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}'
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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}' | \
http POST {{baseUrl}}/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\n {}\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/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": [
"gift_registry_id": 0,
"checkout_fields": [
[
"attribute_code": "",
"value": ""
]
]
],
"custom_attributes": [[]]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/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()
GET
Lists available payment methods for a specified shopping cart
{{baseUrl}}/V1/carts/mine/payment-methods
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/payment-methods");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine/payment-methods")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/payment-methods"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/payment-methods"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/payment-methods");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/payment-methods"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine/payment-methods HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine/payment-methods")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/payment-methods"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/payment-methods")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine/payment-methods")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/mine/payment-methods');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/payment-methods'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/payment-methods';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/payment-methods',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/payment-methods")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/payment-methods',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/payment-methods'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine/payment-methods');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/payment-methods'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/payment-methods';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/payment-methods"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/payment-methods" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/payment-methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine/payment-methods');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/payment-methods');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/payment-methods');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/payment-methods' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/payment-methods' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine/payment-methods")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/payment-methods"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/payment-methods"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine/payment-methods') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/payment-methods";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine/payment-methods
http GET {{baseUrl}}/V1/carts/mine/payment-methods
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine/payment-methods
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/payment-methods")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Adds a specified payment method to a specified shopping cart
{{baseUrl}}/V1/carts/mine/selected-payment-method
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}}/V1/carts/mine/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}}/V1/carts/mine/selected-payment-method" {:content-type :json
:form-params {:method {:po_number ""
:method ""
:additional_data []
:extension_attributes {:agreement_ids []}}}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/selected-payment-method")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/selected-payment-method');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/selected-payment-method', [
'body' => '{
"method": {
"po_number": "",
"method": "",
"additional_data": [],
"extension_attributes": {
"agreement_ids": []
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/selected-payment-method", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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}}/V1/carts/mine/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()
GET
Returns the payment method for a specified shopping cart
{{baseUrl}}/V1/carts/mine/selected-payment-method
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/selected-payment-method");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine/selected-payment-method")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/selected-payment-method"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/selected-payment-method"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/selected-payment-method");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/selected-payment-method"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine/selected-payment-method HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine/selected-payment-method")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/selected-payment-method"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/selected-payment-method")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine/selected-payment-method")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/mine/selected-payment-method');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/selected-payment-method'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/selected-payment-method';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/selected-payment-method',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/selected-payment-method")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/selected-payment-method',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/selected-payment-method'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine/selected-payment-method');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/selected-payment-method'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/selected-payment-method';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/selected-payment-method"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/selected-payment-method" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/selected-payment-method",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine/selected-payment-method');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/selected-payment-method');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/selected-payment-method');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/selected-payment-method' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/selected-payment-method' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine/selected-payment-method")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/selected-payment-method"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/selected-payment-method"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/selected-payment-method")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine/selected-payment-method') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/selected-payment-method";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine/selected-payment-method
http GET {{baseUrl}}/V1/carts/mine/selected-payment-method
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine/selected-payment-method
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/selected-payment-method")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Sets payment information for a specified cart
{{baseUrl}}/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/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 {:gift_registry_id 0
:checkout_fields [{:attribute_code ""
:value ""}]}
:custom_attributes [{}]}}})
require "http/client"
url = "{{baseUrl}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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/V1/carts/mine/set-payment-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 848
{
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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 \"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/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}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
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}}/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}}/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"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}}/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\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 \"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/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/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
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}}/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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
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}}/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
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}}/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"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 = @{ @"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": @{ @"gift_registry_id": @0, @"checkout_fields": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"custom_attributes": @[ @{ } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/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}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'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}}/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
]
]));
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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/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}}/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}'
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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\n {}\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/V1/carts/mine/set-payment-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [{}]
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\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}}/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!({
"gift_registry_id": 0,
"checkout_fields": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"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}}/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}'
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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
}
}' | \
http POST {{baseUrl}}/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\n {}\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/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": [
"gift_registry_id": 0,
"checkout_fields": [
[
"attribute_code": "",
"value": ""
]
]
],
"custom_attributes": [[]]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/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
Saves address information
{{baseUrl}}/V1/carts/mine/shipping-information
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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 {:gift_registry_id 0
:checkout_fields [{:attribute_code ""
:value ""}]}
:custom_attributes [{}]}
:billing_address {}
:shipping_method_code ""
:shipping_carrier_code ""
:extension_attributes {}
:custom_attributes [{}]}}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/mine/shipping-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 965
{
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/shipping-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
custom_attributes: [
{}
]
},
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}}/V1/carts/mine/shipping-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/carts/mine/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"custom_attributes":[{}]},"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}}/V1/carts/mine/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
billing_address: {},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/carts/mine/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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
custom_attributes: [
{}
]
},
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}}/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/carts/mine/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"custom_attributes":[{}]},"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": @{ @"gift_registry_id": @0, @"checkout_fields": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"custom_attributes": @[ @{ } ] }, @"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}}/V1/carts/mine/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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'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}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'billing_address' => [
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/mine/shipping-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [{}]
},
"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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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!({
"gift_registry_id": 0,
"checkout_fields": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"custom_attributes": (json!({}))
}),
"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}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"billing_address": {},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}' | \
http POST {{baseUrl}}/V1/carts/mine/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\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}}/V1/carts/mine/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": [
"gift_registry_id": 0,
"checkout_fields": [
[
"attribute_code": "",
"value": ""
]
]
],
"custom_attributes": [[]]
],
"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}}/V1/carts/mine/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()
GET
Lists applicable shipping methods for a specified quote
{{baseUrl}}/V1/carts/mine/shipping-methods
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/shipping-methods");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine/shipping-methods")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/shipping-methods"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/shipping-methods"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/shipping-methods");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/shipping-methods"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine/shipping-methods HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine/shipping-methods")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/shipping-methods"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/shipping-methods")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine/shipping-methods")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/mine/shipping-methods');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/shipping-methods'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/shipping-methods';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/shipping-methods',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/shipping-methods")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/shipping-methods',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/shipping-methods'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine/shipping-methods');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/V1/carts/mine/shipping-methods'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/shipping-methods';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/shipping-methods"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/shipping-methods" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/shipping-methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine/shipping-methods');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/shipping-methods');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/shipping-methods');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/shipping-methods' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/shipping-methods' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine/shipping-methods")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/shipping-methods"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/shipping-methods"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/shipping-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine/shipping-methods') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/shipping-methods";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine/shipping-methods
http GET {{baseUrl}}/V1/carts/mine/shipping-methods
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine/shipping-methods
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/shipping-methods")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Returns quote totals data for a specified cart
{{baseUrl}}/V1/carts/mine/totals
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/mine/totals");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/mine/totals")
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/totals"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/mine/totals"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/mine/totals");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/mine/totals"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/mine/totals HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/mine/totals")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/mine/totals"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/totals")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/mine/totals")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/mine/totals');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine/totals'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/mine/totals';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/mine/totals',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/mine/totals")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/mine/totals',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine/totals'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/mine/totals');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/mine/totals'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/mine/totals';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/mine/totals"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/mine/totals" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/mine/totals",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/mine/totals');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/totals');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/mine/totals');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/mine/totals' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/totals' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/mine/totals")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/totals"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/mine/totals"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/mine/totals")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/mine/totals') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/mine/totals";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/mine/totals
http GET {{baseUrl}}/V1/carts/mine/totals
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/mine/totals
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/mine/totals")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Calculates quote totals based on address and shipping method
{{baseUrl}}/V1/carts/mine/totals-information
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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 {:gift_registry_id 0
:checkout_fields [{:attribute_code ""
:value ""}]}
:custom_attributes [{}]}
:shipping_method_code ""
:shipping_carrier_code ""
:extension_attributes {}
:custom_attributes [{}]}}})
require "http/client"
url = "{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/mine/totals-information HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 929
{
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/totals-information")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
custom_attributes: [
{}
]
},
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}}/V1/carts/mine/totals-information');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/carts/mine/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"custom_attributes":[{}]},"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}}/V1/carts/mine/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
shipping_method_code: '',
shipping_carrier_code: '',
extension_attributes: {},
custom_attributes: [{}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/carts/mine/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: {
gift_registry_id: 0,
checkout_fields: [
{
attribute_code: '',
value: ''
}
]
},
custom_attributes: [
{}
]
},
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}}/V1/carts/mine/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: {gift_registry_id: 0, checkout_fields: [{attribute_code: '', value: ''}]},
custom_attributes: [{}]
},
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}}/V1/carts/mine/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":{"gift_registry_id":0,"checkout_fields":[{"attribute_code":"","value":""}]},"custom_attributes":[{}]},"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": @{ @"gift_registry_id": @0, @"checkout_fields": @[ @{ @"attribute_code": @"", @"value": @"" } ] }, @"custom_attributes": @[ @{ } ] }, @"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}}/V1/carts/mine/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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'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}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/mine/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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'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' => [
'gift_registry_id' => 0,
'checkout_fields' => [
[
'attribute_code' => '',
'value' => ''
]
]
],
'custom_attributes' => [
[
]
]
],
'shipping_method_code' => '',
'shipping_carrier_code' => '',
'extension_attributes' => [
],
'custom_attributes' => [
[
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/V1/carts/mine/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}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/mine/totals-information", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [{}]
},
"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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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/V1/carts/mine/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 \"gift_registry_id\": 0,\n \"checkout_fields\": [\n {\n \"attribute_code\": \"\",\n \"value\": \"\"\n }\n ]\n },\n \"custom_attributes\": [\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}}/V1/carts/mine/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!({
"gift_registry_id": 0,
"checkout_fields": (
json!({
"attribute_code": "",
"value": ""
})
)
}),
"custom_attributes": (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}}/V1/carts/mine/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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"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": {
"gift_registry_id": 0,
"checkout_fields": [
{
"attribute_code": "",
"value": ""
}
]
},
"custom_attributes": [
{}
]
},
"shipping_method_code": "",
"shipping_carrier_code": "",
"extension_attributes": {},
"custom_attributes": [
{}
]
}
}' | \
http POST {{baseUrl}}/V1/carts/mine/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 "gift_registry_id": 0,\n "checkout_fields": [\n {\n "attribute_code": "",\n "value": ""\n }\n ]\n },\n "custom_attributes": [\n {}\n ]\n },\n "shipping_method_code": "",\n "shipping_carrier_code": "",\n "extension_attributes": {},\n "custom_attributes": [\n {}\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/V1/carts/mine/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": [
"gift_registry_id": 0,
"checkout_fields": [
[
"attribute_code": "",
"value": ""
]
]
],
"custom_attributes": [[]]
],
"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}}/V1/carts/mine/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()
GET
Enables administrative users to list carts that match specified search criteria
{{baseUrl}}/V1/carts/search
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/V1/carts/search");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/V1/carts/search")
require "http/client"
url = "{{baseUrl}}/V1/carts/search"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/V1/carts/search"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/V1/carts/search");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/V1/carts/search"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/V1/carts/search HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/V1/carts/search")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/V1/carts/search"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/V1/carts/search")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/V1/carts/search")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/V1/carts/search');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/search'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/V1/carts/search';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/V1/carts/search',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/V1/carts/search")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/V1/carts/search',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/search'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/V1/carts/search');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/V1/carts/search'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/V1/carts/search';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/V1/carts/search"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/V1/carts/search" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/V1/carts/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/V1/carts/search');
echo $response->getBody();
setUrl('{{baseUrl}}/V1/carts/search');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/V1/carts/search');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/V1/carts/search' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/V1/carts/search' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/V1/carts/search")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/V1/carts/search"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/V1/carts/search"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/V1/carts/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/V1/carts/search') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/V1/carts/search";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/V1/carts/search
http GET {{baseUrl}}/V1/carts/search
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/V1/carts/search
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/V1/carts/search")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()