FastSpring API
POST
Create an account
{{baseUrl}}/accounts
BODY json
{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/accounts");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/accounts" {:content-type :json
:form-params {:contact {:company ""
:email ""
:first ""
:last ""
:phone ""}}})
require "http/client"
url = "{{baseUrl}}/accounts"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\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}}/accounts"),
Content = new StringContent("{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\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}}/accounts");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/accounts"
payload := strings.NewReader("{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\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/accounts HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 107
{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/accounts")
.setHeader("content-type", "application/json")
.setBody("{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/accounts"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\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 \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/accounts")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/accounts")
.header("content-type", "application/json")
.body("{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
contact: {
company: '',
email: '',
first: '',
last: '',
phone: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/accounts');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/accounts',
headers: {'content-type': 'application/json'},
data: {contact: {company: '', email: '', first: '', last: '', phone: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/accounts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"contact":{"company":"","email":"","first":"","last":"","phone":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/accounts',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "contact": {\n "company": "",\n "email": "",\n "first": "",\n "last": "",\n "phone": ""\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 \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/accounts")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/accounts',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({contact: {company: '', email: '', first: '', last: '', phone: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/accounts',
headers: {'content-type': 'application/json'},
body: {contact: {company: '', email: '', first: '', last: '', phone: ''}},
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}}/accounts');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
contact: {
company: '',
email: '',
first: '',
last: '',
phone: ''
}
});
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}}/accounts',
headers: {'content-type': 'application/json'},
data: {contact: {company: '', email: '', first: '', last: '', phone: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/accounts';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"contact":{"company":"","email":"","first":"","last":"","phone":""}}'
};
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 = @{ @"contact": @{ @"company": @"", @"email": @"", @"first": @"", @"last": @"", @"phone": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/accounts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/accounts" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contact' => [
'company' => '',
'email' => '',
'first' => '',
'last' => '',
'phone' => ''
]
]),
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}}/accounts', [
'body' => '{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/accounts');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'contact' => [
'company' => '',
'email' => '',
'first' => '',
'last' => '',
'phone' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'contact' => [
'company' => '',
'email' => '',
'first' => '',
'last' => '',
'phone' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/accounts');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/accounts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/accounts' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/accounts", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/accounts"
payload = { "contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/accounts"
payload <- "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\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}}/accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\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/accounts') do |req|
req.body = "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/accounts";
let payload = json!({"contact": json!({
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
})});
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}}/accounts \
--header 'content-type: application/json' \
--data '{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}'
echo '{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}' | \
http POST {{baseUrl}}/accounts \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "contact": {\n "company": "",\n "email": "",\n "first": "",\n "last": "",\n "phone": ""\n }\n}' \
--output-document \
- {{baseUrl}}/accounts
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["contact": [
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/accounts")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"account": "wjnkDBJnRcGiOB4Q-3AN9w",
"action": "account.create",
"result": "success"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "account.create",
"result": "error",
"error": {
"first": "first invalid",
"last": "last invalid",
"email": "email already exists, /accounts/id",
"custom": "custom invalid",
"country": "country invalid",
"language": "language is invalid"
}
}
GET
Get all accounts or Search for accounts by parameter
{{baseUrl}}/accounts
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/accounts");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/accounts")
require "http/client"
url = "{{baseUrl}}/accounts"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/accounts"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/accounts");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/accounts"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/accounts HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/accounts")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/accounts"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/accounts")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/accounts")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/accounts');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/accounts'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/accounts';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/accounts',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/accounts")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/accounts',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/accounts'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/accounts');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/accounts'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/accounts';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/accounts"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/accounts" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/accounts');
echo $response->getBody();
setUrl('{{baseUrl}}/accounts');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/accounts');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/accounts' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/accounts' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/accounts")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/accounts"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/accounts"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/accounts') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/accounts";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/accounts
http GET {{baseUrl}}/accounts
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/accounts
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/accounts")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "account.lookup",
"result": "error",
"error": {
"custom": "Account not found",
"key": "Unrecognized Key",
"subscriptions": "Supported value: active, ended, canceled, started",
"refunds": "Supported value: true",
"begin": "Invalid begin date",
"end": "Invalid end date",
"AnotherKey": "Only one condition can be specified"
}
}
GET
Get an account
{{baseUrl}}/accounts/:account_id
QUERY PARAMS
account_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/accounts/:account_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/accounts/:account_id")
require "http/client"
url = "{{baseUrl}}/accounts/:account_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/accounts/:account_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/accounts/:account_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/accounts/:account_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/accounts/:account_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/accounts/:account_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/accounts/:account_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/accounts/:account_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/accounts/:account_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/accounts/:account_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/accounts/:account_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/accounts/:account_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/accounts/:account_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/accounts/:account_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/accounts/:account_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/accounts/:account_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/accounts/:account_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/accounts/:account_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/accounts/:account_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/accounts/:account_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/accounts/:account_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/accounts/:account_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/accounts/:account_id');
echo $response->getBody();
setUrl('{{baseUrl}}/accounts/:account_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/accounts/:account_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/accounts/:account_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/accounts/:account_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/accounts/:account_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/accounts/:account_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/accounts/:account_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/accounts/:account_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/accounts/:account_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/accounts/:account_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/accounts/:account_id
http GET {{baseUrl}}/accounts/:account_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/accounts/:account_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/accounts/:account_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"accounts": [
{
"id": "wjnkDBJnRcGiOB4Q-3AN9w",
"account": "wjnkDBJnRcGiOB4Q-3AN9w",
"action": "account.get",
"contact": {
"first": "String",
"last": "String",
"email": "String",
"company": "String",
"phone": "String"
},
"address": {
"addressLine1": "801 Garden St",
"addressLine2": "Suite 200",
"city": "Santa Barbara",
"postalCode": "93101",
"region": "CA"
},
"language": "en",
"country": "US",
"lookup": {
"global": "K1gb96tBS_yMMLZqKdLXCg",
"custom": "customKey"
},
"url": "https://store.fastspring.com/storefront/account/K1gb96tBS_yMMLZqKdLXCg",
"payment": {
"methods": 2,
"active": 2
},
"orders": [
"orderId"
],
"subscriptions": [
"subscriptionId"
],
"charges": [
{
"currency": "USD",
"total": 10,
"payoutCurrency": "USD",
"totalInPayoutCurrency": 10,
"status": "successful",
"order": "6L9YSZ8kRoaFD6DMzVS80Q",
"orderReference": "COM151120-4954-44172",
"subscription": null,
"timestamp": 1448047102396,
"timestampValue": 1448047102396,
"timestampInSeconds": 1448047102,
"timestampDisplay": "11/20/15"
}
],
"subscribed": true,
"result": "success"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "account.get",
"account": "wjnkDBJnRcGiOB4Q-3AN9",
"result": "error",
"error": {
"account": "account not found"
}
}
GET
Get authenticated account management URL
{{baseUrl}}/accounts/:account_id/authenticate
QUERY PARAMS
account_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/accounts/:account_id/authenticate");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/accounts/:account_id/authenticate")
require "http/client"
url = "{{baseUrl}}/accounts/:account_id/authenticate"
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}}/accounts/:account_id/authenticate"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/accounts/:account_id/authenticate");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/accounts/:account_id/authenticate"
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/accounts/:account_id/authenticate HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/accounts/:account_id/authenticate")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/accounts/:account_id/authenticate"))
.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}}/accounts/:account_id/authenticate")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/accounts/:account_id/authenticate")
.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}}/accounts/:account_id/authenticate');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/accounts/:account_id/authenticate'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/accounts/:account_id/authenticate';
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}}/accounts/:account_id/authenticate',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/accounts/:account_id/authenticate")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/accounts/:account_id/authenticate',
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}}/accounts/:account_id/authenticate'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/accounts/:account_id/authenticate');
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}}/accounts/:account_id/authenticate'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/accounts/:account_id/authenticate';
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}}/accounts/:account_id/authenticate"]
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}}/accounts/:account_id/authenticate" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/accounts/:account_id/authenticate",
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}}/accounts/:account_id/authenticate');
echo $response->getBody();
setUrl('{{baseUrl}}/accounts/:account_id/authenticate');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/accounts/:account_id/authenticate');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/accounts/:account_id/authenticate' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/accounts/:account_id/authenticate' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/accounts/:account_id/authenticate")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/accounts/:account_id/authenticate"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/accounts/:account_id/authenticate"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/accounts/:account_id/authenticate")
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/accounts/:account_id/authenticate') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/accounts/:account_id/authenticate";
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}}/accounts/:account_id/authenticate
http GET {{baseUrl}}/accounts/:account_id/authenticate
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/accounts/:account_id/authenticate
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/accounts/:account_id/authenticate")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"accounts": [
{
"action": "account.authenticate.get",
"result": "success",
"account": "YgfM1IwpR4qQItQU5SfFMA",
"url": "https://company.onfastspring.com/account/50HsQS1-QcOR3dzEF_rm3w/ydYUZOVrQ24"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"accounts": [
{
"action": "account.authenticate.get",
"account": "123",
"result": "error",
"error": {
"account": "Not found"
}
}
]
}
POST
Update account
{{baseUrl}}/accounts/:account_id
QUERY PARAMS
account_id
BODY json
{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/accounts/:account_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 \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/accounts/:account_id" {:content-type :json
:form-params {:contact {:company ""
:email ""
:first ""
:last ""
:phone ""}}})
require "http/client"
url = "{{baseUrl}}/accounts/:account_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\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}}/accounts/:account_id"),
Content = new StringContent("{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\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}}/accounts/:account_id");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/accounts/:account_id"
payload := strings.NewReader("{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\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/accounts/:account_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 107
{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/accounts/:account_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/accounts/:account_id"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\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 \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/accounts/:account_id")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/accounts/:account_id")
.header("content-type", "application/json")
.body("{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
contact: {
company: '',
email: '',
first: '',
last: '',
phone: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/accounts/:account_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/accounts/:account_id',
headers: {'content-type': 'application/json'},
data: {contact: {company: '', email: '', first: '', last: '', phone: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/accounts/:account_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"contact":{"company":"","email":"","first":"","last":"","phone":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/accounts/:account_id',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "contact": {\n "company": "",\n "email": "",\n "first": "",\n "last": "",\n "phone": ""\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 \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/accounts/:account_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/accounts/:account_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({contact: {company: '', email: '', first: '', last: '', phone: ''}}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/accounts/:account_id',
headers: {'content-type': 'application/json'},
body: {contact: {company: '', email: '', first: '', last: '', phone: ''}},
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}}/accounts/:account_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
contact: {
company: '',
email: '',
first: '',
last: '',
phone: ''
}
});
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}}/accounts/:account_id',
headers: {'content-type': 'application/json'},
data: {contact: {company: '', email: '', first: '', last: '', phone: ''}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/accounts/:account_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"contact":{"company":"","email":"","first":"","last":"","phone":""}}'
};
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 = @{ @"contact": @{ @"company": @"", @"email": @"", @"first": @"", @"last": @"", @"phone": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/accounts/:account_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}}/accounts/:account_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/accounts/:account_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([
'contact' => [
'company' => '',
'email' => '',
'first' => '',
'last' => '',
'phone' => ''
]
]),
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}}/accounts/:account_id', [
'body' => '{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/accounts/:account_id');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'contact' => [
'company' => '',
'email' => '',
'first' => '',
'last' => '',
'phone' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'contact' => [
'company' => '',
'email' => '',
'first' => '',
'last' => '',
'phone' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/accounts/:account_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}}/accounts/:account_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/accounts/:account_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/accounts/:account_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/accounts/:account_id"
payload = { "contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
} }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/accounts/:account_id"
payload <- "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\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}}/accounts/:account_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 \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\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/accounts/:account_id') do |req|
req.body = "{\n \"contact\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/accounts/:account_id";
let payload = json!({"contact": json!({
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
})});
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}}/accounts/:account_id \
--header 'content-type: application/json' \
--data '{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}'
echo '{
"contact": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}
}' | \
http POST {{baseUrl}}/accounts/:account_id \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "contact": {\n "company": "",\n "email": "",\n "first": "",\n "last": "",\n "phone": ""\n }\n}' \
--output-document \
- {{baseUrl}}/accounts/:account_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["contact": [
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/accounts/:account_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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"account": "wjnkDBJnRcGiOB4Q-3AN9w",
"action": "account.create",
"result": "success"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "account.create",
"result": "error",
"error": {
"first": "first invalid",
"last": "last invalid",
"email": "email already exists, /accounts/id",
"custom": "custom invalid",
"country": "country invalid",
"language": "language is invalid"
}
}
POST
Assign codes to a coupon
{{baseUrl}}/coupons/:coupon_id
QUERY PARAMS
coupon_id
BODY json
{
"codes": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/coupons/:coupon_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 \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/coupons/:coupon_id" {:content-type :json
:form-params {:codes ["code4" "code5" "code6"]}})
require "http/client"
url = "{{baseUrl}}/coupons/:coupon_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\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}}/coupons/:coupon_id"),
Content = new StringContent("{\n \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\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}}/coupons/:coupon_id");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/coupons/:coupon_id"
payload := strings.NewReader("{\n \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\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/coupons/:coupon_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 58
{
"codes": [
"code4",
"code5",
"code6"
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/coupons/:coupon_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/coupons/:coupon_id"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\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 \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/coupons/:coupon_id")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/coupons/:coupon_id")
.header("content-type", "application/json")
.body("{\n \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\n ]\n}")
.asString();
const data = JSON.stringify({
codes: [
'code4',
'code5',
'code6'
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/coupons/:coupon_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/coupons/:coupon_id',
headers: {'content-type': 'application/json'},
data: {codes: ['code4', 'code5', 'code6']}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/coupons/:coupon_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"codes":["code4","code5","code6"]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/coupons/:coupon_id',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "codes": [\n "code4",\n "code5",\n "code6"\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 \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/coupons/:coupon_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/coupons/:coupon_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({codes: ['code4', 'code5', 'code6']}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/coupons/:coupon_id',
headers: {'content-type': 'application/json'},
body: {codes: ['code4', 'code5', 'code6']},
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}}/coupons/:coupon_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
codes: [
'code4',
'code5',
'code6'
]
});
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}}/coupons/:coupon_id',
headers: {'content-type': 'application/json'},
data: {codes: ['code4', 'code5', 'code6']}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/coupons/:coupon_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"codes":["code4","code5","code6"]}'
};
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 = @{ @"codes": @[ @"code4", @"code5", @"code6" ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/coupons/:coupon_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}}/coupons/:coupon_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/coupons/:coupon_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([
'codes' => [
'code4',
'code5',
'code6'
]
]),
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}}/coupons/:coupon_id', [
'body' => '{
"codes": [
"code4",
"code5",
"code6"
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/coupons/:coupon_id');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'codes' => [
'code4',
'code5',
'code6'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'codes' => [
'code4',
'code5',
'code6'
]
]));
$request->setRequestUrl('{{baseUrl}}/coupons/:coupon_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}}/coupons/:coupon_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"codes": [
"code4",
"code5",
"code6"
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/coupons/:coupon_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"codes": [
"code4",
"code5",
"code6"
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/coupons/:coupon_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/coupons/:coupon_id"
payload = { "codes": ["code4", "code5", "code6"] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/coupons/:coupon_id"
payload <- "{\n \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\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}}/coupons/:coupon_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 \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\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/coupons/:coupon_id') do |req|
req.body = "{\n \"codes\": [\n \"code4\",\n \"code5\",\n \"code6\"\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/coupons/:coupon_id";
let payload = json!({"codes": ("code4", "code5", "code6")});
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}}/coupons/:coupon_id \
--header 'content-type: application/json' \
--data '{
"codes": [
"code4",
"code5",
"code6"
]
}'
echo '{
"codes": [
"code4",
"code5",
"code6"
]
}' | \
http POST {{baseUrl}}/coupons/:coupon_id \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "codes": [\n "code4",\n "code5",\n "code6"\n ]\n}' \
--output-document \
- {{baseUrl}}/coupons/:coupon_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["codes": ["code4", "code5", "code6"]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/coupons/:coupon_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create a coupon
{{baseUrl}}/coupons
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/coupons");
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 \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/coupons" {:content-type :json
:form-params {:coupon "Black-Friday-2021"
:discount {:hasMultipleDiscounts true
:discounts [{:type "flat"
:amount {:USD 10}
:products ["saas-app-annual"]
:discountPeriodCount nil} {:type "percent"
:percent 25
:products ["saas-app-monthly"]
:discountPeriodCount 3}]}
:combine false
:reason {:en "Black Friday Savings"}
:limit ""
:available {:start "2021-11-24 "
:end "2021-11-29 "}
:codes ["BF21" "BL21"]}})
require "http/client"
url = "{{baseUrl}}/coupons"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\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}}/coupons"),
Content = new StringContent("{\n \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\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}}/coupons");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/coupons"
payload := strings.NewReader("{\n \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\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/coupons HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 668
{
"coupon": "Black-Friday-2021",
"discount": {
"hasMultipleDiscounts": true,
"discounts": [
{
"type": "flat",
"amount": {
"USD": 10
},
"products": [
"saas-app-annual"
],
"discountPeriodCount": null
},
{
"type": "percent",
"percent": 25,
"products": [
"saas-app-monthly"
],
"discountPeriodCount": 3
}
]
},
"combine": false,
"reason": {
"en": "Black Friday Savings"
},
"limit": "",
"available": {
"start": "2021-11-24 ",
"end": "2021-11-29 "
},
"codes": [
"BF21",
"BL21"
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/coupons")
.setHeader("content-type", "application/json")
.setBody("{\n \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/coupons"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\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 \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/coupons")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/coupons")
.header("content-type", "application/json")
.body("{\n \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\n ]\n}")
.asString();
const data = JSON.stringify({
coupon: 'Black-Friday-2021',
discount: {
hasMultipleDiscounts: true,
discounts: [
{
type: 'flat',
amount: {
USD: 10
},
products: [
'saas-app-annual'
],
discountPeriodCount: null
},
{
type: 'percent',
percent: 25,
products: [
'saas-app-monthly'
],
discountPeriodCount: 3
}
]
},
combine: false,
reason: {
en: 'Black Friday Savings'
},
limit: '',
available: {
start: '2021-11-24 ',
end: '2021-11-29 '
},
codes: [
'BF21',
'BL21'
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/coupons');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/coupons',
headers: {'content-type': 'application/json'},
data: {
coupon: 'Black-Friday-2021',
discount: {
hasMultipleDiscounts: true,
discounts: [
{
type: 'flat',
amount: {USD: 10},
products: ['saas-app-annual'],
discountPeriodCount: null
},
{
type: 'percent',
percent: 25,
products: ['saas-app-monthly'],
discountPeriodCount: 3
}
]
},
combine: false,
reason: {en: 'Black Friday Savings'},
limit: '',
available: {start: '2021-11-24 ', end: '2021-11-29 '},
codes: ['BF21', 'BL21']
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/coupons';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"coupon":"Black-Friday-2021","discount":{"hasMultipleDiscounts":true,"discounts":[{"type":"flat","amount":{"USD":10},"products":["saas-app-annual"],"discountPeriodCount":null},{"type":"percent","percent":25,"products":["saas-app-monthly"],"discountPeriodCount":3}]},"combine":false,"reason":{"en":"Black Friday Savings"},"limit":"","available":{"start":"2021-11-24 ","end":"2021-11-29 "},"codes":["BF21","BL21"]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/coupons',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "coupon": "Black-Friday-2021",\n "discount": {\n "hasMultipleDiscounts": true,\n "discounts": [\n {\n "type": "flat",\n "amount": {\n "USD": 10\n },\n "products": [\n "saas-app-annual"\n ],\n "discountPeriodCount": null\n },\n {\n "type": "percent",\n "percent": 25,\n "products": [\n "saas-app-monthly"\n ],\n "discountPeriodCount": 3\n }\n ]\n },\n "combine": false,\n "reason": {\n "en": "Black Friday Savings"\n },\n "limit": "",\n "available": {\n "start": "2021-11-24 ",\n "end": "2021-11-29 "\n },\n "codes": [\n "BF21",\n "BL21"\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 \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/coupons")
.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/coupons',
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({
coupon: 'Black-Friday-2021',
discount: {
hasMultipleDiscounts: true,
discounts: [
{
type: 'flat',
amount: {USD: 10},
products: ['saas-app-annual'],
discountPeriodCount: null
},
{
type: 'percent',
percent: 25,
products: ['saas-app-monthly'],
discountPeriodCount: 3
}
]
},
combine: false,
reason: {en: 'Black Friday Savings'},
limit: '',
available: {start: '2021-11-24 ', end: '2021-11-29 '},
codes: ['BF21', 'BL21']
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/coupons',
headers: {'content-type': 'application/json'},
body: {
coupon: 'Black-Friday-2021',
discount: {
hasMultipleDiscounts: true,
discounts: [
{
type: 'flat',
amount: {USD: 10},
products: ['saas-app-annual'],
discountPeriodCount: null
},
{
type: 'percent',
percent: 25,
products: ['saas-app-monthly'],
discountPeriodCount: 3
}
]
},
combine: false,
reason: {en: 'Black Friday Savings'},
limit: '',
available: {start: '2021-11-24 ', end: '2021-11-29 '},
codes: ['BF21', 'BL21']
},
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}}/coupons');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
coupon: 'Black-Friday-2021',
discount: {
hasMultipleDiscounts: true,
discounts: [
{
type: 'flat',
amount: {
USD: 10
},
products: [
'saas-app-annual'
],
discountPeriodCount: null
},
{
type: 'percent',
percent: 25,
products: [
'saas-app-monthly'
],
discountPeriodCount: 3
}
]
},
combine: false,
reason: {
en: 'Black Friday Savings'
},
limit: '',
available: {
start: '2021-11-24 ',
end: '2021-11-29 '
},
codes: [
'BF21',
'BL21'
]
});
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}}/coupons',
headers: {'content-type': 'application/json'},
data: {
coupon: 'Black-Friday-2021',
discount: {
hasMultipleDiscounts: true,
discounts: [
{
type: 'flat',
amount: {USD: 10},
products: ['saas-app-annual'],
discountPeriodCount: null
},
{
type: 'percent',
percent: 25,
products: ['saas-app-monthly'],
discountPeriodCount: 3
}
]
},
combine: false,
reason: {en: 'Black Friday Savings'},
limit: '',
available: {start: '2021-11-24 ', end: '2021-11-29 '},
codes: ['BF21', 'BL21']
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/coupons';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"coupon":"Black-Friday-2021","discount":{"hasMultipleDiscounts":true,"discounts":[{"type":"flat","amount":{"USD":10},"products":["saas-app-annual"],"discountPeriodCount":null},{"type":"percent","percent":25,"products":["saas-app-monthly"],"discountPeriodCount":3}]},"combine":false,"reason":{"en":"Black Friday Savings"},"limit":"","available":{"start":"2021-11-24 ","end":"2021-11-29 "},"codes":["BF21","BL21"]}'
};
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 = @{ @"coupon": @"Black-Friday-2021",
@"discount": @{ @"hasMultipleDiscounts": @YES, @"discounts": @[ @{ @"type": @"flat", @"amount": @{ @"USD": @10 }, @"products": @[ @"saas-app-annual" ], @"discountPeriodCount": }, @{ @"type": @"percent", @"percent": @25, @"products": @[ @"saas-app-monthly" ], @"discountPeriodCount": @3 } ] },
@"combine": @NO,
@"reason": @{ @"en": @"Black Friday Savings" },
@"limit": @"",
@"available": @{ @"start": @"2021-11-24 ", @"end": @"2021-11-29 " },
@"codes": @[ @"BF21", @"BL21" ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/coupons"]
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}}/coupons" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/coupons",
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([
'coupon' => 'Black-Friday-2021',
'discount' => [
'hasMultipleDiscounts' => null,
'discounts' => [
[
'type' => 'flat',
'amount' => [
'USD' => 10
],
'products' => [
'saas-app-annual'
],
'discountPeriodCount' => null
],
[
'type' => 'percent',
'percent' => 25,
'products' => [
'saas-app-monthly'
],
'discountPeriodCount' => 3
]
]
],
'combine' => null,
'reason' => [
'en' => 'Black Friday Savings'
],
'limit' => '',
'available' => [
'start' => '2021-11-24 ',
'end' => '2021-11-29 '
],
'codes' => [
'BF21',
'BL21'
]
]),
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}}/coupons', [
'body' => '{
"coupon": "Black-Friday-2021",
"discount": {
"hasMultipleDiscounts": true,
"discounts": [
{
"type": "flat",
"amount": {
"USD": 10
},
"products": [
"saas-app-annual"
],
"discountPeriodCount": null
},
{
"type": "percent",
"percent": 25,
"products": [
"saas-app-monthly"
],
"discountPeriodCount": 3
}
]
},
"combine": false,
"reason": {
"en": "Black Friday Savings"
},
"limit": "",
"available": {
"start": "2021-11-24 ",
"end": "2021-11-29 "
},
"codes": [
"BF21",
"BL21"
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/coupons');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'coupon' => 'Black-Friday-2021',
'discount' => [
'hasMultipleDiscounts' => null,
'discounts' => [
[
'type' => 'flat',
'amount' => [
'USD' => 10
],
'products' => [
'saas-app-annual'
],
'discountPeriodCount' => null
],
[
'type' => 'percent',
'percent' => 25,
'products' => [
'saas-app-monthly'
],
'discountPeriodCount' => 3
]
]
],
'combine' => null,
'reason' => [
'en' => 'Black Friday Savings'
],
'limit' => '',
'available' => [
'start' => '2021-11-24 ',
'end' => '2021-11-29 '
],
'codes' => [
'BF21',
'BL21'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'coupon' => 'Black-Friday-2021',
'discount' => [
'hasMultipleDiscounts' => null,
'discounts' => [
[
'type' => 'flat',
'amount' => [
'USD' => 10
],
'products' => [
'saas-app-annual'
],
'discountPeriodCount' => null
],
[
'type' => 'percent',
'percent' => 25,
'products' => [
'saas-app-monthly'
],
'discountPeriodCount' => 3
]
]
],
'combine' => null,
'reason' => [
'en' => 'Black Friday Savings'
],
'limit' => '',
'available' => [
'start' => '2021-11-24 ',
'end' => '2021-11-29 '
],
'codes' => [
'BF21',
'BL21'
]
]));
$request->setRequestUrl('{{baseUrl}}/coupons');
$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}}/coupons' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"coupon": "Black-Friday-2021",
"discount": {
"hasMultipleDiscounts": true,
"discounts": [
{
"type": "flat",
"amount": {
"USD": 10
},
"products": [
"saas-app-annual"
],
"discountPeriodCount": null
},
{
"type": "percent",
"percent": 25,
"products": [
"saas-app-monthly"
],
"discountPeriodCount": 3
}
]
},
"combine": false,
"reason": {
"en": "Black Friday Savings"
},
"limit": "",
"available": {
"start": "2021-11-24 ",
"end": "2021-11-29 "
},
"codes": [
"BF21",
"BL21"
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/coupons' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"coupon": "Black-Friday-2021",
"discount": {
"hasMultipleDiscounts": true,
"discounts": [
{
"type": "flat",
"amount": {
"USD": 10
},
"products": [
"saas-app-annual"
],
"discountPeriodCount": null
},
{
"type": "percent",
"percent": 25,
"products": [
"saas-app-monthly"
],
"discountPeriodCount": 3
}
]
},
"combine": false,
"reason": {
"en": "Black Friday Savings"
},
"limit": "",
"available": {
"start": "2021-11-24 ",
"end": "2021-11-29 "
},
"codes": [
"BF21",
"BL21"
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/coupons", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/coupons"
payload = {
"coupon": "Black-Friday-2021",
"discount": {
"hasMultipleDiscounts": True,
"discounts": [
{
"type": "flat",
"amount": { "USD": 10 },
"products": ["saas-app-annual"],
"discountPeriodCount": None
},
{
"type": "percent",
"percent": 25,
"products": ["saas-app-monthly"],
"discountPeriodCount": 3
}
]
},
"combine": False,
"reason": { "en": "Black Friday Savings" },
"limit": "",
"available": {
"start": "2021-11-24 ",
"end": "2021-11-29 "
},
"codes": ["BF21", "BL21"]
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/coupons"
payload <- "{\n \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\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}}/coupons")
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 \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\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/coupons') do |req|
req.body = "{\n \"coupon\": \"Black-Friday-2021\",\n \"discount\": {\n \"hasMultipleDiscounts\": true,\n \"discounts\": [\n {\n \"type\": \"flat\",\n \"amount\": {\n \"USD\": 10\n },\n \"products\": [\n \"saas-app-annual\"\n ],\n \"discountPeriodCount\": null\n },\n {\n \"type\": \"percent\",\n \"percent\": 25,\n \"products\": [\n \"saas-app-monthly\"\n ],\n \"discountPeriodCount\": 3\n }\n ]\n },\n \"combine\": false,\n \"reason\": {\n \"en\": \"Black Friday Savings\"\n },\n \"limit\": \"\",\n \"available\": {\n \"start\": \"2021-11-24 \",\n \"end\": \"2021-11-29 \"\n },\n \"codes\": [\n \"BF21\",\n \"BL21\"\n ]\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/coupons";
let payload = json!({
"coupon": "Black-Friday-2021",
"discount": json!({
"hasMultipleDiscounts": true,
"discounts": (
json!({
"type": "flat",
"amount": json!({"USD": 10}),
"products": ("saas-app-annual"),
"discountPeriodCount": json!(null)
}),
json!({
"type": "percent",
"percent": 25,
"products": ("saas-app-monthly"),
"discountPeriodCount": 3
})
)
}),
"combine": false,
"reason": json!({"en": "Black Friday Savings"}),
"limit": "",
"available": json!({
"start": "2021-11-24 ",
"end": "2021-11-29 "
}),
"codes": ("BF21", "BL21")
});
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}}/coupons \
--header 'content-type: application/json' \
--data '{
"coupon": "Black-Friday-2021",
"discount": {
"hasMultipleDiscounts": true,
"discounts": [
{
"type": "flat",
"amount": {
"USD": 10
},
"products": [
"saas-app-annual"
],
"discountPeriodCount": null
},
{
"type": "percent",
"percent": 25,
"products": [
"saas-app-monthly"
],
"discountPeriodCount": 3
}
]
},
"combine": false,
"reason": {
"en": "Black Friday Savings"
},
"limit": "",
"available": {
"start": "2021-11-24 ",
"end": "2021-11-29 "
},
"codes": [
"BF21",
"BL21"
]
}'
echo '{
"coupon": "Black-Friday-2021",
"discount": {
"hasMultipleDiscounts": true,
"discounts": [
{
"type": "flat",
"amount": {
"USD": 10
},
"products": [
"saas-app-annual"
],
"discountPeriodCount": null
},
{
"type": "percent",
"percent": 25,
"products": [
"saas-app-monthly"
],
"discountPeriodCount": 3
}
]
},
"combine": false,
"reason": {
"en": "Black Friday Savings"
},
"limit": "",
"available": {
"start": "2021-11-24 ",
"end": "2021-11-29 "
},
"codes": [
"BF21",
"BL21"
]
}' | \
http POST {{baseUrl}}/coupons \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "coupon": "Black-Friday-2021",\n "discount": {\n "hasMultipleDiscounts": true,\n "discounts": [\n {\n "type": "flat",\n "amount": {\n "USD": 10\n },\n "products": [\n "saas-app-annual"\n ],\n "discountPeriodCount": null\n },\n {\n "type": "percent",\n "percent": 25,\n "products": [\n "saas-app-monthly"\n ],\n "discountPeriodCount": 3\n }\n ]\n },\n "combine": false,\n "reason": {\n "en": "Black Friday Savings"\n },\n "limit": "",\n "available": {\n "start": "2021-11-24 ",\n "end": "2021-11-29 "\n },\n "codes": [\n "BF21",\n "BL21"\n ]\n}' \
--output-document \
- {{baseUrl}}/coupons
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"coupon": "Black-Friday-2021",
"discount": [
"hasMultipleDiscounts": true,
"discounts": [
[
"type": "flat",
"amount": ["USD": 10],
"products": ["saas-app-annual"],
"discountPeriodCount":
],
[
"type": "percent",
"percent": 25,
"products": ["saas-app-monthly"],
"discountPeriodCount": 3
]
]
],
"combine": false,
"reason": ["en": "Black Friday Savings"],
"limit": "",
"available": [
"start": "2021-11-24 ",
"end": "2021-11-29 "
],
"codes": ["BF21", "BL21"]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/coupons")! 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
Delete all codes associated with a coupon
{{baseUrl}}/coupons/:coupon_id/codes
QUERY PARAMS
coupon_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/coupons/:coupon_id/codes");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/coupons/:coupon_id/codes")
require "http/client"
url = "{{baseUrl}}/coupons/:coupon_id/codes"
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}}/coupons/:coupon_id/codes"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/coupons/:coupon_id/codes");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/coupons/:coupon_id/codes"
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/coupons/:coupon_id/codes HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/coupons/:coupon_id/codes")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/coupons/:coupon_id/codes"))
.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}}/coupons/:coupon_id/codes")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/coupons/:coupon_id/codes")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/coupons/:coupon_id/codes');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/coupons/:coupon_id/codes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/coupons/:coupon_id/codes';
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}}/coupons/:coupon_id/codes',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/coupons/:coupon_id/codes")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/coupons/:coupon_id/codes',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/coupons/:coupon_id/codes'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/coupons/:coupon_id/codes');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/coupons/:coupon_id/codes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/coupons/:coupon_id/codes';
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}}/coupons/:coupon_id/codes"]
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}}/coupons/:coupon_id/codes" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/coupons/:coupon_id/codes",
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}}/coupons/:coupon_id/codes');
echo $response->getBody();
setUrl('{{baseUrl}}/coupons/:coupon_id/codes');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/coupons/:coupon_id/codes');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/coupons/:coupon_id/codes' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/coupons/:coupon_id/codes' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/coupons/:coupon_id/codes")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/coupons/:coupon_id/codes"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/coupons/:coupon_id/codes"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/coupons/:coupon_id/codes")
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/coupons/:coupon_id/codes') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/coupons/:coupon_id/codes";
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}}/coupons/:coupon_id/codes
http DELETE {{baseUrl}}/coupons/:coupon_id/codes
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/coupons/:coupon_id/codes
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/coupons/:coupon_id/codes")! 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
Get coupon codes assigned to a coupon
{{baseUrl}}/coupons/:coupon_id/codes
QUERY PARAMS
coupon_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/coupons/:coupon_id/codes");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/coupons/:coupon_id/codes")
require "http/client"
url = "{{baseUrl}}/coupons/:coupon_id/codes"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/coupons/:coupon_id/codes"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/coupons/:coupon_id/codes");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/coupons/:coupon_id/codes"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/coupons/:coupon_id/codes HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/coupons/:coupon_id/codes")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/coupons/:coupon_id/codes"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/coupons/:coupon_id/codes")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/coupons/:coupon_id/codes")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/coupons/:coupon_id/codes');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/coupons/:coupon_id/codes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/coupons/:coupon_id/codes';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/coupons/:coupon_id/codes',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/coupons/:coupon_id/codes")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/coupons/:coupon_id/codes',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/coupons/:coupon_id/codes'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/coupons/:coupon_id/codes');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/coupons/:coupon_id/codes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/coupons/:coupon_id/codes';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/coupons/:coupon_id/codes"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/coupons/:coupon_id/codes" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/coupons/:coupon_id/codes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_POSTFIELDS => "",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/coupons/:coupon_id/codes');
echo $response->getBody();
setUrl('{{baseUrl}}/coupons/:coupon_id/codes');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/coupons/:coupon_id/codes');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/coupons/:coupon_id/codes' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/coupons/:coupon_id/codes' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = ""
conn.request("GET", "/baseUrl/coupons/:coupon_id/codes", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/coupons/:coupon_id/codes"
payload = ""
response = requests.get(url, data=payload)
print(response.json())
library(httr)
url <- "{{baseUrl}}/coupons/:coupon_id/codes"
payload <- ""
response <- VERB("GET", url, body = payload, content_type(""))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/coupons/:coupon_id/codes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/coupons/:coupon_id/codes') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/coupons/:coupon_id/codes";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/coupons/:coupon_id/codes
http GET {{baseUrl}}/coupons/:coupon_id/codes
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/coupons/:coupon_id/codes
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/coupons/:coupon_id/codes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"coupon": "AXL",
"codes": [
"AXL1"
]
}
GET
Retrieve coupon details
{{baseUrl}}/coupons/:coupon_id
QUERY PARAMS
coupon_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/coupons/:coupon_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/coupons/:coupon_id")
require "http/client"
url = "{{baseUrl}}/coupons/:coupon_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/coupons/:coupon_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/coupons/:coupon_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/coupons/:coupon_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/coupons/:coupon_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/coupons/:coupon_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/coupons/:coupon_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/coupons/:coupon_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/coupons/:coupon_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/coupons/:coupon_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/coupons/:coupon_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/coupons/:coupon_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/coupons/:coupon_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/coupons/:coupon_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/coupons/:coupon_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/coupons/:coupon_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/coupons/:coupon_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/coupons/:coupon_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/coupons/:coupon_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/coupons/:coupon_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/coupons/:coupon_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/coupons/:coupon_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/coupons/:coupon_id');
echo $response->getBody();
setUrl('{{baseUrl}}/coupons/:coupon_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/coupons/:coupon_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/coupons/:coupon_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/coupons/:coupon_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/coupons/:coupon_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/coupons/:coupon_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/coupons/:coupon_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/coupons/:coupon_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/coupons/:coupon_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/coupons/:coupon_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/coupons/:coupon_id
http GET {{baseUrl}}/coupons/:coupon_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/coupons/:coupon_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/coupons/:coupon_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"coupon": "blackfriday",
"discount": {
"type": "percent",
"percent": 20
},
"combine": false,
"reason": {
"en": "Holiday Savings!"
},
"limit": "1",
"available": {
"start": "2018-11-01 00:00",
"end": "2018-12-25 22:59"
},
"codes": [
"0793PE2TSK",
"0BXB6NMMCT"
],
"products": []
}
GET
Download a report based on job ID.
{{baseUrl}}/data/v1/downloads/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/data/v1/downloads/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/data/v1/downloads/:id")
require "http/client"
url = "{{baseUrl}}/data/v1/downloads/:id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/data/v1/downloads/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/data/v1/downloads/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/data/v1/downloads/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/data/v1/downloads/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/data/v1/downloads/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/data/v1/downloads/:id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/data/v1/downloads/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/data/v1/downloads/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/data/v1/downloads/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/data/v1/downloads/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/data/v1/downloads/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/data/v1/downloads/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/data/v1/downloads/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/data/v1/downloads/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/data/v1/downloads/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/data/v1/downloads/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/data/v1/downloads/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/data/v1/downloads/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/data/v1/downloads/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/data/v1/downloads/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/data/v1/downloads/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/data/v1/downloads/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/data/v1/downloads/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/data/v1/downloads/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/data/v1/downloads/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/data/v1/downloads/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/data/v1/downloads/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/data/v1/downloads/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/data/v1/downloads/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/data/v1/downloads/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/data/v1/downloads/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/data/v1/downloads/:id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/data/v1/downloads/:id
http GET {{baseUrl}}/data/v1/downloads/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/data/v1/downloads/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/data/v1/downloads/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
text/plain
RESPONSE BODY text
arr,subscriptions,subscriber_loss,mrr_add_on,product_name 0.0,1.0,0.0,0.0,primary subscription (addon-subscription)
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"status": "BAD_REQUEST",
"timestamp": "31-08-2022 06:53:43",
"id": "FS2J43PGKSMNEG7LNV7AYLKPJND4",
"message": "Invalid JobId",
"details": null,
"errors": [
{
"erroCode": "invalid",
"field": "jobId",
"message": "Invalid JobId",
"rejectedValue": "JOBZNCFWNVJOZGBFBGBFFFTMEUBP"
}
]
}
POST
Generates a revenue report
{{baseUrl}}/data/v1/revenue
BODY json
{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/data/v1/revenue");
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 \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/data/v1/revenue" {:content-type :json
:form-params {:filter {:startDate ""
:endDate ""
:countryISO []
:productNames []
:productPaths []
:syncDate ""}
:reportColumns []
:groupBy []
:pageCount 0
:pageNumber 0
:async false
:notificationEmails []}})
require "http/client"
url = "{{baseUrl}}/data/v1/revenue"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\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}}/data/v1/revenue"),
Content = new StringContent("{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\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}}/data/v1/revenue");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/data/v1/revenue"
payload := strings.NewReader("{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\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/data/v1/revenue HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 273
{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/data/v1/revenue")
.setHeader("content-type", "application/json")
.setBody("{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/data/v1/revenue"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\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 \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/data/v1/revenue")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/data/v1/revenue")
.header("content-type", "application/json")
.body("{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}")
.asString();
const data = JSON.stringify({
filter: {
startDate: '',
endDate: '',
countryISO: [],
productNames: [],
productPaths: [],
syncDate: ''
},
reportColumns: [],
groupBy: [],
pageCount: 0,
pageNumber: 0,
async: false,
notificationEmails: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/data/v1/revenue');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/data/v1/revenue',
headers: {'content-type': 'application/json'},
data: {
filter: {
startDate: '',
endDate: '',
countryISO: [],
productNames: [],
productPaths: [],
syncDate: ''
},
reportColumns: [],
groupBy: [],
pageCount: 0,
pageNumber: 0,
async: false,
notificationEmails: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/data/v1/revenue';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"filter":{"startDate":"","endDate":"","countryISO":[],"productNames":[],"productPaths":[],"syncDate":""},"reportColumns":[],"groupBy":[],"pageCount":0,"pageNumber":0,"async":false,"notificationEmails":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/data/v1/revenue',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "filter": {\n "startDate": "",\n "endDate": "",\n "countryISO": [],\n "productNames": [],\n "productPaths": [],\n "syncDate": ""\n },\n "reportColumns": [],\n "groupBy": [],\n "pageCount": 0,\n "pageNumber": 0,\n "async": false,\n "notificationEmails": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/data/v1/revenue")
.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/data/v1/revenue',
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({
filter: {
startDate: '',
endDate: '',
countryISO: [],
productNames: [],
productPaths: [],
syncDate: ''
},
reportColumns: [],
groupBy: [],
pageCount: 0,
pageNumber: 0,
async: false,
notificationEmails: []
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/data/v1/revenue',
headers: {'content-type': 'application/json'},
body: {
filter: {
startDate: '',
endDate: '',
countryISO: [],
productNames: [],
productPaths: [],
syncDate: ''
},
reportColumns: [],
groupBy: [],
pageCount: 0,
pageNumber: 0,
async: false,
notificationEmails: []
},
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}}/data/v1/revenue');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
filter: {
startDate: '',
endDate: '',
countryISO: [],
productNames: [],
productPaths: [],
syncDate: ''
},
reportColumns: [],
groupBy: [],
pageCount: 0,
pageNumber: 0,
async: false,
notificationEmails: []
});
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}}/data/v1/revenue',
headers: {'content-type': 'application/json'},
data: {
filter: {
startDate: '',
endDate: '',
countryISO: [],
productNames: [],
productPaths: [],
syncDate: ''
},
reportColumns: [],
groupBy: [],
pageCount: 0,
pageNumber: 0,
async: false,
notificationEmails: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/data/v1/revenue';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"filter":{"startDate":"","endDate":"","countryISO":[],"productNames":[],"productPaths":[],"syncDate":""},"reportColumns":[],"groupBy":[],"pageCount":0,"pageNumber":0,"async":false,"notificationEmails":[]}'
};
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 = @{ @"filter": @{ @"startDate": @"", @"endDate": @"", @"countryISO": @[ ], @"productNames": @[ ], @"productPaths": @[ ], @"syncDate": @"" },
@"reportColumns": @[ ],
@"groupBy": @[ ],
@"pageCount": @0,
@"pageNumber": @0,
@"async": @NO,
@"notificationEmails": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/data/v1/revenue"]
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}}/data/v1/revenue" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/data/v1/revenue",
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([
'filter' => [
'startDate' => '',
'endDate' => '',
'countryISO' => [
],
'productNames' => [
],
'productPaths' => [
],
'syncDate' => ''
],
'reportColumns' => [
],
'groupBy' => [
],
'pageCount' => 0,
'pageNumber' => 0,
'async' => null,
'notificationEmails' => [
]
]),
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}}/data/v1/revenue', [
'body' => '{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/data/v1/revenue');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'filter' => [
'startDate' => '',
'endDate' => '',
'countryISO' => [
],
'productNames' => [
],
'productPaths' => [
],
'syncDate' => ''
],
'reportColumns' => [
],
'groupBy' => [
],
'pageCount' => 0,
'pageNumber' => 0,
'async' => null,
'notificationEmails' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'filter' => [
'startDate' => '',
'endDate' => '',
'countryISO' => [
],
'productNames' => [
],
'productPaths' => [
],
'syncDate' => ''
],
'reportColumns' => [
],
'groupBy' => [
],
'pageCount' => 0,
'pageNumber' => 0,
'async' => null,
'notificationEmails' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/data/v1/revenue');
$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}}/data/v1/revenue' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/data/v1/revenue' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/data/v1/revenue", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/data/v1/revenue"
payload = {
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": False,
"notificationEmails": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/data/v1/revenue"
payload <- "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\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}}/data/v1/revenue")
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 \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\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/data/v1/revenue') do |req|
req.body = "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/data/v1/revenue";
let payload = json!({
"filter": json!({
"startDate": "",
"endDate": "",
"countryISO": (),
"productNames": (),
"productPaths": (),
"syncDate": ""
}),
"reportColumns": (),
"groupBy": (),
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": ()
});
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}}/data/v1/revenue \
--header 'content-type: application/json' \
--data '{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}'
echo '{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}' | \
http POST {{baseUrl}}/data/v1/revenue \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "filter": {\n "startDate": "",\n "endDate": "",\n "countryISO": [],\n "productNames": [],\n "productPaths": [],\n "syncDate": ""\n },\n "reportColumns": [],\n "groupBy": [],\n "pageCount": 0,\n "pageNumber": 0,\n "async": false,\n "notificationEmails": []\n}' \
--output-document \
- {{baseUrl}}/data/v1/revenue
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"filter": [
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
],
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/data/v1/revenue")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"status": "BAD_REQUEST",
"timestamp": "31-08-2022 06:53:43",
"id": "FSPFTG5AL6ORDWRHDZLL5GUIZNAQ",
"message": "< fixed_fee_in_us > field is not valid",
"details": null,
"errors": [
{
"erroCode": "invalid.field",
"field": "fixed_fee_in_us",
"message": "< fixed_fee_in_us > field is not valid",
"rejectedValue": "fixed_fee_in_us"
}
]
}
POST
Generates a subscription report
{{baseUrl}}/data/v1/subscription
BODY json
{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/data/v1/subscription");
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 \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/data/v1/subscription" {:content-type :json
:form-params {:filter {:startDate ""
:endDate ""
:countryISO []
:productNames []
:productPaths []
:syncDate ""}
:reportColumns []
:groupBy []
:pageCount 0
:pageNumber 0
:async false
:notificationEmails []}})
require "http/client"
url = "{{baseUrl}}/data/v1/subscription"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\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}}/data/v1/subscription"),
Content = new StringContent("{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\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}}/data/v1/subscription");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/data/v1/subscription"
payload := strings.NewReader("{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\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/data/v1/subscription HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 273
{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/data/v1/subscription")
.setHeader("content-type", "application/json")
.setBody("{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/data/v1/subscription"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\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 \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/data/v1/subscription")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/data/v1/subscription")
.header("content-type", "application/json")
.body("{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}")
.asString();
const data = JSON.stringify({
filter: {
startDate: '',
endDate: '',
countryISO: [],
productNames: [],
productPaths: [],
syncDate: ''
},
reportColumns: [],
groupBy: [],
pageCount: 0,
pageNumber: 0,
async: false,
notificationEmails: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/data/v1/subscription');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/data/v1/subscription',
headers: {'content-type': 'application/json'},
data: {
filter: {
startDate: '',
endDate: '',
countryISO: [],
productNames: [],
productPaths: [],
syncDate: ''
},
reportColumns: [],
groupBy: [],
pageCount: 0,
pageNumber: 0,
async: false,
notificationEmails: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/data/v1/subscription';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"filter":{"startDate":"","endDate":"","countryISO":[],"productNames":[],"productPaths":[],"syncDate":""},"reportColumns":[],"groupBy":[],"pageCount":0,"pageNumber":0,"async":false,"notificationEmails":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/data/v1/subscription',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "filter": {\n "startDate": "",\n "endDate": "",\n "countryISO": [],\n "productNames": [],\n "productPaths": [],\n "syncDate": ""\n },\n "reportColumns": [],\n "groupBy": [],\n "pageCount": 0,\n "pageNumber": 0,\n "async": false,\n "notificationEmails": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/data/v1/subscription")
.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/data/v1/subscription',
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({
filter: {
startDate: '',
endDate: '',
countryISO: [],
productNames: [],
productPaths: [],
syncDate: ''
},
reportColumns: [],
groupBy: [],
pageCount: 0,
pageNumber: 0,
async: false,
notificationEmails: []
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/data/v1/subscription',
headers: {'content-type': 'application/json'},
body: {
filter: {
startDate: '',
endDate: '',
countryISO: [],
productNames: [],
productPaths: [],
syncDate: ''
},
reportColumns: [],
groupBy: [],
pageCount: 0,
pageNumber: 0,
async: false,
notificationEmails: []
},
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}}/data/v1/subscription');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
filter: {
startDate: '',
endDate: '',
countryISO: [],
productNames: [],
productPaths: [],
syncDate: ''
},
reportColumns: [],
groupBy: [],
pageCount: 0,
pageNumber: 0,
async: false,
notificationEmails: []
});
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}}/data/v1/subscription',
headers: {'content-type': 'application/json'},
data: {
filter: {
startDate: '',
endDate: '',
countryISO: [],
productNames: [],
productPaths: [],
syncDate: ''
},
reportColumns: [],
groupBy: [],
pageCount: 0,
pageNumber: 0,
async: false,
notificationEmails: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/data/v1/subscription';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"filter":{"startDate":"","endDate":"","countryISO":[],"productNames":[],"productPaths":[],"syncDate":""},"reportColumns":[],"groupBy":[],"pageCount":0,"pageNumber":0,"async":false,"notificationEmails":[]}'
};
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 = @{ @"filter": @{ @"startDate": @"", @"endDate": @"", @"countryISO": @[ ], @"productNames": @[ ], @"productPaths": @[ ], @"syncDate": @"" },
@"reportColumns": @[ ],
@"groupBy": @[ ],
@"pageCount": @0,
@"pageNumber": @0,
@"async": @NO,
@"notificationEmails": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/data/v1/subscription"]
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}}/data/v1/subscription" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/data/v1/subscription",
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([
'filter' => [
'startDate' => '',
'endDate' => '',
'countryISO' => [
],
'productNames' => [
],
'productPaths' => [
],
'syncDate' => ''
],
'reportColumns' => [
],
'groupBy' => [
],
'pageCount' => 0,
'pageNumber' => 0,
'async' => null,
'notificationEmails' => [
]
]),
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}}/data/v1/subscription', [
'body' => '{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/data/v1/subscription');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'filter' => [
'startDate' => '',
'endDate' => '',
'countryISO' => [
],
'productNames' => [
],
'productPaths' => [
],
'syncDate' => ''
],
'reportColumns' => [
],
'groupBy' => [
],
'pageCount' => 0,
'pageNumber' => 0,
'async' => null,
'notificationEmails' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'filter' => [
'startDate' => '',
'endDate' => '',
'countryISO' => [
],
'productNames' => [
],
'productPaths' => [
],
'syncDate' => ''
],
'reportColumns' => [
],
'groupBy' => [
],
'pageCount' => 0,
'pageNumber' => 0,
'async' => null,
'notificationEmails' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/data/v1/subscription');
$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}}/data/v1/subscription' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/data/v1/subscription' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/data/v1/subscription", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/data/v1/subscription"
payload = {
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": False,
"notificationEmails": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/data/v1/subscription"
payload <- "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\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}}/data/v1/subscription")
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 \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\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/data/v1/subscription') do |req|
req.body = "{\n \"filter\": {\n \"startDate\": \"\",\n \"endDate\": \"\",\n \"countryISO\": [],\n \"productNames\": [],\n \"productPaths\": [],\n \"syncDate\": \"\"\n },\n \"reportColumns\": [],\n \"groupBy\": [],\n \"pageCount\": 0,\n \"pageNumber\": 0,\n \"async\": false,\n \"notificationEmails\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/data/v1/subscription";
let payload = json!({
"filter": json!({
"startDate": "",
"endDate": "",
"countryISO": (),
"productNames": (),
"productPaths": (),
"syncDate": ""
}),
"reportColumns": (),
"groupBy": (),
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": ()
});
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}}/data/v1/subscription \
--header 'content-type: application/json' \
--data '{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}'
echo '{
"filter": {
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
},
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
}' | \
http POST {{baseUrl}}/data/v1/subscription \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "filter": {\n "startDate": "",\n "endDate": "",\n "countryISO": [],\n "productNames": [],\n "productPaths": [],\n "syncDate": ""\n },\n "reportColumns": [],\n "groupBy": [],\n "pageCount": 0,\n "pageNumber": 0,\n "async": false,\n "notificationEmails": []\n}' \
--output-document \
- {{baseUrl}}/data/v1/subscription
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"filter": [
"startDate": "",
"endDate": "",
"countryISO": [],
"productNames": [],
"productPaths": [],
"syncDate": ""
],
"reportColumns": [],
"groupBy": [],
"pageCount": 0,
"pageNumber": 0,
"async": false,
"notificationEmails": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/data/v1/subscription")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"status": "BAD_REQUEST",
"timestamp": "31-08-2022 06:53:43",
"id": "FSPFTG5AL6ORDWRHDZLL5GUIZNAQ",
"message": "Invalid sql",
"details": null,
"errors": []
}
GET
Get information from a job listing.
{{baseUrl}}/data/v1/jobs
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/data/v1/jobs");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/data/v1/jobs")
require "http/client"
url = "{{baseUrl}}/data/v1/jobs"
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}}/data/v1/jobs"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/data/v1/jobs");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/data/v1/jobs"
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/data/v1/jobs HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/data/v1/jobs")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/data/v1/jobs"))
.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}}/data/v1/jobs")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/data/v1/jobs")
.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}}/data/v1/jobs');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/data/v1/jobs'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/data/v1/jobs';
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}}/data/v1/jobs',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/data/v1/jobs")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/data/v1/jobs',
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}}/data/v1/jobs'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/data/v1/jobs');
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}}/data/v1/jobs'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/data/v1/jobs';
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}}/data/v1/jobs"]
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}}/data/v1/jobs" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/data/v1/jobs",
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}}/data/v1/jobs');
echo $response->getBody();
setUrl('{{baseUrl}}/data/v1/jobs');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/data/v1/jobs');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/data/v1/jobs' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/data/v1/jobs' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/data/v1/jobs")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/data/v1/jobs"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/data/v1/jobs"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/data/v1/jobs")
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/data/v1/jobs') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/data/v1/jobs";
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}}/data/v1/jobs
http GET {{baseUrl}}/data/v1/jobs
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/data/v1/jobs
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/data/v1/jobs")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
[
{
"id": "JOBZNCFWNVJOZGBFBGBFFFTMEUBPM",
"status": "COMPLETE",
"name": "RevenueReport",
"created": "2022-09-08T12:11:01.000Z",
"completeDate": "2022-09-08T12:12:35.000Z",
"downloadUrl": "https://api.fastspring.com/data/v1/downloads/JOBZNCFWNVJOZGBFBGBFFFTMEUBPM",
"notificationEmails": [
"any@fastspring.com"
]
},
{
"id": "JOBZHZNSFRSZVDHDHMWNRJU4D2QNM",
"status": "FAILED",
"name": "SubscriptionReport",
"created": "2022-09-08T12:11:01.000Z",
"notificationEmails": [
"any@fastspring.com"
]
}
]
GET
Get job information based on a job ID.
{{baseUrl}}/data/v1/jobs/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/data/v1/jobs/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/data/v1/jobs/:id")
require "http/client"
url = "{{baseUrl}}/data/v1/jobs/:id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/data/v1/jobs/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/data/v1/jobs/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/data/v1/jobs/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/data/v1/jobs/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/data/v1/jobs/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/data/v1/jobs/:id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/data/v1/jobs/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/data/v1/jobs/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/data/v1/jobs/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/data/v1/jobs/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/data/v1/jobs/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/data/v1/jobs/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/data/v1/jobs/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/data/v1/jobs/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/data/v1/jobs/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/data/v1/jobs/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/data/v1/jobs/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/data/v1/jobs/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/data/v1/jobs/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/data/v1/jobs/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/data/v1/jobs/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/data/v1/jobs/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/data/v1/jobs/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/data/v1/jobs/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/data/v1/jobs/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/data/v1/jobs/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/data/v1/jobs/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/data/v1/jobs/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/data/v1/jobs/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/data/v1/jobs/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/data/v1/jobs/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/data/v1/jobs/:id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/data/v1/jobs/:id
http GET {{baseUrl}}/data/v1/jobs/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/data/v1/jobs/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/data/v1/jobs/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"id": "JOBZNCFWNVJOZGBFBGBFFFTMEUBPM",
"status": "COMPLETE",
"name": "RevenueReport",
"created": "2022-09-08T12:11:01.000Z",
"completeDate": "2022-09-08T12:12:35.000Z",
"downloadUrl": "https://api.fastspring.com/data/v1/downloads/JOBZNCFWNVJOZGBFBGBFFFTMEUBPM",
"notificationEmails": [
"any@fastspring.com"
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"status": "BAD_REQUEST",
"timestamp": "31-08-2022 06:53:43",
"id": "FS2J43PGKSMNEG7LNV7AYLKPJND4",
"message": "Invalid JobId",
"details": null,
"errors": [
{
"erroCode": "invalid",
"field": "jobId",
"message": "Invalid JobId",
"rejectedValue": "JOBZNCFWNVJOZGBFBGBFFFTMEUBP"
}
]
}
GET
Reset cache for data service end points.
{{baseUrl}}/data/v1/util/cache
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/data/v1/util/cache");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/data/v1/util/cache")
require "http/client"
url = "{{baseUrl}}/data/v1/util/cache"
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}}/data/v1/util/cache"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/data/v1/util/cache");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/data/v1/util/cache"
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/data/v1/util/cache HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/data/v1/util/cache")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/data/v1/util/cache"))
.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}}/data/v1/util/cache")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/data/v1/util/cache")
.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}}/data/v1/util/cache');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/data/v1/util/cache'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/data/v1/util/cache';
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}}/data/v1/util/cache',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/data/v1/util/cache")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/data/v1/util/cache',
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}}/data/v1/util/cache'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/data/v1/util/cache');
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}}/data/v1/util/cache'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/data/v1/util/cache';
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}}/data/v1/util/cache"]
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}}/data/v1/util/cache" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/data/v1/util/cache",
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}}/data/v1/util/cache');
echo $response->getBody();
setUrl('{{baseUrl}}/data/v1/util/cache');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/data/v1/util/cache');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/data/v1/util/cache' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/data/v1/util/cache' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/data/v1/util/cache")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/data/v1/util/cache"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/data/v1/util/cache"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/data/v1/util/cache")
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/data/v1/util/cache') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/data/v1/util/cache";
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}}/data/v1/util/cache
http GET {{baseUrl}}/data/v1/util/cache
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/data/v1/util/cache
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/data/v1/util/cache")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
text/plain
RESPONSE BODY text
Cache reset success
GET
Get processed events
{{baseUrl}}/events/processed
QUERY PARAMS
days
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/events/processed?days=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/events/processed" {:query-params {:days ""}})
require "http/client"
url = "{{baseUrl}}/events/processed?days="
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}}/events/processed?days="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/events/processed?days=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/events/processed?days="
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/events/processed?days= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/events/processed?days=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/events/processed?days="))
.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}}/events/processed?days=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/events/processed?days=")
.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}}/events/processed?days=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/events/processed',
params: {days: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/events/processed?days=';
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}}/events/processed?days=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/events/processed?days=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/events/processed?days=',
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}}/events/processed',
qs: {days: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/events/processed');
req.query({
days: ''
});
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}}/events/processed',
params: {days: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/events/processed?days=';
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}}/events/processed?days="]
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}}/events/processed?days=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/events/processed?days=",
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}}/events/processed?days=');
echo $response->getBody();
setUrl('{{baseUrl}}/events/processed');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'days' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/events/processed');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'days' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/events/processed?days=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/events/processed?days=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/events/processed?days=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/events/processed"
querystring = {"days":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/events/processed"
queryString <- list(days = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/events/processed?days=")
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/events/processed') do |req|
req.params['days'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/events/processed";
let querystring = [
("days", ""),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/events/processed?days='
http GET '{{baseUrl}}/events/processed?days='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/events/processed?days='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/events/processed?days=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "events.get",
"result": "success",
"page": null,
"limit": null,
"nextPage": null,
"total": 0,
"events": [
{
"id": "88qMx0P2RZCalzQ5ERXfXA",
"processed": false,
"created": 1542239788941,
"type": "payoutEntry.created",
"live": false,
"data": {
"orderId": "EGr98BxdQ-idUfSZf_g-gw",
"reference": "YES200314-8442-49161",
"live": false,
"order": {
"order": "EGr98BxdQ-idUfSZf_g-gw",
"id": "EGr98BxdQ-idUfSZf_g-gw",
"reference": "YES200314-8442-49161",
"buyerReference": null,
"completed": true,
"changed": 1542239788922,
"changedValue": 1542239788922,
"changedInSeconds": 1542239788,
"changedDisplay": "03/14/20",
"language": "en",
"live": false,
"currency": "USD",
"payoutCurrency": "USD",
"invoiceUrl": "https://youexamplestore.onfastspring.com/account/order/FUR181114-8442-49161/invoice",
"account": "N8FjcSWcQNeYCc-suM1O8g",
"total": 59.99,
"totalDisplay": "$59.99",
"totalInPayoutCurrency": 59.99,
"totalInPayoutCurrencyDisplay": "$59.99",
"tax": 0,
"taxDisplay": "$0.00",
"taxInPayoutCurrency": 0,
"taxInPayoutCurrencyDisplay": "$0.00",
"subtotal": 59.99,
"subtotalDisplay": "$59.99",
"subtotalInPayoutCurrency": 59.99,
"subtotalInPayoutCurrencyDisplay": "$59.99",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"discountWithTax": 0,
"discountWithTaxDisplay": "$0.00",
"discountWithTaxInPayoutCurrency": 0,
"discountWithTaxInPayoutCurrencyDisplay": "$0.00",
"billDescriptor": "FS* fsprg.com",
"payment": {
"type": "test",
"cardEnding": "4242"
},
"customer": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null
},
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
},
"recipients": [
{
"recipient": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null,
"account": "N8FjcSWcQNeYCc-suM1O8g",
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
}
}
}
],
"notes": [],
"items": [
{
"product": "example-product-1",
"quantity": 1,
"display": "Example Product 1",
"sku": "skuex1",
"subtotal": 59.99,
"subtotalDisplay": "$59.99",
"subtotalInPayoutCurrency": 59.99,
"subtotalInPayoutCurrencyDisplay": "$59.99",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"fulfillments": {
"example-product-1_file_2": [
{
"display": "EXAMPLE.EXE",
"size": 129,
"file": "https://yourexamplestore.onfastspring.com/account/file/YES200314-8442-79162F",
"type": "file"
}
],
"example-product-1_license_0": [
{
"license": "Example-aw0r5H3YKBf8w9FNSqI2",
"display": "License Key",
"type": "license"
}
],
"instructions": "Thank you for purchasing Example Product 1. To register, please launch the trial version and select Help | Register Example Product 1. Then, copy and paste the license key above into the License Key field and click Submit."
}
}
]
},
"account": {
"id": "N8FjcSWcQNeYCc-suM1O8g",
"account": "N8FjcSWcQNeYCc-suM1O8g",
"contact": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null
},
"language": "en",
"country": "US",
"lookup": {
"global": "TVWhu0iwQhKJyuhpT_2yMw"
},
"url": "https://yourexamplestore.onfastspring.com/account"
},
"subscriptions": [],
"subtractions": {
"tax": {
"currency": "USD",
"amount": 0,
"percentage": 0
},
"fastspring": {
"currency": "USD",
"amount": 5.3391,
"percentage": 8.9
}
},
"payouts": [
{
"payee": "exmaplepayee",
"currency": "USD",
"payout": "54.65",
"subtotal": 54.65,
"total": "59.99"
}
]
},
"event": "88qMx0P2RZCalzQ5ERXfXA"
},
{
"id": "f_4YLUhbTPyaFhFPMKncWQ",
"processed": false,
"created": 1542239789431,
"type": "order.completed",
"live": false,
"data": {
"order": "EGr98BxdQ-idUfSZf_g-gw",
"id": "EGr98BxdQ-idUfSZf_g-gw",
"reference": "YES200314-8442-49161",
"buyerReference": null,
"completed": true,
"changed": 1542239788922,
"changedValue": 1542239788922,
"changedInSeconds": 1542239788,
"changedDisplay": "03/14/20",
"language": "en",
"live": false,
"currency": "USD",
"payoutCurrency": "USD",
"invoiceUrl": "https://yourexamplestore.onfastspring.com/account/order/YES200314-8442-49161/invoice",
"account": {
"id": "N8FjcSWcQNeYCc-suM1O8g",
"account": "N8FjcSWcQNeYCc-suM1O8g",
"contact": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null
},
"language": "en",
"country": "US",
"lookup": {
"global": "TVWhu0iwQhKJyuhpT_2yMw"
},
"url": "https://yourexamplestore.onfastspring.com/account"
},
"total": 59.99,
"totalDisplay": "$59.99",
"totalInPayoutCurrency": 59.99,
"totalInPayoutCurrencyDisplay": "$59.99",
"tax": 0,
"taxDisplay": "$0.00",
"taxInPayoutCurrency": 0,
"taxInPayoutCurrencyDisplay": "$0.00",
"subtotal": 59.99,
"subtotalDisplay": "$59.99",
"subtotalInPayoutCurrency": 59.99,
"subtotalInPayoutCurrencyDisplay": "$59.99",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"discountWithTax": 0,
"discountWithTaxDisplay": "$0.00",
"discountWithTaxInPayoutCurrency": 0,
"discountWithTaxInPayoutCurrencyDisplay": "$0.00",
"billDescriptor": "FS* fsprg.com",
"payment": {
"type": "test",
"cardEnding": "4242"
},
"customer": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null
},
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
},
"recipients": [
{
"recipient": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null,
"account": {
"id": "N8FjcSWcQNeYCc-suM1O8g",
"account": "N8FjcSWcQNeYCc-suM1O8g",
"contact": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null
},
"language": "en",
"country": "US",
"lookup": {
"global": "TVWhu0iwQhKJyuhpT_2yMw"
},
"url": "https://yourexamplestore.onfastspring.com/account"
},
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
}
}
}
],
"notes": [],
"items": [
{
"product": "example-product-1",
"quantity": 1,
"display": "Example Product 1",
"sku": "skuex1",
"subtotal": 59.99,
"subtotalDisplay": "$59.99",
"subtotalInPayoutCurrency": 59.99,
"subtotalInPayoutCurrencyDisplay": "$59.99",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"fulfillments": {
"example-product-1_file_2": [
{
"display": "EXAMPLE.EXE",
"size": 129,
"file": "https://yourexamplestore.onfastspring.com/account/file/YES200314-8442-79162F",
"type": "file"
}
],
"example-product-1_license_0": [
{
"license": "Example-aw0r5H3YKBf8w9FNSqI2",
"display": "License Key",
"type": "license"
}
],
"instructions": "Thank you for purchasing Example Product 1. To register, please launch the trial version and select Help | Register Examle Product 1. Then, copy and paste the license key above into the License Key field and click Submit."
}
}
]
},
"event": "f_4YLUhbTPyaFhFPMKncWQ"
},
{
"id": "ik6eEaJHSlC-_ML8xzW5RQ",
"processed": false,
"created": 1542240018122,
"type": "mailingListEntry.updated",
"live": false,
"data": {
"id": "0cb4fdfbcf39be1eb6dd6c2032c8397fb7b60f604ba6094c6b261323a7641226",
"list": "subscribed",
"updated": 1542239788792,
"reason": "subscribed",
"order": {
"reference": "YES200314-8442-49161",
"id": "EGr98BxdQ-idUfSZf_g-gw",
"order": "EGr98BxdQ-idUfSZf_g-gw",
"items": [
{
"product": "example-product-1",
"quantity": 1,
"display": "Example Product 1",
"summary": "This is the **Summary** for Example Product 1",
"imageUrl": "https://d8y8nchqlnmka.cloudfront.net/VTetZH1kQD8/x4CxtvLjTBo/example-box.png"
}
]
},
"email": "ne1@all.com",
"firstName": "Marcellus",
"lastName": "Walrus",
"country": "US",
"currency": "USD",
"language": "en",
"storefront": "yourexamplestore"
},
"event": "ik6eEaJHSlC-_ML8xzW5RQ"
}
],
"more": true
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "events.get",
"result": "error",
"error": {
"begin": "Can not parse begin",
"end": "Can not parse end.",
"days": "Can not parse days."
}
}
GET
Get unprocessed events
{{baseUrl}}/events/unprocessed
QUERY PARAMS
begin
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/events/unprocessed?begin=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/events/unprocessed" {:query-params {:begin ""}})
require "http/client"
url = "{{baseUrl}}/events/unprocessed?begin="
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}}/events/unprocessed?begin="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/events/unprocessed?begin=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/events/unprocessed?begin="
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/events/unprocessed?begin= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/events/unprocessed?begin=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/events/unprocessed?begin="))
.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}}/events/unprocessed?begin=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/events/unprocessed?begin=")
.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}}/events/unprocessed?begin=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/events/unprocessed',
params: {begin: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/events/unprocessed?begin=';
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}}/events/unprocessed?begin=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/events/unprocessed?begin=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/events/unprocessed?begin=',
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}}/events/unprocessed',
qs: {begin: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/events/unprocessed');
req.query({
begin: ''
});
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}}/events/unprocessed',
params: {begin: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/events/unprocessed?begin=';
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}}/events/unprocessed?begin="]
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}}/events/unprocessed?begin=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/events/unprocessed?begin=",
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}}/events/unprocessed?begin=');
echo $response->getBody();
setUrl('{{baseUrl}}/events/unprocessed');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'begin' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/events/unprocessed');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'begin' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/events/unprocessed?begin=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/events/unprocessed?begin=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/events/unprocessed?begin=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/events/unprocessed"
querystring = {"begin":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/events/unprocessed"
queryString <- list(begin = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/events/unprocessed?begin=")
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/events/unprocessed') do |req|
req.params['begin'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/events/unprocessed";
let querystring = [
("begin", ""),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/events/unprocessed?begin='
http GET '{{baseUrl}}/events/unprocessed?begin='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/events/unprocessed?begin='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/events/unprocessed?begin=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "events.get",
"result": "success",
"page": null,
"limit": null,
"nextPage": null,
"total": 0,
"events": [
{
"id": "88qMx0P2RZCalzQ5ERXfXA",
"processed": false,
"created": 1542239788941,
"type": "payoutEntry.created",
"live": false,
"data": {
"orderId": "EGr98BxdQ-idUfSZf_g-gw",
"reference": "YES200314-8442-49161",
"live": false,
"order": {
"order": "EGr98BxdQ-idUfSZf_g-gw",
"id": "EGr98BxdQ-idUfSZf_g-gw",
"reference": "YES200314-8442-49161",
"buyerReference": null,
"completed": true,
"changed": 1542239788922,
"changedValue": 1542239788922,
"changedInSeconds": 1542239788,
"changedDisplay": "03/14/20",
"language": "en",
"live": false,
"currency": "USD",
"payoutCurrency": "USD",
"invoiceUrl": "https://youexamplestore.onfastspring.com/account/order/FUR181114-8442-49161/invoice",
"account": "N8FjcSWcQNeYCc-suM1O8g",
"total": 59.99,
"totalDisplay": "$59.99",
"totalInPayoutCurrency": 59.99,
"totalInPayoutCurrencyDisplay": "$59.99",
"tax": 0,
"taxDisplay": "$0.00",
"taxInPayoutCurrency": 0,
"taxInPayoutCurrencyDisplay": "$0.00",
"subtotal": 59.99,
"subtotalDisplay": "$59.99",
"subtotalInPayoutCurrency": 59.99,
"subtotalInPayoutCurrencyDisplay": "$59.99",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"discountWithTax": 0,
"discountWithTaxDisplay": "$0.00",
"discountWithTaxInPayoutCurrency": 0,
"discountWithTaxInPayoutCurrencyDisplay": "$0.00",
"billDescriptor": "FS* fsprg.com",
"payment": {
"type": "test",
"cardEnding": "4242"
},
"customer": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null
},
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
},
"recipients": [
{
"recipient": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null,
"account": "N8FjcSWcQNeYCc-suM1O8g",
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
}
}
}
],
"notes": [],
"items": [
{
"product": "example-product-1",
"quantity": 1,
"display": "Example Product 1",
"sku": "skuex1",
"subtotal": 59.99,
"subtotalDisplay": "$59.99",
"subtotalInPayoutCurrency": 59.99,
"subtotalInPayoutCurrencyDisplay": "$59.99",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"fulfillments": {
"example-product-1_file_2": [
{
"display": "EXAMPLE.EXE",
"size": 129,
"file": "https://yourexamplestore.onfastspring.com/account/file/YES200314-8442-79162F",
"type": "file"
}
],
"example-product-1_license_0": [
{
"license": "Example-aw0r5H3YKBf8w9FNSqI2",
"display": "License Key",
"type": "license"
}
],
"instructions": "Thank you for purchasing Example Product 1. To register, please launch the trial version and select Help | Register Example Product 1. Then, copy and paste the license key above into the License Key field and click Submit."
}
}
]
},
"account": {
"id": "N8FjcSWcQNeYCc-suM1O8g",
"account": "N8FjcSWcQNeYCc-suM1O8g",
"contact": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null
},
"language": "en",
"country": "US",
"lookup": {
"global": "TVWhu0iwQhKJyuhpT_2yMw"
},
"url": "https://yourexamplestore.onfastspring.com/account"
},
"subscriptions": [],
"subtractions": {
"tax": {
"currency": "USD",
"amount": 0,
"percentage": 0
},
"fastspring": {
"currency": "USD",
"amount": 5.3391,
"percentage": 8.9
}
},
"payouts": [
{
"payee": "exmaplepayee",
"currency": "USD",
"payout": "54.65",
"subtotal": 54.65,
"total": "59.99"
}
]
},
"event": "88qMx0P2RZCalzQ5ERXfXA"
},
{
"id": "f_4YLUhbTPyaFhFPMKncWQ",
"processed": false,
"created": 1542239789431,
"type": "order.completed",
"live": false,
"data": {
"order": "EGr98BxdQ-idUfSZf_g-gw",
"id": "EGr98BxdQ-idUfSZf_g-gw",
"reference": "YES200314-8442-49161",
"buyerReference": null,
"completed": true,
"changed": 1542239788922,
"changedValue": 1542239788922,
"changedInSeconds": 1542239788,
"changedDisplay": "03/14/20",
"language": "en",
"live": false,
"currency": "USD",
"payoutCurrency": "USD",
"invoiceUrl": "https://yourexamplestore.onfastspring.com/account/order/YES200314-8442-49161/invoice",
"account": {
"id": "N8FjcSWcQNeYCc-suM1O8g",
"account": "N8FjcSWcQNeYCc-suM1O8g",
"contact": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null
},
"language": "en",
"country": "US",
"lookup": {
"global": "TVWhu0iwQhKJyuhpT_2yMw"
},
"url": "https://yourexamplestore.onfastspring.com/account"
},
"total": 59.99,
"totalDisplay": "$59.99",
"totalInPayoutCurrency": 59.99,
"totalInPayoutCurrencyDisplay": "$59.99",
"tax": 0,
"taxDisplay": "$0.00",
"taxInPayoutCurrency": 0,
"taxInPayoutCurrencyDisplay": "$0.00",
"subtotal": 59.99,
"subtotalDisplay": "$59.99",
"subtotalInPayoutCurrency": 59.99,
"subtotalInPayoutCurrencyDisplay": "$59.99",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"discountWithTax": 0,
"discountWithTaxDisplay": "$0.00",
"discountWithTaxInPayoutCurrency": 0,
"discountWithTaxInPayoutCurrencyDisplay": "$0.00",
"billDescriptor": "FS* fsprg.com",
"payment": {
"type": "test",
"cardEnding": "4242"
},
"customer": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null
},
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
},
"recipients": [
{
"recipient": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null,
"account": {
"id": "N8FjcSWcQNeYCc-suM1O8g",
"account": "N8FjcSWcQNeYCc-suM1O8g",
"contact": {
"first": "Marcellus",
"last": "Walrus",
"email": "ne1@all.com",
"company": "Acme, Inc.",
"phone": null
},
"language": "en",
"country": "US",
"lookup": {
"global": "TVWhu0iwQhKJyuhpT_2yMw"
},
"url": "https://yourexamplestore.onfastspring.com/account"
},
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
}
}
}
],
"notes": [],
"items": [
{
"product": "example-product-1",
"quantity": 1,
"display": "Example Product 1",
"sku": "skuex1",
"subtotal": 59.99,
"subtotalDisplay": "$59.99",
"subtotalInPayoutCurrency": 59.99,
"subtotalInPayoutCurrencyDisplay": "$59.99",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"fulfillments": {
"example-product-1_file_2": [
{
"display": "EXAMPLE.EXE",
"size": 129,
"file": "https://yourexamplestore.onfastspring.com/account/file/YES200314-8442-79162F",
"type": "file"
}
],
"example-product-1_license_0": [
{
"license": "Example-aw0r5H3YKBf8w9FNSqI2",
"display": "License Key",
"type": "license"
}
],
"instructions": "Thank you for purchasing Example Product 1. To register, please launch the trial version and select Help | Register Examle Product 1. Then, copy and paste the license key above into the License Key field and click Submit."
}
}
]
},
"event": "f_4YLUhbTPyaFhFPMKncWQ"
},
{
"id": "ik6eEaJHSlC-_ML8xzW5RQ",
"processed": false,
"created": 1542240018122,
"type": "mailingListEntry.updated",
"live": false,
"data": {
"id": "0cb4fdfbcf39be1eb6dd6c2032c8397fb7b60f604ba6094c6b261323a7641226",
"list": "subscribed",
"updated": 1542239788792,
"reason": "subscribed",
"order": {
"reference": "YES200314-8442-49161",
"id": "EGr98BxdQ-idUfSZf_g-gw",
"order": "EGr98BxdQ-idUfSZf_g-gw",
"items": [
{
"product": "example-product-1",
"quantity": 1,
"display": "Example Product 1",
"summary": "This is the **Summary** for Example Product 1",
"imageUrl": "https://d8y8nchqlnmka.cloudfront.net/VTetZH1kQD8/x4CxtvLjTBo/example-box.png"
}
]
},
"email": "ne1@all.com",
"firstName": "Marcellus",
"lastName": "Walrus",
"country": "US",
"currency": "USD",
"language": "en",
"storefront": "yourexamplestore"
},
"event": "ik6eEaJHSlC-_ML8xzW5RQ"
}
],
"more": true
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "events.get",
"result": "error",
"error": {
"begin": "Can not parse begin",
"end": "Can not parse end.",
"days": "Can not parse days."
}
}
POST
Update an event
{{baseUrl}}/events/:event_id
QUERY PARAMS
event_id
BODY json
{
"processed": false
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/events/:event_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 \"processed\": true\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/events/:event_id" {:content-type :json
:form-params {:processed true}})
require "http/client"
url = "{{baseUrl}}/events/:event_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"processed\": true\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}}/events/:event_id"),
Content = new StringContent("{\n \"processed\": true\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}}/events/:event_id");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"processed\": true\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/events/:event_id"
payload := strings.NewReader("{\n \"processed\": true\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/events/:event_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 23
{
"processed": true
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/events/:event_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"processed\": true\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/events/:event_id"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"processed\": true\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 \"processed\": true\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/events/:event_id")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/events/:event_id")
.header("content-type", "application/json")
.body("{\n \"processed\": true\n}")
.asString();
const data = JSON.stringify({
processed: true
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/events/:event_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/events/:event_id',
headers: {'content-type': 'application/json'},
data: {processed: true}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/events/:event_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"processed":true}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/events/:event_id',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "processed": true\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"processed\": true\n}")
val request = Request.Builder()
.url("{{baseUrl}}/events/:event_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/events/:event_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({processed: true}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/events/:event_id',
headers: {'content-type': 'application/json'},
body: {processed: true},
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}}/events/:event_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
processed: true
});
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}}/events/:event_id',
headers: {'content-type': 'application/json'},
data: {processed: true}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/events/:event_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"processed":true}'
};
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 = @{ @"processed": @YES };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/events/:event_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}}/events/:event_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"processed\": true\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/events/:event_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([
'processed' => 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}}/events/:event_id', [
'body' => '{
"processed": true
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/events/:event_id');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'processed' => null
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'processed' => null
]));
$request->setRequestUrl('{{baseUrl}}/events/:event_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}}/events/:event_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"processed": true
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/events/:event_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"processed": true
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"processed\": true\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/events/:event_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/events/:event_id"
payload = { "processed": True }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/events/:event_id"
payload <- "{\n \"processed\": true\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}}/events/:event_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 \"processed\": true\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/events/:event_id') do |req|
req.body = "{\n \"processed\": true\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/events/:event_id";
let payload = json!({"processed": true});
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}}/events/:event_id \
--header 'content-type: application/json' \
--data '{
"processed": true
}'
echo '{
"processed": true
}' | \
http POST {{baseUrl}}/events/:event_id \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "processed": true\n}' \
--output-document \
- {{baseUrl}}/events/:event_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["processed": true] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/events/:event_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
Get orders by ID
{{baseUrl}}/orders/:order_id
QUERY PARAMS
order_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:order_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/orders/:order_id")
require "http/client"
url = "{{baseUrl}}/orders/:order_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/orders/:order_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/orders/:order_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:order_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/orders/:order_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/orders/:order_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:order_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:order_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/orders/:order_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/orders/:order_id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/orders/:order_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:order_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/orders/:order_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/orders/:order_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/orders/:order_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/orders/:order_id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/orders/:order_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/orders/:order_id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:order_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:order_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/orders/:order_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:order_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/orders/:order_id');
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:order_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/orders/:order_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders/:order_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:order_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/orders/:order_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:order_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:order_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders/:order_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/orders/:order_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders/:order_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/orders/:order_id
http GET {{baseUrl}}/orders/:order_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/orders/:order_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:order_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"order": "oN5eASPKTM2Jwkx15ICNyg",
"id": "oN5eASPKTM2Jwkx15ICNyg",
"reference": "FUR191015-1265-35113",
"buyerReference": null,
"ipAddress": "000.000.00.000",
"completed": true,
"changed": 1571172709980,
"changedValue": 1571172709980,
"changedInSeconds": 1571172709,
"changedDisplay": "10/15/19",
"language": "en",
"live": false,
"currency": "USD",
"payoutCurrency": "USD",
"invoiceUrl": "https://yourexamplestore.onfastspring.com/account/order/YES191015-1265-35113/invoice",
"account": "N8FjcSWcQNeYCc-suM1O8g",
"total": 36.15,
"totalDisplay": "$36.15",
"totalInPayoutCurrency": 36.15,
"totalInPayoutCurrencyDisplay": "$36.15",
"tax": 0,
"taxDisplay": "$0.00",
"taxInPayoutCurrency": 0,
"taxInPayoutCurrencyDisplay": "$0.00",
"subtotal": 36.15,
"subtotalDisplay": "$36.15",
"subtotalInPayoutCurrency": 36.15,
"subtotalInPayoutCurrencyDisplay": "$36.15",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"discountWithTax": 0,
"discountWithTaxDisplay": "$0.00",
"discountWithTaxInPayoutCurrency": 0,
"discountWithTaxInPayoutCurrencyDisplay": "$0.00",
"billDescriptor": "FS* YOUREXAMPLESTORE",
"payment": {
"type": "test",
"creditCard": "visa",
"cardEnding": "4242",
"bank": "sofort"
},
"customer": {
"first": "Leeroy",
"last": "Jenkins",
"email": "ne1@all.com",
"company": null,
"phone": null
},
"address": {
"addressLine1": "801 Garden St.",
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
},
"recipients": [
{
"recipient": {
"first": "Leeroy",
"last": "Jenkins",
"email": "ne1@all.com",
"company": null,
"phone": null,
"account": "N8FjcSWcQNeYCc-suM1O8g",
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
}
}
}
],
"notes": [],
"items": [
{
"product": "example-monthly-subscription",
"quantity": 1,
"display": "Example Monthly Subscription",
"sku": "exsub1",
"subtotal": 14.95,
"subtotalDisplay": "$14.95",
"subtotalInPayoutCurrency": 14.95,
"subtotalInPayoutCurrencyDisplay": "$14.95",
"attributes": {
"CustomAttribute1": "CustomValue1",
"CustomAttribute2": "CustomValue2",
"key": "value"
},
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"coupon": "FREE",
"subscription": "73lsX5kvRsWKLzwRNMkcow",
"fulfillments": {
"example-monthly-subscription_file_0": [
{
"display": "EXAMPLE.exe",
"size": 129,
"file": "https://yourexamplestore.onfastspring.com/account/file/YES191015-1265-46134F",
"type": "file"
}
],
"example-monthly-subscription_license_1": [
{
"license": "s5cMEOpM0zP5KQqD5Wps",
"display": "License Key",
"type": "license"
}
],
"instructions": "Thank you for subscribing to Example Monthly Subscription."
},
"taxWithholding": {
"taxWithholding": "true",
"currency": "USD",
"amount": 23.34,
"percentage": 5
}
},
{
"product": "example-product-2",
"quantity": 1,
"display": "Example Product 2",
"sku": "exprod2",
"subtotal": 9.95,
"subtotalDisplay": "$9.95",
"subtotalInPayoutCurrency": 9.95,
"subtotalInPayoutCurrencyDisplay": "$9.95",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"coupon": "FREE",
"fulfillments": {
"example-product-2_license_0": [
{
"license": "ejTUv8dpuJWZQ5lMN6YE",
"display": "License Key",
"type": "license"
}
],
"example-product-2_file_1": [
{
"display": "EXAMPLE2.exe",
"size": 5769,
"file": "https://yourexamplestore.onfastspring.com/account/file/YES191015-1265-67116F",
"type": "file"
}
]
},
"taxWithholding": {
"taxWithholding": "true",
"currency": "USD",
"amount": 23.34,
"percentage": 5
},
"driver": {
"type": "addon",
"path": "example-monthly-subscription"
}
},
{
"product": "example-monthly-subscription.setupFee",
"quantity": 1,
"display": "One-time Setup Fee",
"sku": null,
"subtotal": 10,
"subtotalDisplay": "$10.00",
"subtotalInPayoutCurrency": 10,
"subtotalInPayoutCurrencyDisplay": "$10.00",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"coupon": "FREE",
"fulfillments": {},
"taxWithholding": {
"taxWithholding": "true",
"currency": "USD",
"amount": 23.34,
"percentage": 5
},
"driver": {
"type": "one_time_fee",
"path": "example-monthly-subscription"
}
},
{
"product": "example-product-3",
"quantity": 1,
"display": "Example Product 3",
"sku": "exprod3",
"subtotal": 1.25,
"subtotalDisplay": "$1.25",
"subtotalInPayoutCurrency": 1.25,
"subtotalInPayoutCurrencyDisplay": "$1.25",
"attributes": {
"conditions": "{exclude:{countries:['AT','GB']}}"
},
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"coupon": "FREE",
"fulfillments": {
"example-product-3_file_1": [
{
"display": "EXAMPLE3.exe",
"size": 5769,
"file": "https://yourexamplestore.onfastspring.com/account/file/YES191015-1265-14137F",
"type": "file"
}
],
"instructions": "Thank you for purchasing Example Product 3. To register, please launch the trial version and select Help -> Register Example Product 3. Then, copy and paste the license key below into the License Key field and click Submit."
},
"taxWithholding": {
"taxWithholding": "true",
"currency": "USD",
"amount": 23.34,
"percentage": 5
},
"driver": {
"type": "cross-sell",
"path": "example-monthly-subscription"
}
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"orders": [
{
"action": "order.get",
"order": "zSprqRHITGeW0kSGC7AKmh",
"result": "error",
"error": {
"order": "Not found"
}
}
]
}
GET
Get orders by date range
{{baseUrl}}/orders?begin=:begin_date&end=:end_date&limit=:limit&page=:page
QUERY PARAMS
begin_date
end_date
limit
page
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/orders" {:query-params {:begin ":begin_date"
:end ":end_date"
:limit ":limit"
:page ":page"}})
require "http/client"
url = "{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage"
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}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage"
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/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage"))
.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}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage")
.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}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/orders',
params: {begin: ':begin_date', end: ':end_date', limit: ':limit', page: ':page'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage';
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}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage',
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}}/orders',
qs: {begin: ':begin_date', end: ':end_date', limit: ':limit', page: ':page'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/orders');
req.query({
begin: ':begin_date',
end: ':end_date',
limit: ':limit',
page: ':page'
});
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}}/orders',
params: {begin: ':begin_date', end: ':end_date', limit: ':limit', page: ':page'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage';
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}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage"]
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}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage",
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}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage');
echo $response->getBody();
setUrl('{{baseUrl}}/orders');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'begin' => ':begin_date',
'end' => ':end_date',
'limit' => ':limit',
'page' => ':page'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/orders');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'begin' => ':begin_date',
'end' => ':end_date',
'limit' => ':limit',
'page' => ':page'
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders"
querystring = {"begin":":begin_date","end":":end_date","limit":":limit","page":":page"}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders"
queryString <- list(
begin = ":begin_date",
end = ":end_date",
limit = ":limit",
page = ":page"
)
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage")
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/orders') do |req|
req.params['begin'] = ':begin_date'
req.params['end'] = ':end_date'
req.params['limit'] = ':limit'
req.params['page'] = ':page'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders";
let querystring = [
("begin", ":begin_date"),
("end", ":end_date"),
("limit", ":limit"),
("page", ":page"),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage'
http GET '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&limit=%3Alimit&page=%3Apage")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "order.lookup",
"result": "success",
"begin": "6/1/16",
"end": "8/30/16",
"page": 4,
"limit": 30,
"nextPage": 5,
"total": 1048,
"orders": [
{
"order": "Qf1jNhlCSKGW5RJdfM7cTg",
"id": "Qf1jNhlCSKGW5RJdfM7cTg",
"reference": "FUR160824-6097-31167",
"buyerReference": null,
"ipAddress": "000.000.00.000",
"completed": true,
"changed": 1472061802969,
"changedValue": 1472061802969,
"changedInSeconds": 1472061802,
"changedDisplay": "8/24/16",
"language": "en",
"live": false,
"currency": "USD",
"account": "cZnOkAUIQ2qCtcrTtyXgYQ",
"payoutCurrency": "USD",
"invoiceUrl": "https://yourexamplestore.onfastspring.com/account/order/YES160824-6097-31167/invoice",
"total": 19.44,
"totalDisplay": "$19.44",
"totalInPayoutCurrency": 19.44,
"totalInPayoutCurrencyDisplay": "$19.44",
"tax": 1.44,
"taxDisplay": "$1.44",
"taxInPayoutCurrency": 1.44,
"taxInPayoutCurrencyDisplay": "$1.44",
"subtotal": 18,
"subtotalDisplay": "$18.00",
"subtotalInPayoutCurrency": 18,
"subtotalInPayoutCurrencyDisplay": "$18.00",
"discount": 2,
"discountDisplay": "$2.00",
"discountInPayoutCurrency": 2,
"discountInPayoutCurrencyDisplay": "$2.00",
"discountWithTax": 2.16,
"discountWithTaxDisplay": "$2.16",
"discountWithTaxInPayoutCurrency": 2.16,
"discountWithTaxInPayoutCurrencyDisplay": "$2.16",
"payment": {
"type": "free",
"creditcard": "visa",
"cardEnding": "4242",
"bank": "sofort"
},
"customer": {
"first": "Reenable",
"last": "MailingList",
"email": "ne1@all.com",
"company": null,
"phone": "1234567890"
},
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
},
"recipients": [
{
"recipient": {
"first": "Reenable",
"last": "MailingList",
"email": "ne1@all.com",
"company": null,
"phone": "1234567890",
"account": "KJRTYQByS_WIcVQ-AZp6kw",
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
}
}
}
],
"notes": [],
"items": [
{
"product": "physical",
"quantity": 1,
"display": "Physical",
"sku": null,
"subtotal": 9,
"subtotalDisplay": "$9.00",
"subtotalInPayoutCurrency": 9,
"subtotalInPayoutCurrencyDisplay": "$9.00",
"attributes": {
"SystemExtension.eds": "true"
},
"discount": 1,
"discountDisplay": "$1.00",
"discountInPayoutCurrency": 1,
"discountInPayoutCurrencyDisplay": "$1.00",
"coupon": "TEST",
"fulfillments": {
"physical_file_0": [
{
"display": "malware.zip",
"size": 4106,
"file": "https://yourexamplestore.onfastspring.com/account/file/YES160824-6097-46172F",
"type": "file"
}
]
}
},
{
"product": "SystemExtension.eds",
"quantity": 1,
"display": "EDS",
"sku": null,
"subtotal": 9,
"subtotalDisplay": "$9.00",
"subtotalInPayoutCurrency": 9,
"subtotalInPayoutCurrencyDisplay": "$9.00",
"attributes": {
"SystemExtension.eds": "true"
},
"discount": 1,
"discountDisplay": "$1.00",
"discountInPayoutCurrency": 1,
"discountInPayoutCurrencyDisplay": "$1.00",
"coupon": "TEST",
"fulfillments": {}
}
],
"coupons": [
"TEST"
]
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "order.lookup",
"result": "error",
"error": {
"begin": "Invalid begin date",
"end": "End date must be after begin date"
}
}
GET
Get orders by end date
{{baseUrl}}/orders?end=:end_date
QUERY PARAMS
end_date
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders?end=%3Aend_date");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/orders" {:query-params {:end ":end_date"}})
require "http/client"
url = "{{baseUrl}}/orders?end=%3Aend_date"
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}}/orders?end=%3Aend_date"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/orders?end=%3Aend_date");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders?end=%3Aend_date"
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/orders?end=%3Aend_date HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/orders?end=%3Aend_date")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders?end=%3Aend_date"))
.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}}/orders?end=%3Aend_date")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/orders?end=%3Aend_date")
.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}}/orders?end=%3Aend_date');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/orders',
params: {end: ':end_date'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders?end=%3Aend_date';
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}}/orders?end=%3Aend_date',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/orders?end=%3Aend_date")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/orders?end=%3Aend_date',
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}}/orders',
qs: {end: ':end_date'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/orders');
req.query({
end: ':end_date'
});
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}}/orders',
params: {end: ':end_date'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders?end=%3Aend_date';
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}}/orders?end=%3Aend_date"]
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}}/orders?end=%3Aend_date" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders?end=%3Aend_date",
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}}/orders?end=%3Aend_date');
echo $response->getBody();
setUrl('{{baseUrl}}/orders');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'end' => ':end_date'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/orders');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'end' => ':end_date'
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders?end=%3Aend_date' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders?end=%3Aend_date' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/orders?end=%3Aend_date")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders"
querystring = {"end":":end_date"}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders"
queryString <- list(end = ":end_date")
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders?end=%3Aend_date")
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/orders') do |req|
req.params['end'] = ':end_date'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders";
let querystring = [
("end", ":end_date"),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/orders?end=%3Aend_date'
http GET '{{baseUrl}}/orders?end=%3Aend_date'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/orders?end=%3Aend_date'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders?end=%3Aend_date")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "order.lookup",
"result": "success",
"end": "6/30/16",
"page": 1,
"limit": 50,
"nextPage": null,
"total": 9,
"orders": [
{
"order": "US5oKN5sRU2OUWxVwivl_Q",
"id": "US5oKN5sRU2OUWxVwivl_Q",
"reference": "FUR160629-3229-57108B",
"buyerReference": null,
"ipAddress": "000.000.00.000",
"completed": true,
"changed": 1467239032151,
"changedValue": 1467239032151,
"changedInSeconds": 1467239032,
"changedDisplay": "6/29/16",
"language": "en",
"live": false,
"currency": "USD",
"account": "E93cH9zLS6ebdnrUjCYLFA",
"payoutCurrency": "USD",
"invoiceUrl": "https://yourexamplestore.onfastspring.com/account/order/YES160629-3229-57108B/invoice",
"total": 10,
"totalDisplay": "USD 10.00",
"totalInPayoutCurrency": 10,
"totalInPayoutCurrencyDisplay": "USD 10.00",
"tax": 0,
"taxDisplay": "USD 0.00",
"taxInPayoutCurrency": 0,
"taxInPayoutCurrencyDisplay": "USD 0.00",
"subtotal": 10,
"subtotalDisplay": "USD 10.00",
"subtotalInPayoutCurrency": 10,
"subtotalInPayoutCurrencyDisplay": "USD 10.00",
"discount": 0,
"discountDisplay": "USD 0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "USD 0.00",
"discountWithTax": 0,
"discountWithTaxDisplay": "USD 0.00",
"discountWithTaxInPayoutCurrency": 0,
"discountWithTaxInPayoutCurrencyDisplay": "USD 0.00",
"payment": {
"type": "free",
"creditcard": "visa",
"cardEnding": "4242",
"bank": "sofort"
},
"customer": {
"first": "test",
"last": "test",
"email": "ne1@all.com",
"company": null,
"phone": "1234567890"
},
"address": {
"addressLine1": "272 Gonghang-ro",
"city": "Jung-gu",
"region": "Incheon",
"postalCode": "40765",
"country": "KR",
"display": "272 Gonghang-ro, Jung-gu, Incheon, 40765, KR"
},
"recipients": [
{
"recipient": {
"first": "test",
"last": "test",
"email": "ne1@all.com",
"company": null,
"phone": 1234567890,
"account": "E93cH9zLS6ebdnrUjCYLFA",
"address": {
"addressLine1": "272 Gonghang-ro",
"city": "Jung-gu",
"region": "Incheon",
"postalCode": "40765",
"country": "KR",
"display": "272 Gonghang-ro, Jung-gu, Incheon, 40765, KR"
}
}
}
],
"notes": [],
"items": [
{
"product": "firstsub",
"quantity": 1,
"display": "firstSub",
"sku": null,
"subtotal": 10,
"subtotalDisplay": "USD 10.00",
"subtotalInPayoutCurrency": 10,
"subtotalInPayoutCurrencyDisplay": "USD 10.00",
"discount": 0,
"discountDisplay": "USD 0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "USD 0.00",
"subscription": "1hrkNaKxRyizVyj_Lv9RCA"
}
]
}
]
}
GET
Get orders by product path AND date range
{{baseUrl}}/orders?products=:product_path&begin=:begin_date&end=:end_date
QUERY PARAMS
product_path
begin_date
end_date
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/orders" {:query-params {:products ":product_path"
:begin ":begin_date"
:end ":end_date"}})
require "http/client"
url = "{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date"
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}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date"
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/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date"))
.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}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date")
.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}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/orders',
params: {products: ':product_path', begin: ':begin_date', end: ':end_date'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date';
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}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date',
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}}/orders',
qs: {products: ':product_path', begin: ':begin_date', end: ':end_date'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/orders');
req.query({
products: ':product_path',
begin: ':begin_date',
end: ':end_date'
});
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}}/orders',
params: {products: ':product_path', begin: ':begin_date', end: ':end_date'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date';
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}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date"]
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}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date",
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}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date');
echo $response->getBody();
setUrl('{{baseUrl}}/orders');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'products' => ':product_path',
'begin' => ':begin_date',
'end' => ':end_date'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/orders');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'products' => ':product_path',
'begin' => ':begin_date',
'end' => ':end_date'
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders"
querystring = {"products":":product_path","begin":":begin_date","end":":end_date"}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders"
queryString <- list(
products = ":product_path",
begin = ":begin_date",
end = ":end_date"
)
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date")
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/orders') do |req|
req.params['products'] = ':product_path'
req.params['begin'] = ':begin_date'
req.params['end'] = ':end_date'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders";
let querystring = [
("products", ":product_path"),
("begin", ":begin_date"),
("end", ":end_date"),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date'
http GET '{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders?products=%3Aproduct_path&begin=%3Abegin_date&end=%3Aend_date")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "order.lookup",
"result": "success",
"begin": "6/1/16",
"end": "7/30/16",
"page": 1,
"limit": 10,
"nextPage": null,
"total": 5,
"orders": [
{
"order": "sHwVlGLER9qJHKr6lkX5oA",
"id": "sHwVlGLER9qJHKr6lkX5oA",
"reference": "FUR160710-2490-94117",
"buyerReference": null,
"ipAddress": "000.000.00.000",
"completed": true,
"changed": 1468120080887,
"changedValue": 1468120080887,
"changedInSeconds": 1468120080,
"changedDisplay": "7/10/16",
"language": "en",
"live": false,
"currency": "USD",
"account": "E93cH9zLS6ebdnrUjCYLFA",
"payoutCurrency": "USD",
"invoiceUrl": "https://yourexamplestore.onfastspring.com/account/order/YES160710-2490-94117/invoice",
"total": 66.96,
"totalDisplay": "$66.96",
"totalInPayoutCurrency": 66.96,
"totalInPayoutCurrencyDisplay": "$66.96",
"tax": 4.96,
"taxDisplay": "$4.96",
"taxInPayoutCurrency": 4.96,
"taxInPayoutCurrencyDisplay": "$4.96",
"subtotal": 62,
"subtotalDisplay": "$62.00",
"subtotalInPayoutCurrency": 62,
"subtotalInPayoutCurrencyDisplay": "$62.00",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"discountWithTax": 0,
"discountWithTaxDisplay": "$0.00",
"discountWithTaxInPayoutCurrency": 0,
"discountWithTaxInPayoutCurrencyDisplay": "$0.00",
"payment": {
"type": "free",
"creditcard": "visa",
"cardEnding": "4242",
"bank": "sofort"
},
"customer": {
"first": "test",
"last": "order",
"email": "ne1@all.com",
"company": null,
"phone": "1234567890"
},
"address": {
"addressLine1": "801 Garden Street",
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
},
"recipients": [
{
"recipient": {
"first": "New",
"last": "Order",
"email": "ne1@all.com",
"company": null,
"phone": "1234567890",
"account": "KJRTYQByS_WIcVQ-AZp6kw",
"address": {
"addressLine1": "801 Garden Street",
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
}
}
}
],
"notes": [],
"items": [
{
"product": "testbundle",
"quantity": 3,
"display": "TestBundle",
"sku": null,
"subtotal": 30,
"subtotalDisplay": "$30.00",
"subtotalInPayoutCurrency": 30,
"subtotalInPayoutCurrencyDisplay": "$30.00",
"attributes": {
"SystemExtension.eds": "true"
},
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"fulfillments": {}
},
{
"product": "physical",
"quantity": 3,
"display": "Physical",
"sku": null,
"subtotal": 0,
"subtotalDisplay": "$0.00",
"subtotalInPayoutCurrency": 0,
"subtotalInPayoutCurrencyDisplay": "$0.00",
"attributes": {
"SystemExtension.eds": "true"
},
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"fulfillments": {
"physical_file_0": [
{
"display": "malware.zip",
"size": 4106,
"file": "https://automation.test.qa.onfastspring.com/account/file/YES160710-2490-43134F",
"type": "file"
}
]
}
},
{
"product": "firstsub",
"quantity": 3,
"display": "firstSub",
"sku": null,
"subtotal": 0,
"subtotalDisplay": "$0.00",
"subtotalInPayoutCurrency": 0,
"subtotalInPayoutCurrencyDisplay": "$0.00",
"attributes": {
"SystemExtension.eds": "true"
},
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"subscription": "KNj-JrZyQ7i2yALyv5nv7Q",
"fulfillments": {
"firstsub_license_0": [
{
"license": "1",
"display": "License Key",
"type": "license"
}
],
"firstsub_file_0": [
{
"display": "poty2006.zip",
"size": 538835908,
"file": "https://automation.test.qa.onfastspring.com/account/file/YES160710-2490-80119F",
"type": "file"
}
]
}
},
{
"product": "digitalphysical",
"quantity": 1,
"display": "digitalPhysical",
"sku": null,
"subtotal": 10,
"subtotalDisplay": "$10.00",
"subtotalInPayoutCurrency": 10,
"subtotalInPayoutCurrencyDisplay": "$10.00",
"attributes": {
"SystemExtension.eds": "true"
},
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"fulfillments": {
"digitalphysical_file_0": [
{
"display": "Anaconda2-2.4.1-MacOSX-x86_64.pkg",
"size": 257787337,
"file": "https://automation.test.qa.onfastspring.com/account/file/YES160710-2490-25147F",
"type": "file"
}
]
}
},
{
"product": "SystemExtension.shippingcalculation",
"quantity": 1,
"display": "Shipping",
"sku": null,
"subtotal": 12,
"subtotalDisplay": "$12.00",
"subtotalInPayoutCurrency": 12,
"subtotalInPayoutCurrencyDisplay": "$12.00",
"attributes": {
"SystemExtension.eds": "true"
},
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"fulfillments": {}
},
{
"product": "SystemExtension.eds",
"quantity": 1,
"display": "EDS",
"sku": null,
"subtotal": 10,
"subtotalDisplay": "$10.00",
"subtotalInPayoutCurrency": 10,
"subtotalInPayoutCurrencyDisplay": "$10.00",
"attributes": {
"SystemExtension.eds": "true"
},
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"fulfillments": {}
}
]
}
]
}
GET
Get orders by product path
{{baseUrl}}/orders?products=:product_path&limit=:limit&page=:page
QUERY PARAMS
product_path
limit
page
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/orders" {:query-params {:products ":product_path"
:limit ":limit"
:page ":page"}})
require "http/client"
url = "{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage"
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}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage"
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/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage"))
.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}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage")
.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}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/orders',
params: {products: ':product_path', limit: ':limit', page: ':page'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage';
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}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage',
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}}/orders',
qs: {products: ':product_path', limit: ':limit', page: ':page'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/orders');
req.query({
products: ':product_path',
limit: ':limit',
page: ':page'
});
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}}/orders',
params: {products: ':product_path', limit: ':limit', page: ':page'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage';
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}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage"]
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}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage",
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}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage');
echo $response->getBody();
setUrl('{{baseUrl}}/orders');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'products' => ':product_path',
'limit' => ':limit',
'page' => ':page'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/orders');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'products' => ':product_path',
'limit' => ':limit',
'page' => ':page'
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders"
querystring = {"products":":product_path","limit":":limit","page":":page"}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders"
queryString <- list(
products = ":product_path",
limit = ":limit",
page = ":page"
)
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage")
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/orders') do |req|
req.params['products'] = ':product_path'
req.params['limit'] = ':limit'
req.params['page'] = ':page'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders";
let querystring = [
("products", ":product_path"),
("limit", ":limit"),
("page", ":page"),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage'
http GET '{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders?products=%3Aproduct_path&limit=%3Alimit&page=%3Apage")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "order.lookup",
"result": "success",
"page": 1,
"limit": 20,
"nextPage": 2,
"total": 1006,
"orders": [
{
"order": "nlqoczuZSaGKzuNNK5IDiQ",
"id": "nlqoczuZSaGKzuNNK5IDiQ",
"reference": null,
"buyerReference": null,
"ipAddress": "000.000.00.000",
"completed": false,
"changed": 1471997419992,
"changedValue": 1471997419992,
"changedInSeconds": 1471997419,
"changedDisplay": "8/24/16",
"language": "en",
"live": false,
"currency": "USD",
"account": "KJRTYQByS_WIcVQ-AZp6kw",
"payoutCurrency": "USD",
"invoiceUrl": "https://yourexamplestore.onfastspring.com/account/order/null/invoice",
"total": 10,
"totalDisplay": "$10.00",
"totalInPayoutCurrency": 10,
"totalInPayoutCurrencyDisplay": "$10.00",
"tax": 0,
"taxDisplay": "$0.00",
"taxInPayoutCurrency": 0,
"taxInPayoutCurrencyDisplay": "$0.00",
"subtotal": 10,
"subtotalDisplay": "$10.00",
"subtotalInPayoutCurrency": 10,
"subtotalInPayoutCurrencyDisplay": "$10.00",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"discountWithTax": 0,
"discountWithTaxDisplay": "$0.00",
"discountWithTaxInPayoutCurrency": 0,
"discountWithTaxInPayoutCurrencyDisplay": "$0.00",
"payment": {},
"customer": {
"first": "New",
"last": "Order",
"email": "ne1@all.com",
"company": null,
"phone": "1234567890"
},
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
},
"recipients": [
{
"recipient": {
"first": "New",
"last": "Order",
"email": "ne1@all.com",
"company": null,
"phone": "1234567890",
"account": "KJRTYQByS_WIcVQ-AZp6kw",
"address": {
"city": "Santa Barbara",
"regionCode": "CA",
"regionDisplay": "California",
"region": "California",
"postalCode": "93101",
"country": "US",
"display": "Santa Barbara, California, 93101, US"
}
}
}
],
"notes": [],
"items": [
{
"product": "suba",
"quantity": 1,
"display": "PaymentReminderBeforeUpdate",
"sku": "SKU111",
"subtotal": 10,
"subtotalDisplay": "$10.00",
"subtotalInPayoutCurrency": 10,
"subtotalInPayoutCurrencyDisplay": "$10.00",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"subscription": "YDnZ-ExrQ3mWe0YTmSsQaQ"
}
]
}
]
}
GET
Get orders with returns only
{{baseUrl}}/orders?begin=:begin_date&end=:end_date&returns=:return
QUERY PARAMS
begin_date
end_date
return
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/orders" {:query-params {:begin ":begin_date"
:end ":end_date"
:returns ":return"}})
require "http/client"
url = "{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn"
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}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn"
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/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn"))
.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}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn")
.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}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/orders',
params: {begin: ':begin_date', end: ':end_date', returns: ':return'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn';
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}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn',
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}}/orders',
qs: {begin: ':begin_date', end: ':end_date', returns: ':return'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/orders');
req.query({
begin: ':begin_date',
end: ':end_date',
returns: ':return'
});
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}}/orders',
params: {begin: ':begin_date', end: ':end_date', returns: ':return'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn';
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}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn"]
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}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn",
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}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn');
echo $response->getBody();
setUrl('{{baseUrl}}/orders');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'begin' => ':begin_date',
'end' => ':end_date',
'returns' => ':return'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/orders');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'begin' => ':begin_date',
'end' => ':end_date',
'returns' => ':return'
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders"
querystring = {"begin":":begin_date","end":":end_date","returns":":return"}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders"
queryString <- list(
begin = ":begin_date",
end = ":end_date",
returns = ":return"
)
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn")
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/orders') do |req|
req.params['begin'] = ':begin_date'
req.params['end'] = ':end_date'
req.params['returns'] = ':return'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders";
let querystring = [
("begin", ":begin_date"),
("end", ":end_date"),
("returns", ":return"),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn'
http GET '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders?begin=%3Abegin_date&end=%3Aend_date&returns=%3Areturn")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "order.lookup",
"result": "success",
"begin": "7/16/18",
"end": "7/17/18",
"page": 1,
"limit": 50,
"nextPage": null,
"total": 1,
"orders": [
{
"order": "sLvABUuPTOmxuxxme6zyBA",
"id": "sLvABUuPTOmxuxxme6zyBA",
"reference": "FUR180716-1320-39108",
"buyerReference": null,
"ipAddress": "000.000.00.000",
"completed": true,
"changed": 1531768631874,
"changedValue": 1531768631874,
"changedInSeconds": 1531768631,
"changedDisplay": "7/16/18",
"language": "en",
"live": false,
"currency": "USD",
"payoutCurrency": "USD",
"invoiceUrl": "https://yourexamplestore.onfastspring.com/account/order/YES180716-1320-39108/invoice",
"account": "5ta9yueaQ2mlc3UeSZi2Ew",
"total": 59.99,
"totalDisplay": "USD 59.99",
"totalInPayoutCurrency": 59.99,
"totalInPayoutCurrencyDisplay": "USD 59.99",
"tax": 0,
"taxDisplay": "USD 0.00",
"taxInPayoutCurrency": 0,
"taxInPayoutCurrencyDisplay": "USD 0.00",
"subtotal": 59.99,
"subtotalDisplay": "USD 59.99",
"subtotalInPayoutCurrency": 59.99,
"subtotalInPayoutCurrencyDisplay": "USD 59.99",
"discount": 0,
"discountDisplay": "USD 0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "USD 0.00",
"discountWithTax": 0,
"discountWithTaxDisplay": "USD 0.00",
"discountWithTaxInPayoutCurrency": 0,
"discountWithTaxInPayoutCurrencyDisplay": "USD 0.00",
"billDescriptor": "FS* fsprg.com",
"payment": {
"type": "test",
"cardEnding": "4242"
},
"customer": {
"first": "John",
"last": "Doe",
"email": "ne1@all.com",
"company": null,
"phone": null
},
"address": {
"addressLine1": "123 Elm St",
"city": "Lisbon",
"regionDisplay": "",
"region": "",
"postalCode": "93101",
"country": "DE",
"display": "123 Elm St, Lisbon, , 93101, DE"
},
"recipients": [
{
"recipient": {
"first": "John",
"last": "Doe",
"email": "ne1@all.com",
"company": null,
"phone": null,
"account": "5ta9yueaQ2mlc3UeSZi2Ew",
"address": {
"addressLine1": "123 Elm St",
"city": "Lisbon",
"regionDisplay": "",
"region": "",
"postalCode": "93101",
"country": "DE",
"display": "123 Elm St, Lisbon, , 93101, DE"
}
}
}
],
"notes": [],
"items": [
{
"product": "example-product-1",
"quantity": 1,
"display": "Example Product 1",
"sku": "exprod1",
"subtotal": 59.99,
"subtotalDisplay": "USD 59.99",
"subtotalInPayoutCurrency": 59.99,
"subtotalInPayoutCurrencyDisplay": "USD 59.99",
"discount": 0,
"discountDisplay": "USD 0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "USD 0.00",
"fulfillments": {
"example-product-1_license_0": [
{
"license": "Example-8QEl7sD8FKI56r4siL9c",
"display": "License Key",
"type": "license"
}
],
"example-product-1_file_2": [
{
"display": "EXAMPLE.EXE",
"size": 129,
"file": "https://yourexamplestore.onfastspring.com/account/file/YES180716-1320-64112F",
"type": "file"
}
],
"instructions": "Thank you for purchasing Example Product 1."
}
}
],
"returns": [
{
"return": "YxCkQcnTR_iX1iZJgQly8Q",
"amount": 59.99,
"amountDisplay": "USD 59.99",
"amountInPayoutCurrency": 59.99,
"amountInPayoutCurrencyDisplay": "USD 59.99"
}
]
}
]
}
POST
Update order tags and attributes
{{baseUrl}}/orders
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\n ]\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/orders" {:content-type :json
:form-params {:orders [{:order "JL4ltRyBSTS0myETu7yJIA"
:tags {:TagKey1 "TagValue1"
:TagKey2 "TagValue2"}
:items [{:product "product-path"
:attributes {:AttributeKey1 "AttributeValue1"
:AttributeKey2 "AttributeValue2"}}]}]}})
require "http/client"
url = "{{baseUrl}}/orders"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\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}}/orders"),
Content = new StringContent("{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\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}}/orders");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\n ]\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders"
payload := strings.NewReader("{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\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/orders HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 377
{
"orders": [
{
"order": "JL4ltRyBSTS0myETu7yJIA",
"tags": {
"TagKey1": "TagValue1",
"TagKey2": "TagValue2"
},
"items": [
{
"product": "product-path",
"attributes": {
"AttributeKey1": "AttributeValue1",
"AttributeKey2": "AttributeValue2"
}
}
]
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/orders")
.setHeader("content-type", "application/json")
.setBody("{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\n ]\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\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 \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\n ]\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/orders")
.header("content-type", "application/json")
.body("{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\n ]\n }\n ]\n}")
.asString();
const data = JSON.stringify({
orders: [
{
order: 'JL4ltRyBSTS0myETu7yJIA',
tags: {
TagKey1: 'TagValue1',
TagKey2: 'TagValue2'
},
items: [
{
product: 'product-path',
attributes: {
AttributeKey1: 'AttributeValue1',
AttributeKey2: 'AttributeValue2'
}
}
]
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/orders');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/orders',
headers: {'content-type': 'application/json'},
data: {
orders: [
{
order: 'JL4ltRyBSTS0myETu7yJIA',
tags: {TagKey1: 'TagValue1', TagKey2: 'TagValue2'},
items: [
{
product: 'product-path',
attributes: {AttributeKey1: 'AttributeValue1', AttributeKey2: 'AttributeValue2'}
}
]
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"orders":[{"order":"JL4ltRyBSTS0myETu7yJIA","tags":{"TagKey1":"TagValue1","TagKey2":"TagValue2"},"items":[{"product":"product-path","attributes":{"AttributeKey1":"AttributeValue1","AttributeKey2":"AttributeValue2"}}]}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/orders',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "orders": [\n {\n "order": "JL4ltRyBSTS0myETu7yJIA",\n "tags": {\n "TagKey1": "TagValue1",\n "TagKey2": "TagValue2"\n },\n "items": [\n {\n "product": "product-path",\n "attributes": {\n "AttributeKey1": "AttributeValue1",\n "AttributeKey2": "AttributeValue2"\n }\n }\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 \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\n ]\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/orders',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
orders: [
{
order: 'JL4ltRyBSTS0myETu7yJIA',
tags: {TagKey1: 'TagValue1', TagKey2: 'TagValue2'},
items: [
{
product: 'product-path',
attributes: {AttributeKey1: 'AttributeValue1', AttributeKey2: 'AttributeValue2'}
}
]
}
]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/orders',
headers: {'content-type': 'application/json'},
body: {
orders: [
{
order: 'JL4ltRyBSTS0myETu7yJIA',
tags: {TagKey1: 'TagValue1', TagKey2: 'TagValue2'},
items: [
{
product: 'product-path',
attributes: {AttributeKey1: 'AttributeValue1', AttributeKey2: 'AttributeValue2'}
}
]
}
]
},
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}}/orders');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
orders: [
{
order: 'JL4ltRyBSTS0myETu7yJIA',
tags: {
TagKey1: 'TagValue1',
TagKey2: 'TagValue2'
},
items: [
{
product: 'product-path',
attributes: {
AttributeKey1: 'AttributeValue1',
AttributeKey2: 'AttributeValue2'
}
}
]
}
]
});
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}}/orders',
headers: {'content-type': 'application/json'},
data: {
orders: [
{
order: 'JL4ltRyBSTS0myETu7yJIA',
tags: {TagKey1: 'TagValue1', TagKey2: 'TagValue2'},
items: [
{
product: 'product-path',
attributes: {AttributeKey1: 'AttributeValue1', AttributeKey2: 'AttributeValue2'}
}
]
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"orders":[{"order":"JL4ltRyBSTS0myETu7yJIA","tags":{"TagKey1":"TagValue1","TagKey2":"TagValue2"},"items":[{"product":"product-path","attributes":{"AttributeKey1":"AttributeValue1","AttributeKey2":"AttributeValue2"}}]}]}'
};
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 = @{ @"orders": @[ @{ @"order": @"JL4ltRyBSTS0myETu7yJIA", @"tags": @{ @"TagKey1": @"TagValue1", @"TagKey2": @"TagValue2" }, @"items": @[ @{ @"product": @"product-path", @"attributes": @{ @"AttributeKey1": @"AttributeValue1", @"AttributeKey2": @"AttributeValue2" } } ] } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/orders" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\n ]\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'orders' => [
[
'order' => 'JL4ltRyBSTS0myETu7yJIA',
'tags' => [
'TagKey1' => 'TagValue1',
'TagKey2' => 'TagValue2'
],
'items' => [
[
'product' => 'product-path',
'attributes' => [
'AttributeKey1' => 'AttributeValue1',
'AttributeKey2' => 'AttributeValue2'
]
]
]
]
]
]),
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}}/orders', [
'body' => '{
"orders": [
{
"order": "JL4ltRyBSTS0myETu7yJIA",
"tags": {
"TagKey1": "TagValue1",
"TagKey2": "TagValue2"
},
"items": [
{
"product": "product-path",
"attributes": {
"AttributeKey1": "AttributeValue1",
"AttributeKey2": "AttributeValue2"
}
}
]
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'orders' => [
[
'order' => 'JL4ltRyBSTS0myETu7yJIA',
'tags' => [
'TagKey1' => 'TagValue1',
'TagKey2' => 'TagValue2'
],
'items' => [
[
'product' => 'product-path',
'attributes' => [
'AttributeKey1' => 'AttributeValue1',
'AttributeKey2' => 'AttributeValue2'
]
]
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'orders' => [
[
'order' => 'JL4ltRyBSTS0myETu7yJIA',
'tags' => [
'TagKey1' => 'TagValue1',
'TagKey2' => 'TagValue2'
],
'items' => [
[
'product' => 'product-path',
'attributes' => [
'AttributeKey1' => 'AttributeValue1',
'AttributeKey2' => 'AttributeValue2'
]
]
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/orders');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"orders": [
{
"order": "JL4ltRyBSTS0myETu7yJIA",
"tags": {
"TagKey1": "TagValue1",
"TagKey2": "TagValue2"
},
"items": [
{
"product": "product-path",
"attributes": {
"AttributeKey1": "AttributeValue1",
"AttributeKey2": "AttributeValue2"
}
}
]
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"orders": [
{
"order": "JL4ltRyBSTS0myETu7yJIA",
"tags": {
"TagKey1": "TagValue1",
"TagKey2": "TagValue2"
},
"items": [
{
"product": "product-path",
"attributes": {
"AttributeKey1": "AttributeValue1",
"AttributeKey2": "AttributeValue2"
}
}
]
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\n ]\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/orders", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders"
payload = { "orders": [
{
"order": "JL4ltRyBSTS0myETu7yJIA",
"tags": {
"TagKey1": "TagValue1",
"TagKey2": "TagValue2"
},
"items": [
{
"product": "product-path",
"attributes": {
"AttributeKey1": "AttributeValue1",
"AttributeKey2": "AttributeValue2"
}
}
]
}
] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders"
payload <- "{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\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}}/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\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/orders') do |req|
req.body = "{\n \"orders\": [\n {\n \"order\": \"JL4ltRyBSTS0myETu7yJIA\",\n \"tags\": {\n \"TagKey1\": \"TagValue1\",\n \"TagKey2\": \"TagValue2\"\n },\n \"items\": [\n {\n \"product\": \"product-path\",\n \"attributes\": {\n \"AttributeKey1\": \"AttributeValue1\",\n \"AttributeKey2\": \"AttributeValue2\"\n }\n }\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}}/orders";
let payload = json!({"orders": (
json!({
"order": "JL4ltRyBSTS0myETu7yJIA",
"tags": json!({
"TagKey1": "TagValue1",
"TagKey2": "TagValue2"
}),
"items": (
json!({
"product": "product-path",
"attributes": json!({
"AttributeKey1": "AttributeValue1",
"AttributeKey2": "AttributeValue2"
})
})
)
})
)});
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}}/orders \
--header 'content-type: application/json' \
--data '{
"orders": [
{
"order": "JL4ltRyBSTS0myETu7yJIA",
"tags": {
"TagKey1": "TagValue1",
"TagKey2": "TagValue2"
},
"items": [
{
"product": "product-path",
"attributes": {
"AttributeKey1": "AttributeValue1",
"AttributeKey2": "AttributeValue2"
}
}
]
}
]
}'
echo '{
"orders": [
{
"order": "JL4ltRyBSTS0myETu7yJIA",
"tags": {
"TagKey1": "TagValue1",
"TagKey2": "TagValue2"
},
"items": [
{
"product": "product-path",
"attributes": {
"AttributeKey1": "AttributeValue1",
"AttributeKey2": "AttributeValue2"
}
}
]
}
]
}' | \
http POST {{baseUrl}}/orders \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "orders": [\n {\n "order": "JL4ltRyBSTS0myETu7yJIA",\n "tags": {\n "TagKey1": "TagValue1",\n "TagKey2": "TagValue2"\n },\n "items": [\n {\n "product": "product-path",\n "attributes": {\n "AttributeKey1": "AttributeValue1",\n "AttributeKey2": "AttributeValue2"\n }\n }\n ]\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/orders
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["orders": [
[
"order": "JL4ltRyBSTS0myETu7yJIA",
"tags": [
"TagKey1": "TagValue1",
"TagKey2": "TagValue2"
],
"items": [
[
"product": "product-path",
"attributes": [
"AttributeKey1": "AttributeValue1",
"AttributeKey2": "AttributeValue2"
]
]
]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create and update products
{{baseUrl}}/products
BODY json
{
"products": [
{
"product": "",
"display": {
"en": ""
},
"description": {
"summary": {
"en": ""
},
"action": {
"en": ""
},
"full": {
"en": ""
}
},
"fulfillment": {
"instructions": {
"en": "",
"es": ""
}
},
"image": "",
"format": "",
"sku": "",
"attributes": {
"key1": "",
"key2": ""
},
"pricing": {
"trial": 0,
"interval": "",
"intervalLength": 0,
"quantityBehavior": "",
"quantityDefault": 0,
"paymentCollected": false,
"paidTrial": false,
"trialPrice": {
"USD": "",
"EUR": ""
},
"price": {},
"quantityDiscounts": {},
"discountReason": {
"en": ""
},
"discountDuration": 0
}
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/products");
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 \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\n }\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/products" {:content-type :json
:form-params {:products [{:product ""
:display {:en ""}
:description {:summary {:en ""}
:action {:en ""}
:full {:en ""}}
:fulfillment {:instructions {:en ""
:es ""}}
:image ""
:format ""
:sku ""
:attributes {:key1 ""
:key2 ""}
:pricing {:trial 0
:interval ""
:intervalLength 0
:quantityBehavior ""
:quantityDefault 0
:paymentCollected false
:paidTrial false
:trialPrice {:USD ""
:EUR ""}
:price {}
:quantityDiscounts {}
:discountReason {:en ""}
:discountDuration 0}}]}})
require "http/client"
url = "{{baseUrl}}/products"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\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}}/products"),
Content = new StringContent("{\n \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\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}}/products");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\n }\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/products"
payload := strings.NewReader("{\n \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\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/products HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 957
{
"products": [
{
"product": "",
"display": {
"en": ""
},
"description": {
"summary": {
"en": ""
},
"action": {
"en": ""
},
"full": {
"en": ""
}
},
"fulfillment": {
"instructions": {
"en": "",
"es": ""
}
},
"image": "",
"format": "",
"sku": "",
"attributes": {
"key1": "",
"key2": ""
},
"pricing": {
"trial": 0,
"interval": "",
"intervalLength": 0,
"quantityBehavior": "",
"quantityDefault": 0,
"paymentCollected": false,
"paidTrial": false,
"trialPrice": {
"USD": "",
"EUR": ""
},
"price": {},
"quantityDiscounts": {},
"discountReason": {
"en": ""
},
"discountDuration": 0
}
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/products")
.setHeader("content-type", "application/json")
.setBody("{\n \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\n }\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/products"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\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 \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\n }\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/products")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/products")
.header("content-type", "application/json")
.body("{\n \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\n }\n }\n ]\n}")
.asString();
const data = JSON.stringify({
products: [
{
product: '',
display: {
en: ''
},
description: {
summary: {
en: ''
},
action: {
en: ''
},
full: {
en: ''
}
},
fulfillment: {
instructions: {
en: '',
es: ''
}
},
image: '',
format: '',
sku: '',
attributes: {
key1: '',
key2: ''
},
pricing: {
trial: 0,
interval: '',
intervalLength: 0,
quantityBehavior: '',
quantityDefault: 0,
paymentCollected: false,
paidTrial: false,
trialPrice: {
USD: '',
EUR: ''
},
price: {},
quantityDiscounts: {},
discountReason: {
en: ''
},
discountDuration: 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}}/products');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/products',
headers: {'content-type': 'application/json'},
data: {
products: [
{
product: '',
display: {en: ''},
description: {summary: {en: ''}, action: {en: ''}, full: {en: ''}},
fulfillment: {instructions: {en: '', es: ''}},
image: '',
format: '',
sku: '',
attributes: {key1: '', key2: ''},
pricing: {
trial: 0,
interval: '',
intervalLength: 0,
quantityBehavior: '',
quantityDefault: 0,
paymentCollected: false,
paidTrial: false,
trialPrice: {USD: '', EUR: ''},
price: {},
quantityDiscounts: {},
discountReason: {en: ''},
discountDuration: 0
}
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/products';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"products":[{"product":"","display":{"en":""},"description":{"summary":{"en":""},"action":{"en":""},"full":{"en":""}},"fulfillment":{"instructions":{"en":"","es":""}},"image":"","format":"","sku":"","attributes":{"key1":"","key2":""},"pricing":{"trial":0,"interval":"","intervalLength":0,"quantityBehavior":"","quantityDefault":0,"paymentCollected":false,"paidTrial":false,"trialPrice":{"USD":"","EUR":""},"price":{},"quantityDiscounts":{},"discountReason":{"en":""},"discountDuration":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}}/products',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "products": [\n {\n "product": "",\n "display": {\n "en": ""\n },\n "description": {\n "summary": {\n "en": ""\n },\n "action": {\n "en": ""\n },\n "full": {\n "en": ""\n }\n },\n "fulfillment": {\n "instructions": {\n "en": "",\n "es": ""\n }\n },\n "image": "",\n "format": "",\n "sku": "",\n "attributes": {\n "key1": "",\n "key2": ""\n },\n "pricing": {\n "trial": 0,\n "interval": "",\n "intervalLength": 0,\n "quantityBehavior": "",\n "quantityDefault": 0,\n "paymentCollected": false,\n "paidTrial": false,\n "trialPrice": {\n "USD": "",\n "EUR": ""\n },\n "price": {},\n "quantityDiscounts": {},\n "discountReason": {\n "en": ""\n },\n "discountDuration": 0\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 \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\n }\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/products")
.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/products',
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({
products: [
{
product: '',
display: {en: ''},
description: {summary: {en: ''}, action: {en: ''}, full: {en: ''}},
fulfillment: {instructions: {en: '', es: ''}},
image: '',
format: '',
sku: '',
attributes: {key1: '', key2: ''},
pricing: {
trial: 0,
interval: '',
intervalLength: 0,
quantityBehavior: '',
quantityDefault: 0,
paymentCollected: false,
paidTrial: false,
trialPrice: {USD: '', EUR: ''},
price: {},
quantityDiscounts: {},
discountReason: {en: ''},
discountDuration: 0
}
}
]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/products',
headers: {'content-type': 'application/json'},
body: {
products: [
{
product: '',
display: {en: ''},
description: {summary: {en: ''}, action: {en: ''}, full: {en: ''}},
fulfillment: {instructions: {en: '', es: ''}},
image: '',
format: '',
sku: '',
attributes: {key1: '', key2: ''},
pricing: {
trial: 0,
interval: '',
intervalLength: 0,
quantityBehavior: '',
quantityDefault: 0,
paymentCollected: false,
paidTrial: false,
trialPrice: {USD: '', EUR: ''},
price: {},
quantityDiscounts: {},
discountReason: {en: ''},
discountDuration: 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}}/products');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
products: [
{
product: '',
display: {
en: ''
},
description: {
summary: {
en: ''
},
action: {
en: ''
},
full: {
en: ''
}
},
fulfillment: {
instructions: {
en: '',
es: ''
}
},
image: '',
format: '',
sku: '',
attributes: {
key1: '',
key2: ''
},
pricing: {
trial: 0,
interval: '',
intervalLength: 0,
quantityBehavior: '',
quantityDefault: 0,
paymentCollected: false,
paidTrial: false,
trialPrice: {
USD: '',
EUR: ''
},
price: {},
quantityDiscounts: {},
discountReason: {
en: ''
},
discountDuration: 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}}/products',
headers: {'content-type': 'application/json'},
data: {
products: [
{
product: '',
display: {en: ''},
description: {summary: {en: ''}, action: {en: ''}, full: {en: ''}},
fulfillment: {instructions: {en: '', es: ''}},
image: '',
format: '',
sku: '',
attributes: {key1: '', key2: ''},
pricing: {
trial: 0,
interval: '',
intervalLength: 0,
quantityBehavior: '',
quantityDefault: 0,
paymentCollected: false,
paidTrial: false,
trialPrice: {USD: '', EUR: ''},
price: {},
quantityDiscounts: {},
discountReason: {en: ''},
discountDuration: 0
}
}
]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/products';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"products":[{"product":"","display":{"en":""},"description":{"summary":{"en":""},"action":{"en":""},"full":{"en":""}},"fulfillment":{"instructions":{"en":"","es":""}},"image":"","format":"","sku":"","attributes":{"key1":"","key2":""},"pricing":{"trial":0,"interval":"","intervalLength":0,"quantityBehavior":"","quantityDefault":0,"paymentCollected":false,"paidTrial":false,"trialPrice":{"USD":"","EUR":""},"price":{},"quantityDiscounts":{},"discountReason":{"en":""},"discountDuration":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 = @{ @"products": @[ @{ @"product": @"", @"display": @{ @"en": @"" }, @"description": @{ @"summary": @{ @"en": @"" }, @"action": @{ @"en": @"" }, @"full": @{ @"en": @"" } }, @"fulfillment": @{ @"instructions": @{ @"en": @"", @"es": @"" } }, @"image": @"", @"format": @"", @"sku": @"", @"attributes": @{ @"key1": @"", @"key2": @"" }, @"pricing": @{ @"trial": @0, @"interval": @"", @"intervalLength": @0, @"quantityBehavior": @"", @"quantityDefault": @0, @"paymentCollected": @NO, @"paidTrial": @NO, @"trialPrice": @{ @"USD": @"", @"EUR": @"" }, @"price": @{ }, @"quantityDiscounts": @{ }, @"discountReason": @{ @"en": @"" }, @"discountDuration": @0 } } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/products"]
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}}/products" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\n }\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/products",
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([
'products' => [
[
'product' => '',
'display' => [
'en' => ''
],
'description' => [
'summary' => [
'en' => ''
],
'action' => [
'en' => ''
],
'full' => [
'en' => ''
]
],
'fulfillment' => [
'instructions' => [
'en' => '',
'es' => ''
]
],
'image' => '',
'format' => '',
'sku' => '',
'attributes' => [
'key1' => '',
'key2' => ''
],
'pricing' => [
'trial' => 0,
'interval' => '',
'intervalLength' => 0,
'quantityBehavior' => '',
'quantityDefault' => 0,
'paymentCollected' => null,
'paidTrial' => null,
'trialPrice' => [
'USD' => '',
'EUR' => ''
],
'price' => [
],
'quantityDiscounts' => [
],
'discountReason' => [
'en' => ''
],
'discountDuration' => 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}}/products', [
'body' => '{
"products": [
{
"product": "",
"display": {
"en": ""
},
"description": {
"summary": {
"en": ""
},
"action": {
"en": ""
},
"full": {
"en": ""
}
},
"fulfillment": {
"instructions": {
"en": "",
"es": ""
}
},
"image": "",
"format": "",
"sku": "",
"attributes": {
"key1": "",
"key2": ""
},
"pricing": {
"trial": 0,
"interval": "",
"intervalLength": 0,
"quantityBehavior": "",
"quantityDefault": 0,
"paymentCollected": false,
"paidTrial": false,
"trialPrice": {
"USD": "",
"EUR": ""
},
"price": {},
"quantityDiscounts": {},
"discountReason": {
"en": ""
},
"discountDuration": 0
}
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/products');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'products' => [
[
'product' => '',
'display' => [
'en' => ''
],
'description' => [
'summary' => [
'en' => ''
],
'action' => [
'en' => ''
],
'full' => [
'en' => ''
]
],
'fulfillment' => [
'instructions' => [
'en' => '',
'es' => ''
]
],
'image' => '',
'format' => '',
'sku' => '',
'attributes' => [
'key1' => '',
'key2' => ''
],
'pricing' => [
'trial' => 0,
'interval' => '',
'intervalLength' => 0,
'quantityBehavior' => '',
'quantityDefault' => 0,
'paymentCollected' => null,
'paidTrial' => null,
'trialPrice' => [
'USD' => '',
'EUR' => ''
],
'price' => [
],
'quantityDiscounts' => [
],
'discountReason' => [
'en' => ''
],
'discountDuration' => 0
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'products' => [
[
'product' => '',
'display' => [
'en' => ''
],
'description' => [
'summary' => [
'en' => ''
],
'action' => [
'en' => ''
],
'full' => [
'en' => ''
]
],
'fulfillment' => [
'instructions' => [
'en' => '',
'es' => ''
]
],
'image' => '',
'format' => '',
'sku' => '',
'attributes' => [
'key1' => '',
'key2' => ''
],
'pricing' => [
'trial' => 0,
'interval' => '',
'intervalLength' => 0,
'quantityBehavior' => '',
'quantityDefault' => 0,
'paymentCollected' => null,
'paidTrial' => null,
'trialPrice' => [
'USD' => '',
'EUR' => ''
],
'price' => [
],
'quantityDiscounts' => [
],
'discountReason' => [
'en' => ''
],
'discountDuration' => 0
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/products');
$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}}/products' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"products": [
{
"product": "",
"display": {
"en": ""
},
"description": {
"summary": {
"en": ""
},
"action": {
"en": ""
},
"full": {
"en": ""
}
},
"fulfillment": {
"instructions": {
"en": "",
"es": ""
}
},
"image": "",
"format": "",
"sku": "",
"attributes": {
"key1": "",
"key2": ""
},
"pricing": {
"trial": 0,
"interval": "",
"intervalLength": 0,
"quantityBehavior": "",
"quantityDefault": 0,
"paymentCollected": false,
"paidTrial": false,
"trialPrice": {
"USD": "",
"EUR": ""
},
"price": {},
"quantityDiscounts": {},
"discountReason": {
"en": ""
},
"discountDuration": 0
}
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/products' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"products": [
{
"product": "",
"display": {
"en": ""
},
"description": {
"summary": {
"en": ""
},
"action": {
"en": ""
},
"full": {
"en": ""
}
},
"fulfillment": {
"instructions": {
"en": "",
"es": ""
}
},
"image": "",
"format": "",
"sku": "",
"attributes": {
"key1": "",
"key2": ""
},
"pricing": {
"trial": 0,
"interval": "",
"intervalLength": 0,
"quantityBehavior": "",
"quantityDefault": 0,
"paymentCollected": false,
"paidTrial": false,
"trialPrice": {
"USD": "",
"EUR": ""
},
"price": {},
"quantityDiscounts": {},
"discountReason": {
"en": ""
},
"discountDuration": 0
}
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\n }\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/products", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/products"
payload = { "products": [
{
"product": "",
"display": { "en": "" },
"description": {
"summary": { "en": "" },
"action": { "en": "" },
"full": { "en": "" }
},
"fulfillment": { "instructions": {
"en": "",
"es": ""
} },
"image": "",
"format": "",
"sku": "",
"attributes": {
"key1": "",
"key2": ""
},
"pricing": {
"trial": 0,
"interval": "",
"intervalLength": 0,
"quantityBehavior": "",
"quantityDefault": 0,
"paymentCollected": False,
"paidTrial": False,
"trialPrice": {
"USD": "",
"EUR": ""
},
"price": {},
"quantityDiscounts": {},
"discountReason": { "en": "" },
"discountDuration": 0
}
}
] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/products"
payload <- "{\n \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\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}}/products")
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 \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\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/products') do |req|
req.body = "{\n \"products\": [\n {\n \"product\": \"\",\n \"display\": {\n \"en\": \"\"\n },\n \"description\": {\n \"summary\": {\n \"en\": \"\"\n },\n \"action\": {\n \"en\": \"\"\n },\n \"full\": {\n \"en\": \"\"\n }\n },\n \"fulfillment\": {\n \"instructions\": {\n \"en\": \"\",\n \"es\": \"\"\n }\n },\n \"image\": \"\",\n \"format\": \"\",\n \"sku\": \"\",\n \"attributes\": {\n \"key1\": \"\",\n \"key2\": \"\"\n },\n \"pricing\": {\n \"trial\": 0,\n \"interval\": \"\",\n \"intervalLength\": 0,\n \"quantityBehavior\": \"\",\n \"quantityDefault\": 0,\n \"paymentCollected\": false,\n \"paidTrial\": false,\n \"trialPrice\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"price\": {},\n \"quantityDiscounts\": {},\n \"discountReason\": {\n \"en\": \"\"\n },\n \"discountDuration\": 0\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}}/products";
let payload = json!({"products": (
json!({
"product": "",
"display": json!({"en": ""}),
"description": json!({
"summary": json!({"en": ""}),
"action": json!({"en": ""}),
"full": json!({"en": ""})
}),
"fulfillment": json!({"instructions": json!({
"en": "",
"es": ""
})}),
"image": "",
"format": "",
"sku": "",
"attributes": json!({
"key1": "",
"key2": ""
}),
"pricing": json!({
"trial": 0,
"interval": "",
"intervalLength": 0,
"quantityBehavior": "",
"quantityDefault": 0,
"paymentCollected": false,
"paidTrial": false,
"trialPrice": json!({
"USD": "",
"EUR": ""
}),
"price": json!({}),
"quantityDiscounts": json!({}),
"discountReason": json!({"en": ""}),
"discountDuration": 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}}/products \
--header 'content-type: application/json' \
--data '{
"products": [
{
"product": "",
"display": {
"en": ""
},
"description": {
"summary": {
"en": ""
},
"action": {
"en": ""
},
"full": {
"en": ""
}
},
"fulfillment": {
"instructions": {
"en": "",
"es": ""
}
},
"image": "",
"format": "",
"sku": "",
"attributes": {
"key1": "",
"key2": ""
},
"pricing": {
"trial": 0,
"interval": "",
"intervalLength": 0,
"quantityBehavior": "",
"quantityDefault": 0,
"paymentCollected": false,
"paidTrial": false,
"trialPrice": {
"USD": "",
"EUR": ""
},
"price": {},
"quantityDiscounts": {},
"discountReason": {
"en": ""
},
"discountDuration": 0
}
}
]
}'
echo '{
"products": [
{
"product": "",
"display": {
"en": ""
},
"description": {
"summary": {
"en": ""
},
"action": {
"en": ""
},
"full": {
"en": ""
}
},
"fulfillment": {
"instructions": {
"en": "",
"es": ""
}
},
"image": "",
"format": "",
"sku": "",
"attributes": {
"key1": "",
"key2": ""
},
"pricing": {
"trial": 0,
"interval": "",
"intervalLength": 0,
"quantityBehavior": "",
"quantityDefault": 0,
"paymentCollected": false,
"paidTrial": false,
"trialPrice": {
"USD": "",
"EUR": ""
},
"price": {},
"quantityDiscounts": {},
"discountReason": {
"en": ""
},
"discountDuration": 0
}
}
]
}' | \
http POST {{baseUrl}}/products \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "products": [\n {\n "product": "",\n "display": {\n "en": ""\n },\n "description": {\n "summary": {\n "en": ""\n },\n "action": {\n "en": ""\n },\n "full": {\n "en": ""\n }\n },\n "fulfillment": {\n "instructions": {\n "en": "",\n "es": ""\n }\n },\n "image": "",\n "format": "",\n "sku": "",\n "attributes": {\n "key1": "",\n "key2": ""\n },\n "pricing": {\n "trial": 0,\n "interval": "",\n "intervalLength": 0,\n "quantityBehavior": "",\n "quantityDefault": 0,\n "paymentCollected": false,\n "paidTrial": false,\n "trialPrice": {\n "USD": "",\n "EUR": ""\n },\n "price": {},\n "quantityDiscounts": {},\n "discountReason": {\n "en": ""\n },\n "discountDuration": 0\n }\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/products
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["products": [
[
"product": "",
"display": ["en": ""],
"description": [
"summary": ["en": ""],
"action": ["en": ""],
"full": ["en": ""]
],
"fulfillment": ["instructions": [
"en": "",
"es": ""
]],
"image": "",
"format": "",
"sku": "",
"attributes": [
"key1": "",
"key2": ""
],
"pricing": [
"trial": 0,
"interval": "",
"intervalLength": 0,
"quantityBehavior": "",
"quantityDefault": 0,
"paymentCollected": false,
"paidTrial": false,
"trialPrice": [
"USD": "",
"EUR": ""
],
"price": [],
"quantityDiscounts": [],
"discountReason": ["en": ""],
"discountDuration": 0
]
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/products")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"products": [
{
"product": "product-path",
"action": "product.create",
"result": "success"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"products": [
{
"product": "product-path",
"action": "product.create",
"result": "error",
"error": {
"setupFee": "Cannot be applied when a free trial without payment method required is set up",
"trialPrice": "price must be defined \"USD\" price may not be zero or less"
}
}
]
}
POST
Create or Update Product offers
{{baseUrl}}/products/offers/:product_path
QUERY PARAMS
product_path
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/products/offers/:product_path");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/products/offers/:product_path")
require "http/client"
url = "{{baseUrl}}/products/offers/:product_path"
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}}/products/offers/:product_path"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/products/offers/:product_path");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/products/offers/:product_path"
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/products/offers/:product_path HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/products/offers/:product_path")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/products/offers/:product_path"))
.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}}/products/offers/:product_path")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/products/offers/:product_path")
.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}}/products/offers/:product_path');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/products/offers/:product_path'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/products/offers/:product_path';
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}}/products/offers/:product_path',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/products/offers/:product_path")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/products/offers/:product_path',
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}}/products/offers/:product_path'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/products/offers/:product_path');
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}}/products/offers/:product_path'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/products/offers/:product_path';
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}}/products/offers/:product_path"]
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}}/products/offers/:product_path" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/products/offers/:product_path",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/products/offers/:product_path');
echo $response->getBody();
setUrl('{{baseUrl}}/products/offers/:product_path');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/products/offers/:product_path');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/products/offers/:product_path' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/products/offers/:product_path' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = ""
conn.request("POST", "/baseUrl/products/offers/:product_path", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/products/offers/:product_path"
payload = ""
response = requests.post(url, data=payload)
print(response.json())
library(httr)
url <- "{{baseUrl}}/products/offers/:product_path"
payload <- ""
response <- VERB("POST", url, body = payload, content_type(""))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/products/offers/:product_path")
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/products/offers/:product_path') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/products/offers/:product_path";
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}}/products/offers/:product_path
http POST {{baseUrl}}/products/offers/:product_path
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/products/offers/:product_path
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/products/offers/:product_path")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"product": "basicc",
"action": "products.offers.update",
"result": "error",
"error": {
"product": "Product in URL 'basicc' does not match product in request body 'basic'"
}
}
DELETE
Delete products
{{baseUrl}}/products/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/products/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/products/:id")
require "http/client"
url = "{{baseUrl}}/products/:id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/products/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/products/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/products/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/products/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/products/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/products/:id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/products/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/products/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/products/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/products/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/products/:id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/products/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/products/:id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/products/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/products/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/products/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/products/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/products/:id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/products/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/products/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/products/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/products/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/products/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/products/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/products/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/products/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/products/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/products/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/products/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/products/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/products/:id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/products/:id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/products/:id
http DELETE {{baseUrl}}/products/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/products/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/products/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"products": [
{
"action": "products.delete",
"result": "success",
"product": "deletion-test-2"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"products": [
{
"action": "products.delete",
"product": "deletion-test",
"result": "error",
"error": {
"product": "Not found"
}
}
]
}
GET
Get a product price in a specified country and currency
{{baseUrl}}/products/price/:id?country=:country¤cy=:currency
QUERY PARAMS
id
country
currency
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/products/price/:id" {:query-params {:country ":country"
:currency ":currency"}})
require "http/client"
url = "{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency"
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}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency"
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/products/price/:id?country=%3Acountry¤cy=%3Acurrency HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency"))
.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}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency")
.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}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/products/price/:id',
params: {country: ':country', currency: ':currency'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency';
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}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/products/price/:id?country=%3Acountry¤cy=%3Acurrency',
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}}/products/price/:id',
qs: {country: ':country', currency: ':currency'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/products/price/:id');
req.query({
country: ':country',
currency: ':currency'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/products/price/:id',
params: {country: ':country', currency: ':currency'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency';
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}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency"]
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}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency",
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}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency');
echo $response->getBody();
setUrl('{{baseUrl}}/products/price/:id');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'country' => ':country',
'currency' => ':currency'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/products/price/:id');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'country' => ':country',
'currency' => ':currency'
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/products/price/:id?country=%3Acountry¤cy=%3Acurrency")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/products/price/:id"
querystring = {"country":":country","currency":":currency"}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/products/price/:id"
queryString <- list(
country = ":country",
currency = ":currency"
)
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency")
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/products/price/:id') do |req|
req.params['country'] = ':country'
req.params['currency'] = ':currency'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/products/price/:id";
let querystring = [
("country", ":country"),
("currency", ":currency"),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency'
http GET '{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/products/price/:id?country=%3Acountry¤cy=%3Acurrency")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"page": 1,
"limit": 50,
"nextPage": 2,
"products": [
{
"action": "product.price.get",
"result": "success",
"product": "example-subscription",
"pricing": {
"PR": {
"2": {
"discountPercent": 5,
"discountValue": 5,
"discountValueDisplay": "$5.00",
"unitPrice": 95,
"unitPriceDisplay": "$95.00"
},
"3": {
"discountPercent": 10,
"discountValue": 10,
"discountValueDisplay": "$10.00",
"unitPrice": 90,
"unitPriceDisplay": "$90.00"
},
"4": {
"discountPercent": 15,
"discountValue": 15,
"discountValueDisplay": "$15.00",
"unitPrice": 85,
"unitPriceDisplay": "$85.00"
},
"5": {
"discountPercent": 25,
"discountValue": 25,
"discountValueDisplay": "$25.00",
"unitPrice": 75,
"unitPriceDisplay": "$75.00"
},
"currency": "USD",
"price": 100,
"display": "$100.00",
"quantityDiscount": null,
"discountReason": {
"en": "2023 Yearly Sale"
},
"discountPeriodCount": "null",
"available": {
"start": "2023-01-01 00:00",
"end": "2023-12-31 23:30"
},
"setupFeePrice": "10.0,",
"setupFeePriceDisplay": "$10.00",
"setupFeeReason": {
"en": "Setup Fee"
}
},
"DE": {
"2": {
"discountPercent": 5,
"discountValue": 4.5,
"discountValueDisplay": "4,50 €",
"unitPrice": 85,
"unitPriceDisplay": "85,50 €"
},
"3": {
"discountPercent": 10,
"discountValue": 9,
"discountValueDisplay": "9,00 €",
"unitPrice": 81,
"unitPriceDisplay": "81,00 €"
},
"4": {
"discountPercent": 15,
"discountValue": 13.5,
"discountValueDisplay": "13,50 €",
"unitPrice": 76.5,
"unitPriceDisplay": "76,50 €"
},
"5": {
"discountPercent": 25,
"discountValue": 22.5,
"discountValueDisplay": "$22.50",
"unitPrice": 67.5,
"unitPriceDisplay": "$67.50"
},
"currency": "EUR",
"price": 90,
"display": "90,00 €",
"quantityDiscount": null,
"discountReason": {
"en": "2023 Yearly Sale"
},
"discountPeriodCount": "null",
"available": {
"start": "2023-01-01 00:00",
"end": "2023-12-31 23:30"
},
"setupFeePrice": "11.0,",
"setupFeePriceDisplay": "12,00 €",
"setupFeeReason": {
"en": "Setup Fee"
}
}
}
}
]
}
GET
Get a product price in a specified country
{{baseUrl}}/products/price/:id?country=:country
QUERY PARAMS
id
country
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/products/price/:id?country=%3Acountry");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/products/price/:id" {:query-params {:country ":country"}})
require "http/client"
url = "{{baseUrl}}/products/price/:id?country=%3Acountry"
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}}/products/price/:id?country=%3Acountry"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/products/price/:id?country=%3Acountry");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/products/price/:id?country=%3Acountry"
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/products/price/:id?country=%3Acountry HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/products/price/:id?country=%3Acountry")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/products/price/:id?country=%3Acountry"))
.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}}/products/price/:id?country=%3Acountry")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/products/price/:id?country=%3Acountry")
.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}}/products/price/:id?country=%3Acountry');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/products/price/:id',
params: {country: ':country'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/products/price/:id?country=%3Acountry';
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}}/products/price/:id?country=%3Acountry',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/products/price/:id?country=%3Acountry")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/products/price/:id?country=%3Acountry',
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}}/products/price/:id',
qs: {country: ':country'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/products/price/:id');
req.query({
country: ':country'
});
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}}/products/price/:id',
params: {country: ':country'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/products/price/:id?country=%3Acountry';
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}}/products/price/:id?country=%3Acountry"]
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}}/products/price/:id?country=%3Acountry" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/products/price/:id?country=%3Acountry",
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}}/products/price/:id?country=%3Acountry');
echo $response->getBody();
setUrl('{{baseUrl}}/products/price/:id');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'country' => ':country'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/products/price/:id');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'country' => ':country'
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/products/price/:id?country=%3Acountry' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/products/price/:id?country=%3Acountry' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/products/price/:id?country=%3Acountry")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/products/price/:id"
querystring = {"country":":country"}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/products/price/:id"
queryString <- list(country = ":country")
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/products/price/:id?country=%3Acountry")
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/products/price/:id') do |req|
req.params['country'] = ':country'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/products/price/:id";
let querystring = [
("country", ":country"),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/products/price/:id?country=%3Acountry'
http GET '{{baseUrl}}/products/price/:id?country=%3Acountry'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/products/price/:id?country=%3Acountry'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/products/price/:id?country=%3Acountry")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"page": 1,
"limit": 50,
"nextPage": 2,
"products": [
{
"action": "product.price.get",
"result": "success",
"product": "example-subscription",
"pricing": {
"PR": {
"2": {
"discountPercent": 5,
"discountValue": 5,
"discountValueDisplay": "$5.00",
"unitPrice": 95,
"unitPriceDisplay": "$95.00"
},
"3": {
"discountPercent": 10,
"discountValue": 10,
"discountValueDisplay": "$10.00",
"unitPrice": 90,
"unitPriceDisplay": "$90.00"
},
"4": {
"discountPercent": 15,
"discountValue": 15,
"discountValueDisplay": "$15.00",
"unitPrice": 85,
"unitPriceDisplay": "$85.00"
},
"5": {
"discountPercent": 25,
"discountValue": 25,
"discountValueDisplay": "$25.00",
"unitPrice": 75,
"unitPriceDisplay": "$75.00"
},
"currency": "USD",
"price": 100,
"display": "$100.00",
"quantityDiscount": null,
"discountReason": {
"en": "2023 Yearly Sale"
},
"discountPeriodCount": "null",
"available": {
"start": "2023-01-01 00:00",
"end": "2023-12-31 23:30"
},
"setupFeePrice": "10.0,",
"setupFeePriceDisplay": "$10.00",
"setupFeeReason": {
"en": "Setup Fee"
}
},
"DE": {
"2": {
"discountPercent": 5,
"discountValue": 4.5,
"discountValueDisplay": "4,50 €",
"unitPrice": 85,
"unitPriceDisplay": "85,50 €"
},
"3": {
"discountPercent": 10,
"discountValue": 9,
"discountValueDisplay": "9,00 €",
"unitPrice": 81,
"unitPriceDisplay": "81,00 €"
},
"4": {
"discountPercent": 15,
"discountValue": 13.5,
"discountValueDisplay": "13,50 €",
"unitPrice": 76.5,
"unitPriceDisplay": "76,50 €"
},
"5": {
"discountPercent": 25,
"discountValue": 22.5,
"discountValueDisplay": "$22.50",
"unitPrice": 67.5,
"unitPriceDisplay": "$67.50"
},
"currency": "EUR",
"price": 90,
"display": "90,00 €",
"quantityDiscount": null,
"discountReason": {
"en": "2023 Yearly Sale"
},
"discountPeriodCount": "null",
"available": {
"start": "2023-01-01 00:00",
"end": "2023-12-31 23:30"
},
"setupFeePrice": "11.0,",
"setupFeePriceDisplay": "12,00 €",
"setupFeeReason": {
"en": "Setup Fee"
}
}
}
}
]
}
GET
Get a product price
{{baseUrl}}/products/price/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/products/price/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/products/price/:id")
require "http/client"
url = "{{baseUrl}}/products/price/:id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/products/price/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/products/price/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/products/price/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/products/price/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/products/price/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/products/price/:id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/products/price/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/products/price/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/products/price/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/products/price/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/products/price/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/products/price/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/products/price/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/products/price/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/products/price/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/products/price/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/products/price/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/products/price/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/products/price/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/products/price/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/products/price/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/products/price/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/products/price/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/products/price/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/products/price/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/products/price/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/products/price/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/products/price/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/products/price/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/products/price/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/products/price/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/products/price/:id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/products/price/:id
http GET {{baseUrl}}/products/price/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/products/price/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/products/price/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"page": 1,
"limit": 50,
"nextPage": 2,
"products": [
{
"action": "product.price.get",
"result": "success",
"product": "example-subscription",
"pricing": {
"PR": {
"2": {
"discountPercent": 5,
"discountValue": 5,
"discountValueDisplay": "$5.00",
"unitPrice": 95,
"unitPriceDisplay": "$95.00"
},
"3": {
"discountPercent": 10,
"discountValue": 10,
"discountValueDisplay": "$10.00",
"unitPrice": 90,
"unitPriceDisplay": "$90.00"
},
"4": {
"discountPercent": 15,
"discountValue": 15,
"discountValueDisplay": "$15.00",
"unitPrice": 85,
"unitPriceDisplay": "$85.00"
},
"5": {
"discountPercent": 25,
"discountValue": 25,
"discountValueDisplay": "$25.00",
"unitPrice": 75,
"unitPriceDisplay": "$75.00"
},
"currency": "USD",
"price": 100,
"display": "$100.00",
"quantityDiscount": null,
"discountReason": {
"en": "2023 Yearly Sale"
},
"discountPeriodCount": "null",
"available": {
"start": "2023-01-01 00:00",
"end": "2023-12-31 23:30"
},
"setupFeePrice": "10.0,",
"setupFeePriceDisplay": "$10.00",
"setupFeeReason": {
"en": "Setup Fee"
}
},
"DE": {
"2": {
"discountPercent": 5,
"discountValue": 4.5,
"discountValueDisplay": "4,50 €",
"unitPrice": 85,
"unitPriceDisplay": "85,50 €"
},
"3": {
"discountPercent": 10,
"discountValue": 9,
"discountValueDisplay": "9,00 €",
"unitPrice": 81,
"unitPriceDisplay": "81,00 €"
},
"4": {
"discountPercent": 15,
"discountValue": 13.5,
"discountValueDisplay": "13,50 €",
"unitPrice": 76.5,
"unitPriceDisplay": "76,50 €"
},
"5": {
"discountPercent": 25,
"discountValue": 22.5,
"discountValueDisplay": "$22.50",
"unitPrice": 67.5,
"unitPriceDisplay": "$67.50"
},
"currency": "EUR",
"price": 90,
"display": "90,00 €",
"quantityDiscount": null,
"discountReason": {
"en": "2023 Yearly Sale"
},
"discountPeriodCount": "null",
"available": {
"start": "2023-01-01 00:00",
"end": "2023-12-31 23:30"
},
"setupFeePrice": "11.0,",
"setupFeePriceDisplay": "12,00 €",
"setupFeeReason": {
"en": "Setup Fee"
}
}
}
}
]
}
GET
Get all offers for a product by offer type
{{baseUrl}}/products/offers/:product_path
QUERY PARAMS
product_path
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/products/offers/:product_path");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/products/offers/:product_path")
require "http/client"
url = "{{baseUrl}}/products/offers/:product_path"
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}}/products/offers/:product_path"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/products/offers/:product_path");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/products/offers/:product_path"
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/products/offers/:product_path HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/products/offers/:product_path")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/products/offers/:product_path"))
.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}}/products/offers/:product_path")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/products/offers/:product_path")
.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}}/products/offers/:product_path');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/products/offers/:product_path'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/products/offers/:product_path';
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}}/products/offers/:product_path',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/products/offers/:product_path")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/products/offers/:product_path',
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}}/products/offers/:product_path'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/products/offers/:product_path');
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}}/products/offers/:product_path'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/products/offers/:product_path';
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}}/products/offers/:product_path"]
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}}/products/offers/:product_path" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/products/offers/:product_path",
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}}/products/offers/:product_path');
echo $response->getBody();
setUrl('{{baseUrl}}/products/offers/:product_path');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/products/offers/:product_path');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/products/offers/:product_path' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/products/offers/:product_path' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/products/offers/:product_path")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/products/offers/:product_path"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/products/offers/:product_path"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/products/offers/:product_path")
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/products/offers/:product_path') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/products/offers/:product_path";
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}}/products/offers/:product_path
http GET {{baseUrl}}/products/offers/:product_path
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/products/offers/:product_path
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/products/offers/:product_path")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"products": [
{
"action": "product.offers.get",
"result": "success",
"product": "basic",
"offers": [
{
"type": "addon",
"display": {
"en": "Add-Ons"
},
"items": [
"analytics-dashboard",
"email-integration",
"marketing-automation"
]
},
{
"type": "cross-sell",
"display": {
"en": "💡 Discover our complementary products to maximize your results."
},
"items": [
"support-module",
"social-media-monitoring"
]
},
{
"type": "upsell",
"display": {
"en": "🚀 Take your experience to the next level with our premium plans."
},
"items": [
"standard",
"pro",
"enterprise"
]
},
{
"type": "downsell",
"display": {
"en": "💰 Save big with our budget-friendly option."
},
"items": [
"starter"
]
},
{
"type": "downgrade",
"display": {
"en": "✅ Keep your subscription within budget without sacrificing quality."
},
"items": [
"starter"
]
},
{
"type": "crossgrade",
"display": {
"en": "💡 Unlock new possibilities by including any of these items."
},
"items": [
"support-module",
"social-media-monitoring"
]
},
{
"type": "upgrade",
"display": {
"en": "🚀 Supercharge your subscription with premium plans."
},
"items": [
"standard",
"pro",
"enterprise"
]
}
]
}
]
}
GET
Get all product IDs
{{baseUrl}}/products
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/products");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/products")
require "http/client"
url = "{{baseUrl}}/products"
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}}/products"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/products");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/products"
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/products HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/products")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/products"))
.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}}/products")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/products")
.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}}/products');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/products'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/products';
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}}/products',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/products")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/products',
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}}/products'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/products');
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}}/products'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/products';
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}}/products"]
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}}/products" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/products",
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}}/products');
echo $response->getBody();
setUrl('{{baseUrl}}/products');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/products');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/products' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/products' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/products")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/products"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/products"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/products")
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/products') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/products";
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}}/products
http GET {{baseUrl}}/products
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/products
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/products")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "products.getall",
"result": "success",
"page": null,
"limit": null,
"nextPage": null,
"total": 0,
"products": [
"product_path",
"product_path",
"...",
"product_path"
]
}
GET
Get all product prices in specified country and currency
{{baseUrl}}/products/price?country=:country¤cy=:currency
QUERY PARAMS
country
currency
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/products/price" {:query-params {:country ":country"
:currency ":currency"}})
require "http/client"
url = "{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency"
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}}/products/price?country=%3Acountry¤cy=%3Acurrency"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency"
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/products/price?country=%3Acountry¤cy=%3Acurrency HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency"))
.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}}/products/price?country=%3Acountry¤cy=%3Acurrency")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency")
.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}}/products/price?country=%3Acountry¤cy=%3Acurrency');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/products/price',
params: {country: ':country', currency: ':currency'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency';
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}}/products/price?country=%3Acountry¤cy=%3Acurrency',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/products/price?country=%3Acountry¤cy=%3Acurrency',
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}}/products/price',
qs: {country: ':country', currency: ':currency'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/products/price');
req.query({
country: ':country',
currency: ':currency'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/products/price',
params: {country: ':country', currency: ':currency'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency';
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}}/products/price?country=%3Acountry¤cy=%3Acurrency"]
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}}/products/price?country=%3Acountry¤cy=%3Acurrency" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency",
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}}/products/price?country=%3Acountry¤cy=%3Acurrency');
echo $response->getBody();
setUrl('{{baseUrl}}/products/price');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'country' => ':country',
'currency' => ':currency'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/products/price');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'country' => ':country',
'currency' => ':currency'
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/products/price?country=%3Acountry¤cy=%3Acurrency")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/products/price"
querystring = {"country":":country","currency":":currency"}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/products/price"
queryString <- list(
country = ":country",
currency = ":currency"
)
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency")
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/products/price') do |req|
req.params['country'] = ':country'
req.params['currency'] = ':currency'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/products/price";
let querystring = [
("country", ":country"),
("currency", ":currency"),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency'
http GET '{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/products/price?country=%3Acountry¤cy=%3Acurrency")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"page": 1,
"limit": 50,
"nextPage": 2,
"products": [
{
"action": "product.price.getall",
"result": "success",
"product": "example-subscription",
"pricing": {
"PR": {
"2": {
"discountPercent": 5,
"discountValue": 5,
"discountValueDisplay": "$5.00",
"unitPrice": 95,
"unitPriceDisplay": "$95.00"
},
"3": {
"discountPercent": 10,
"discountValue": 10,
"discountValueDisplay": "$10.00",
"unitPrice": 90,
"unitPriceDisplay": "$90.00"
},
"4": {
"discountPercent": 15,
"discountValue": 15,
"discountValueDisplay": "$15.00",
"unitPrice": 85,
"unitPriceDisplay": "$85.00"
},
"5": {
"discountPercent": 25,
"discountValue": 25,
"discountValueDisplay": "$25.00",
"unitPrice": 75,
"unitPriceDisplay": "$75.00"
},
"currency": "USD",
"price": 100,
"display": "$100.00",
"quantityDiscount": null,
"discountReason": {
"en": "2023 Yearly Sale"
},
"discountPeriodCount": "null",
"available": {
"start": "2023-01-01 00:00",
"end": "2023-12-31 23:30"
},
"setupFeePrice": "10.0,",
"setupFeePriceDisplay": "$10.00",
"setupFeeReason": {
"en": "Setup Fee"
}
},
"DE": {
"2": {
"discountPercent": 5,
"discountValue": 4.5,
"discountValueDisplay": "4,50 €",
"unitPrice": 85,
"unitPriceDisplay": "85,50 €"
},
"3": {
"discountPercent": 10,
"discountValue": 9,
"discountValueDisplay": "9,00 €",
"unitPrice": 81,
"unitPriceDisplay": "81,00 €"
},
"4": {
"discountPercent": 15,
"discountValue": 13.5,
"discountValueDisplay": "13,50 €",
"unitPrice": 76.5,
"unitPriceDisplay": "76,50 €"
},
"5": {
"discountPercent": 25,
"discountValue": 22.5,
"discountValueDisplay": "$22.50",
"unitPrice": 67.5,
"unitPriceDisplay": "$67.50"
},
"currency": "EUR",
"price": 90,
"display": "90,00 €",
"quantityDiscount": null,
"discountReason": {
"en": "2023 Yearly Sale"
},
"discountPeriodCount": "null",
"available": {
"start": "2023-01-01 00:00",
"end": "2023-12-31 23:30"
},
"setupFeePrice": "11.0,",
"setupFeePriceDisplay": "12,00 €",
"setupFeeReason": {
"en": "Setup Fee"
}
}
}
}
]
}
GET
Get all product prices in specified country
{{baseUrl}}/products/price?country=:country
QUERY PARAMS
country
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/products/price?country=%3Acountry");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/products/price" {:query-params {:country ":country"}})
require "http/client"
url = "{{baseUrl}}/products/price?country=%3Acountry"
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}}/products/price?country=%3Acountry"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/products/price?country=%3Acountry");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/products/price?country=%3Acountry"
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/products/price?country=%3Acountry HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/products/price?country=%3Acountry")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/products/price?country=%3Acountry"))
.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}}/products/price?country=%3Acountry")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/products/price?country=%3Acountry")
.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}}/products/price?country=%3Acountry');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/products/price',
params: {country: ':country'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/products/price?country=%3Acountry';
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}}/products/price?country=%3Acountry',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/products/price?country=%3Acountry")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/products/price?country=%3Acountry',
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}}/products/price',
qs: {country: ':country'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/products/price');
req.query({
country: ':country'
});
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}}/products/price',
params: {country: ':country'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/products/price?country=%3Acountry';
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}}/products/price?country=%3Acountry"]
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}}/products/price?country=%3Acountry" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/products/price?country=%3Acountry",
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}}/products/price?country=%3Acountry');
echo $response->getBody();
setUrl('{{baseUrl}}/products/price');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'country' => ':country'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/products/price');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'country' => ':country'
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/products/price?country=%3Acountry' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/products/price?country=%3Acountry' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/products/price?country=%3Acountry")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/products/price"
querystring = {"country":":country"}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/products/price"
queryString <- list(country = ":country")
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/products/price?country=%3Acountry")
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/products/price') do |req|
req.params['country'] = ':country'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/products/price";
let querystring = [
("country", ":country"),
];
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/products/price?country=%3Acountry'
http GET '{{baseUrl}}/products/price?country=%3Acountry'
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/products/price?country=%3Acountry'
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/products/price?country=%3Acountry")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"page": 1,
"limit": 50,
"nextPage": 2,
"products": [
{
"action": "product.price.getall",
"result": "success",
"product": "example-subscription",
"pricing": {
"PR": {
"2": {
"discountPercent": 5,
"discountValue": 5,
"discountValueDisplay": "$5.00",
"unitPrice": 95,
"unitPriceDisplay": "$95.00"
},
"3": {
"discountPercent": 10,
"discountValue": 10,
"discountValueDisplay": "$10.00",
"unitPrice": 90,
"unitPriceDisplay": "$90.00"
},
"4": {
"discountPercent": 15,
"discountValue": 15,
"discountValueDisplay": "$15.00",
"unitPrice": 85,
"unitPriceDisplay": "$85.00"
},
"5": {
"discountPercent": 25,
"discountValue": 25,
"discountValueDisplay": "$25.00",
"unitPrice": 75,
"unitPriceDisplay": "$75.00"
},
"currency": "USD",
"price": 100,
"display": "$100.00",
"quantityDiscount": null,
"discountReason": {
"en": "2023 Yearly Sale"
},
"discountPeriodCount": "null",
"available": {
"start": "2023-01-01 00:00",
"end": "2023-12-31 23:30"
},
"setupFeePrice": "10.0,",
"setupFeePriceDisplay": "$10.00",
"setupFeeReason": {
"en": "Setup Fee"
}
},
"DE": {
"2": {
"discountPercent": 5,
"discountValue": 4.5,
"discountValueDisplay": "4,50 €",
"unitPrice": 85,
"unitPriceDisplay": "85,50 €"
},
"3": {
"discountPercent": 10,
"discountValue": 9,
"discountValueDisplay": "9,00 €",
"unitPrice": 81,
"unitPriceDisplay": "81,00 €"
},
"4": {
"discountPercent": 15,
"discountValue": 13.5,
"discountValueDisplay": "13,50 €",
"unitPrice": 76.5,
"unitPriceDisplay": "76,50 €"
},
"5": {
"discountPercent": 25,
"discountValue": 22.5,
"discountValueDisplay": "$22.50",
"unitPrice": 67.5,
"unitPriceDisplay": "$67.50"
},
"currency": "EUR",
"price": 90,
"display": "90,00 €",
"quantityDiscount": null,
"discountReason": {
"en": "2023 Yearly Sale"
},
"discountPeriodCount": "null",
"available": {
"start": "2023-01-01 00:00",
"end": "2023-12-31 23:30"
},
"setupFeePrice": "11.0,",
"setupFeePriceDisplay": "12,00 €",
"setupFeeReason": {
"en": "Setup Fee"
}
}
}
}
]
}
GET
Get all product prices
{{baseUrl}}/products/price
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/products/price");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/products/price")
require "http/client"
url = "{{baseUrl}}/products/price"
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}}/products/price"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/products/price");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/products/price"
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/products/price HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/products/price")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/products/price"))
.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}}/products/price")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/products/price")
.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}}/products/price');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/products/price'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/products/price';
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}}/products/price',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/products/price")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/products/price',
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}}/products/price'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/products/price');
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}}/products/price'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/products/price';
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}}/products/price"]
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}}/products/price" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/products/price",
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}}/products/price');
echo $response->getBody();
setUrl('{{baseUrl}}/products/price');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/products/price');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/products/price' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/products/price' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/products/price")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/products/price"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/products/price"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/products/price")
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/products/price') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/products/price";
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}}/products/price
http GET {{baseUrl}}/products/price
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/products/price
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/products/price")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"page": 1,
"limit": 50,
"nextPage": 2,
"products": [
{
"action": "product.price.getall",
"result": "success",
"product": "example-subscription",
"pricing": {
"PR": {
"2": {
"discountPercent": 5,
"discountValue": 5,
"discountValueDisplay": "$5.00",
"unitPrice": 95,
"unitPriceDisplay": "$95.00"
},
"3": {
"discountPercent": 10,
"discountValue": 10,
"discountValueDisplay": "$10.00",
"unitPrice": 90,
"unitPriceDisplay": "$90.00"
},
"4": {
"discountPercent": 15,
"discountValue": 15,
"discountValueDisplay": "$15.00",
"unitPrice": 85,
"unitPriceDisplay": "$85.00"
},
"5": {
"discountPercent": 25,
"discountValue": 25,
"discountValueDisplay": "$25.00",
"unitPrice": 75,
"unitPriceDisplay": "$75.00"
},
"currency": "USD",
"price": 100,
"display": "$100.00",
"quantityDiscount": null,
"discountReason": {
"en": "2023 Yearly Sale"
},
"discountPeriodCount": "null",
"available": {
"start": "2023-01-01 00:00",
"end": "2023-12-31 23:30"
},
"setupFeePrice": "10.0,",
"setupFeePriceDisplay": "$10.00",
"setupFeeReason": {
"en": "Setup Fee"
}
},
"DE": {
"2": {
"discountPercent": 5,
"discountValue": 4.5,
"discountValueDisplay": "4,50 €",
"unitPrice": 85,
"unitPriceDisplay": "85,50 €"
},
"3": {
"discountPercent": 10,
"discountValue": 9,
"discountValueDisplay": "9,00 €",
"unitPrice": 81,
"unitPriceDisplay": "81,00 €"
},
"4": {
"discountPercent": 15,
"discountValue": 13.5,
"discountValueDisplay": "13,50 €",
"unitPrice": 76.5,
"unitPriceDisplay": "76,50 €"
},
"5": {
"discountPercent": 25,
"discountValue": 22.5,
"discountValueDisplay": "$22.50",
"unitPrice": 67.5,
"unitPriceDisplay": "$67.50"
},
"currency": "EUR",
"price": 90,
"display": "90,00 €",
"quantityDiscount": null,
"discountReason": {
"en": "2023 Yearly Sale"
},
"discountPeriodCount": "null",
"available": {
"start": "2023-01-01 00:00",
"end": "2023-12-31 23:30"
},
"setupFeePrice": "11.0,",
"setupFeePriceDisplay": "12,00 €",
"setupFeeReason": {
"en": "Setup Fee"
}
}
}
}
]
}
GET
Get products by path
{{baseUrl}}/products/:product_path
QUERY PARAMS
product_path
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/products/:product_path");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/products/:product_path")
require "http/client"
url = "{{baseUrl}}/products/:product_path"
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}}/products/:product_path"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/products/:product_path");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/products/:product_path"
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/products/:product_path HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/products/:product_path")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/products/:product_path"))
.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}}/products/:product_path")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/products/:product_path")
.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}}/products/:product_path');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/products/:product_path'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/products/:product_path';
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}}/products/:product_path',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/products/:product_path")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/products/:product_path',
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}}/products/:product_path'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/products/:product_path');
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}}/products/:product_path'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/products/:product_path';
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}}/products/:product_path"]
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}}/products/:product_path" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/products/:product_path",
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}}/products/:product_path');
echo $response->getBody();
setUrl('{{baseUrl}}/products/:product_path');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/products/:product_path');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/products/:product_path' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/products/:product_path' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/products/:product_path")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/products/:product_path"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/products/:product_path"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/products/:product_path")
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/products/:product_path') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/products/:product_path";
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}}/products/:product_path
http GET {{baseUrl}}/products/:product_path
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/products/:product_path
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/products/:product_path")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"application/json": {
"products": [
{
"product": "{product_path}",
"parent": null,
"productAppReference": "QwEYIcPgTvaet2-pKLC9yU",
"display": {
"en": "product_name"
},
"offers": [
{
"type": "addon",
"display": {},
"items": [
"product_item"
]
}
],
"fulfillments": {
"sub-auto-addon_file_0": {
"fulfillment": "product_file",
"name": "File Download (signed.pdf)",
"applicability": "NON_REBILL_ONLY",
"display": null,
"url": null,
"size": null,
"behavior": "PREFER_EXPLICIT",
"previous": []
}
},
"format": "digital",
"taxcode": "DC020501",
"taxcodeDescription": "Computer Software - educational - prewritten/canned - electronically downloaded",
"pricing": {
"interval": "month",
"intervalLength": 1,
"intervalCount": null,
"quantityBehavior": "allow",
"quantityDefault": 1,
"price": {
"USD": 100
},
"dateLimitsEnabled": false,
"reminderNotification": {
"enabled": true,
"interval": "week",
"intervalLength": 1
},
"overdueNotification": {
"enabled": true,
"interval": "week",
"intervalLength": 1,
"amount": 4
},
"cancellation": {
"interval": "week",
"intervalLength": 1
}
},
"action": "products.get",
"result": "success"
}
]
}
}
POST
Cancel a quote
{{baseUrl}}/quotes/:id/cancel
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/quotes/:id/cancel");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/quotes/:id/cancel")
require "http/client"
url = "{{baseUrl}}/quotes/:id/cancel"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/quotes/:id/cancel"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/quotes/:id/cancel");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/quotes/:id/cancel"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/quotes/:id/cancel HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/quotes/:id/cancel")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/quotes/:id/cancel"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/quotes/:id/cancel")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/quotes/:id/cancel")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/quotes/:id/cancel');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/quotes/:id/cancel'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/quotes/:id/cancel';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/quotes/:id/cancel',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/quotes/:id/cancel")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/quotes/:id/cancel',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'POST', url: '{{baseUrl}}/quotes/:id/cancel'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/quotes/:id/cancel');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'POST', url: '{{baseUrl}}/quotes/:id/cancel'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/quotes/:id/cancel';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/quotes/:id/cancel"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/quotes/:id/cancel" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/quotes/:id/cancel",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/quotes/:id/cancel');
echo $response->getBody();
setUrl('{{baseUrl}}/quotes/:id/cancel');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/quotes/:id/cancel');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/quotes/:id/cancel' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/quotes/:id/cancel' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/quotes/:id/cancel")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/quotes/:id/cancel"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/quotes/:id/cancel"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/quotes/:id/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/quotes/:id/cancel') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/quotes/:id/cancel";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/quotes/:id/cancel
http POST {{baseUrl}}/quotes/:id/cancel
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/quotes/:id/cancel
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/quotes/:id/cancel")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"id": "QUVJIVYZTQDFBOBEO7IGNXER3VBQ",
"coupon": "TENOFF",
"created": "2021-03-02T19:48:56.395Z",
"currency": "USD",
"expires": "2021-04-01T19:48:56.395Z",
"expirationDateDays": 30,
"fulfillmentTerm": "ON_QUOTE_ACCEPTANCE",
"name": "Quote for ABC Company",
"notes": "This is a Note",
"netTermsDays": 30,
"quoteUrl": "https://josemunoz.test.qa2.onfastspring.com/popup-defaultB2B/account/order/quote/QUVJIVYZTQDFBOBEO7IGNXER3VBQ",
"siteId": "pOBehkkfTGo",
"status": "OPEN",
"updated": "2021-03-02T19:48:56.395Z",
"taxId": "BE09999999XX",
"source": "MANAGER",
"sourceIP": "181.55.25.101",
"isGrossTax": false
}
POST
Create a quote
{{baseUrl}}/quotes
BODY json
{
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/quotes");
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 \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/quotes" {:content-type :json
:form-params {:coupon ""
:currency ""
:expirationDateDays 0
:fulfillmentTerm ""
:items [{:product ""
:unitListPrice ""
:quantity 0}]
:name ""
:notes ""
:netTermsDays 0
:recipientAddress {:addressLine1 ""
:addressLine2 ""
:city ""
:country ""
:postalCode ""
:region ""}
:recipient {:company ""
:email ""
:first ""
:last ""
:phone ""}
:tags [{:key ""
:value ""}]
:taxId ""
:source ""
:sourceIP ""}})
require "http/client"
url = "{{baseUrl}}/quotes"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\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}}/quotes"),
Content = new StringContent("{\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\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}}/quotes");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/quotes"
payload := strings.NewReader("{\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\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/quotes HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 607
{
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/quotes")
.setHeader("content-type", "application/json")
.setBody("{\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/quotes"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\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 \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/quotes")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/quotes")
.header("content-type", "application/json")
.body("{\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\n}")
.asString();
const data = JSON.stringify({
coupon: '',
currency: '',
expirationDateDays: 0,
fulfillmentTerm: '',
items: [
{
product: '',
unitListPrice: '',
quantity: 0
}
],
name: '',
notes: '',
netTermsDays: 0,
recipientAddress: {
addressLine1: '',
addressLine2: '',
city: '',
country: '',
postalCode: '',
region: ''
},
recipient: {
company: '',
email: '',
first: '',
last: '',
phone: ''
},
tags: [
{
key: '',
value: ''
}
],
taxId: '',
source: '',
sourceIP: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/quotes');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/quotes',
headers: {'content-type': 'application/json'},
data: {
coupon: '',
currency: '',
expirationDateDays: 0,
fulfillmentTerm: '',
items: [{product: '', unitListPrice: '', quantity: 0}],
name: '',
notes: '',
netTermsDays: 0,
recipientAddress: {
addressLine1: '',
addressLine2: '',
city: '',
country: '',
postalCode: '',
region: ''
},
recipient: {company: '', email: '', first: '', last: '', phone: ''},
tags: [{key: '', value: ''}],
taxId: '',
source: '',
sourceIP: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/quotes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"coupon":"","currency":"","expirationDateDays":0,"fulfillmentTerm":"","items":[{"product":"","unitListPrice":"","quantity":0}],"name":"","notes":"","netTermsDays":0,"recipientAddress":{"addressLine1":"","addressLine2":"","city":"","country":"","postalCode":"","region":""},"recipient":{"company":"","email":"","first":"","last":"","phone":""},"tags":[{"key":"","value":""}],"taxId":"","source":"","sourceIP":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/quotes',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "coupon": "",\n "currency": "",\n "expirationDateDays": 0,\n "fulfillmentTerm": "",\n "items": [\n {\n "product": "",\n "unitListPrice": "",\n "quantity": 0\n }\n ],\n "name": "",\n "notes": "",\n "netTermsDays": 0,\n "recipientAddress": {\n "addressLine1": "",\n "addressLine2": "",\n "city": "",\n "country": "",\n "postalCode": "",\n "region": ""\n },\n "recipient": {\n "company": "",\n "email": "",\n "first": "",\n "last": "",\n "phone": ""\n },\n "tags": [\n {\n "key": "",\n "value": ""\n }\n ],\n "taxId": "",\n "source": "",\n "sourceIP": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/quotes")
.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/quotes',
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({
coupon: '',
currency: '',
expirationDateDays: 0,
fulfillmentTerm: '',
items: [{product: '', unitListPrice: '', quantity: 0}],
name: '',
notes: '',
netTermsDays: 0,
recipientAddress: {
addressLine1: '',
addressLine2: '',
city: '',
country: '',
postalCode: '',
region: ''
},
recipient: {company: '', email: '', first: '', last: '', phone: ''},
tags: [{key: '', value: ''}],
taxId: '',
source: '',
sourceIP: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/quotes',
headers: {'content-type': 'application/json'},
body: {
coupon: '',
currency: '',
expirationDateDays: 0,
fulfillmentTerm: '',
items: [{product: '', unitListPrice: '', quantity: 0}],
name: '',
notes: '',
netTermsDays: 0,
recipientAddress: {
addressLine1: '',
addressLine2: '',
city: '',
country: '',
postalCode: '',
region: ''
},
recipient: {company: '', email: '', first: '', last: '', phone: ''},
tags: [{key: '', value: ''}],
taxId: '',
source: '',
sourceIP: ''
},
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}}/quotes');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
coupon: '',
currency: '',
expirationDateDays: 0,
fulfillmentTerm: '',
items: [
{
product: '',
unitListPrice: '',
quantity: 0
}
],
name: '',
notes: '',
netTermsDays: 0,
recipientAddress: {
addressLine1: '',
addressLine2: '',
city: '',
country: '',
postalCode: '',
region: ''
},
recipient: {
company: '',
email: '',
first: '',
last: '',
phone: ''
},
tags: [
{
key: '',
value: ''
}
],
taxId: '',
source: '',
sourceIP: ''
});
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}}/quotes',
headers: {'content-type': 'application/json'},
data: {
coupon: '',
currency: '',
expirationDateDays: 0,
fulfillmentTerm: '',
items: [{product: '', unitListPrice: '', quantity: 0}],
name: '',
notes: '',
netTermsDays: 0,
recipientAddress: {
addressLine1: '',
addressLine2: '',
city: '',
country: '',
postalCode: '',
region: ''
},
recipient: {company: '', email: '', first: '', last: '', phone: ''},
tags: [{key: '', value: ''}],
taxId: '',
source: '',
sourceIP: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/quotes';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"coupon":"","currency":"","expirationDateDays":0,"fulfillmentTerm":"","items":[{"product":"","unitListPrice":"","quantity":0}],"name":"","notes":"","netTermsDays":0,"recipientAddress":{"addressLine1":"","addressLine2":"","city":"","country":"","postalCode":"","region":""},"recipient":{"company":"","email":"","first":"","last":"","phone":""},"tags":[{"key":"","value":""}],"taxId":"","source":"","sourceIP":""}'
};
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 = @{ @"coupon": @"",
@"currency": @"",
@"expirationDateDays": @0,
@"fulfillmentTerm": @"",
@"items": @[ @{ @"product": @"", @"unitListPrice": @"", @"quantity": @0 } ],
@"name": @"",
@"notes": @"",
@"netTermsDays": @0,
@"recipientAddress": @{ @"addressLine1": @"", @"addressLine2": @"", @"city": @"", @"country": @"", @"postalCode": @"", @"region": @"" },
@"recipient": @{ @"company": @"", @"email": @"", @"first": @"", @"last": @"", @"phone": @"" },
@"tags": @[ @{ @"key": @"", @"value": @"" } ],
@"taxId": @"",
@"source": @"",
@"sourceIP": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/quotes"]
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}}/quotes" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/quotes",
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([
'coupon' => '',
'currency' => '',
'expirationDateDays' => 0,
'fulfillmentTerm' => '',
'items' => [
[
'product' => '',
'unitListPrice' => '',
'quantity' => 0
]
],
'name' => '',
'notes' => '',
'netTermsDays' => 0,
'recipientAddress' => [
'addressLine1' => '',
'addressLine2' => '',
'city' => '',
'country' => '',
'postalCode' => '',
'region' => ''
],
'recipient' => [
'company' => '',
'email' => '',
'first' => '',
'last' => '',
'phone' => ''
],
'tags' => [
[
'key' => '',
'value' => ''
]
],
'taxId' => '',
'source' => '',
'sourceIP' => ''
]),
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}}/quotes', [
'body' => '{
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/quotes');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'coupon' => '',
'currency' => '',
'expirationDateDays' => 0,
'fulfillmentTerm' => '',
'items' => [
[
'product' => '',
'unitListPrice' => '',
'quantity' => 0
]
],
'name' => '',
'notes' => '',
'netTermsDays' => 0,
'recipientAddress' => [
'addressLine1' => '',
'addressLine2' => '',
'city' => '',
'country' => '',
'postalCode' => '',
'region' => ''
],
'recipient' => [
'company' => '',
'email' => '',
'first' => '',
'last' => '',
'phone' => ''
],
'tags' => [
[
'key' => '',
'value' => ''
]
],
'taxId' => '',
'source' => '',
'sourceIP' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'coupon' => '',
'currency' => '',
'expirationDateDays' => 0,
'fulfillmentTerm' => '',
'items' => [
[
'product' => '',
'unitListPrice' => '',
'quantity' => 0
]
],
'name' => '',
'notes' => '',
'netTermsDays' => 0,
'recipientAddress' => [
'addressLine1' => '',
'addressLine2' => '',
'city' => '',
'country' => '',
'postalCode' => '',
'region' => ''
],
'recipient' => [
'company' => '',
'email' => '',
'first' => '',
'last' => '',
'phone' => ''
],
'tags' => [
[
'key' => '',
'value' => ''
]
],
'taxId' => '',
'source' => '',
'sourceIP' => ''
]));
$request->setRequestUrl('{{baseUrl}}/quotes');
$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}}/quotes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/quotes' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/quotes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/quotes"
payload = {
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/quotes"
payload <- "{\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\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}}/quotes")
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 \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\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/quotes') do |req|
req.body = "{\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/quotes";
let payload = json!({
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": (
json!({
"product": "",
"unitListPrice": "",
"quantity": 0
})
),
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": json!({
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
}),
"recipient": json!({
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}),
"tags": (
json!({
"key": "",
"value": ""
})
),
"taxId": "",
"source": "",
"sourceIP": ""
});
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}}/quotes \
--header 'content-type: application/json' \
--data '{
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": ""
}'
echo '{
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": ""
}' | \
http POST {{baseUrl}}/quotes \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "coupon": "",\n "currency": "",\n "expirationDateDays": 0,\n "fulfillmentTerm": "",\n "items": [\n {\n "product": "",\n "unitListPrice": "",\n "quantity": 0\n }\n ],\n "name": "",\n "notes": "",\n "netTermsDays": 0,\n "recipientAddress": {\n "addressLine1": "",\n "addressLine2": "",\n "city": "",\n "country": "",\n "postalCode": "",\n "region": ""\n },\n "recipient": {\n "company": "",\n "email": "",\n "first": "",\n "last": "",\n "phone": ""\n },\n "tags": [\n {\n "key": "",\n "value": ""\n }\n ],\n "taxId": "",\n "source": "",\n "sourceIP": ""\n}' \
--output-document \
- {{baseUrl}}/quotes
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
[
"product": "",
"unitListPrice": "",
"quantity": 0
]
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": [
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
],
"recipient": [
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
],
"tags": [
[
"key": "",
"value": ""
]
],
"taxId": "",
"source": "",
"sourceIP": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/quotes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"id": "QUVJIVYZTQDFBOBEO7IGNXER3VBQ",
"coupon": "TENOFF",
"created": "2021-03-02T19:48:56.395Z",
"currency": "USD",
"expires": "2021-04-01T19:48:56.395Z",
"expirationDateDays": 30,
"fulfillmentTerm": "ON_QUOTE_ACCEPTANCE",
"name": "Quote for ABC Company",
"notes": "This is a Note",
"netTermsDays": 30,
"quoteUrl": "https://josemunoz.test.qa2.onfastspring.com/popup-defaultB2B/account/order/quote/QUVJIVYZTQDFBOBEO7IGNXER3VBQ",
"siteId": "pOBehkkfTGo",
"status": "OPEN",
"updated": "2021-03-02T19:48:56.395Z",
"taxId": "BE09999999XX",
"source": "MANAGER",
"sourceIP": "181.55.25.101",
"isGrossTax": false
}
DELETE
Delete a quote
{{baseUrl}}/quotes/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/quotes/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/quotes/:id")
require "http/client"
url = "{{baseUrl}}/quotes/:id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/quotes/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/quotes/:id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/quotes/:id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/quotes/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/quotes/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/quotes/:id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/quotes/:id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/quotes/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/quotes/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'DELETE', url: '{{baseUrl}}/quotes/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/quotes/:id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/quotes/:id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/quotes/:id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/quotes/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'DELETE', url: '{{baseUrl}}/quotes/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/quotes/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'DELETE', url: '{{baseUrl}}/quotes/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/quotes/:id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/quotes/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/quotes/:id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/quotes/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/quotes/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/quotes/:id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/quotes/:id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/quotes/:id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/quotes/:id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/quotes/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/quotes/:id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/quotes/:id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/quotes/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/quotes/:id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/quotes/:id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/quotes/:id
http DELETE {{baseUrl}}/quotes/:id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/quotes/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/quotes/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"id": "QUVJIVYZTQDFBOBEO7IGNXER3VBQ",
"coupon": "TENOFF",
"created": "2021-03-02T19:48:56.395Z",
"currency": "USD",
"expires": "2021-04-01T19:48:56.395Z",
"expirationDateDays": 30,
"fulfillmentTerm": "ON_QUOTE_ACCEPTANCE",
"name": "Quote for ABC Company",
"notes": "This is a Note",
"netTermsDays": 30,
"quoteUrl": "https://josemunoz.test.qa2.onfastspring.com/popup-defaultB2B/account/order/quote/QUVJIVYZTQDFBOBEO7IGNXER3VBQ",
"siteId": "pOBehkkfTGo",
"status": "OPEN",
"updated": "2021-03-02T19:48:56.395Z",
"taxId": "BE09999999XX",
"source": "MANAGER",
"sourceIP": "181.55.25.101",
"isGrossTax": false
}
GET
Get a quote
{{baseUrl}}/quotes/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/quotes/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/quotes/:id")
require "http/client"
url = "{{baseUrl}}/quotes/:id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/quotes/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/quotes/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/quotes/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/quotes/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/quotes/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/quotes/:id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/quotes/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/quotes/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/quotes/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/quotes/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/quotes/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/quotes/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/quotes/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/quotes/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/quotes/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/quotes/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/quotes/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/quotes/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/quotes/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/quotes/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/quotes/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/quotes/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/quotes/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/quotes/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/quotes/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/quotes/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/quotes/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/quotes/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/quotes/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/quotes/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/quotes/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/quotes/:id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/quotes/:id
http GET {{baseUrl}}/quotes/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/quotes/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/quotes/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"id": "QUVJIVYZTQDFBOBEO7IGNXER3VBQ",
"coupon": "TENOFF",
"created": "2021-03-02T19:48:56.395Z",
"currency": "USD",
"expires": "2021-04-01T19:48:56.395Z",
"expirationDateDays": 30,
"fulfillmentTerm": "ON_QUOTE_ACCEPTANCE",
"name": "Quote for ABC Company",
"notes": "This is a Note",
"netTermsDays": 30,
"quoteUrl": "https://josemunoz.test.qa2.onfastspring.com/popup-defaultB2B/account/order/quote/QUVJIVYZTQDFBOBEO7IGNXER3VBQ",
"siteId": "pOBehkkfTGo",
"status": "OPEN",
"updated": "2021-03-02T19:48:56.395Z",
"taxId": "BE09999999XX",
"source": "MANAGER",
"sourceIP": "181.55.25.101",
"isGrossTax": false
}
GET
Get all quotes
{{baseUrl}}/quotes
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/quotes");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/quotes")
require "http/client"
url = "{{baseUrl}}/quotes"
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}}/quotes"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/quotes");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/quotes"
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/quotes HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/quotes")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/quotes"))
.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}}/quotes")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/quotes")
.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}}/quotes');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/quotes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/quotes';
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}}/quotes',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/quotes")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/quotes',
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}}/quotes'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/quotes');
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}}/quotes'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/quotes';
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}}/quotes"]
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}}/quotes" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/quotes",
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}}/quotes');
echo $response->getBody();
setUrl('{{baseUrl}}/quotes');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/quotes');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/quotes' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/quotes' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/quotes")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/quotes"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/quotes"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/quotes")
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/quotes') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/quotes";
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}}/quotes
http GET {{baseUrl}}/quotes
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/quotes
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/quotes")! 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
Update a quote
{{baseUrl}}/quotes/:id
QUERY PARAMS
id
BODY json
{
"updateQuoteRequest": {
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"status": "",
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": "",
"invoiceId": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/quotes/: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 \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/quotes/:id" {:content-type :json
:form-params {:updateQuoteRequest {:coupon ""
:currency ""
:expirationDateDays 0
:fulfillmentTerm ""
:items [{:product ""
:unitListPrice ""
:quantity 0}]
:name ""
:notes ""
:netTermsDays 0
:recipientAddress {:addressLine1 ""
:addressLine2 ""
:city ""
:country ""
:postalCode ""
:region ""}
:recipient {:company ""
:email ""
:first ""
:last ""
:phone ""}
:status ""
:tags [{:key ""
:value ""}]
:taxId ""
:source ""
:sourceIP ""
:invoiceId ""}}})
require "http/client"
url = "{{baseUrl}}/quotes/:id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\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}}/quotes/:id"),
Content = new StringContent("{\n \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\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}}/quotes/:id");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/quotes/:id"
payload := strings.NewReader("{\n \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\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/quotes/:id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 752
{
"updateQuoteRequest": {
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"status": "",
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": "",
"invoiceId": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/quotes/:id")
.setHeader("content-type", "application/json")
.setBody("{\n \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/quotes/:id"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\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 \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/quotes/:id")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/quotes/:id")
.header("content-type", "application/json")
.body("{\n \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
updateQuoteRequest: {
coupon: '',
currency: '',
expirationDateDays: 0,
fulfillmentTerm: '',
items: [
{
product: '',
unitListPrice: '',
quantity: 0
}
],
name: '',
notes: '',
netTermsDays: 0,
recipientAddress: {
addressLine1: '',
addressLine2: '',
city: '',
country: '',
postalCode: '',
region: ''
},
recipient: {
company: '',
email: '',
first: '',
last: '',
phone: ''
},
status: '',
tags: [
{
key: '',
value: ''
}
],
taxId: '',
source: '',
sourceIP: '',
invoiceId: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/quotes/:id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/quotes/:id',
headers: {'content-type': 'application/json'},
data: {
updateQuoteRequest: {
coupon: '',
currency: '',
expirationDateDays: 0,
fulfillmentTerm: '',
items: [{product: '', unitListPrice: '', quantity: 0}],
name: '',
notes: '',
netTermsDays: 0,
recipientAddress: {
addressLine1: '',
addressLine2: '',
city: '',
country: '',
postalCode: '',
region: ''
},
recipient: {company: '', email: '', first: '', last: '', phone: ''},
status: '',
tags: [{key: '', value: ''}],
taxId: '',
source: '',
sourceIP: '',
invoiceId: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/quotes/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"updateQuoteRequest":{"coupon":"","currency":"","expirationDateDays":0,"fulfillmentTerm":"","items":[{"product":"","unitListPrice":"","quantity":0}],"name":"","notes":"","netTermsDays":0,"recipientAddress":{"addressLine1":"","addressLine2":"","city":"","country":"","postalCode":"","region":""},"recipient":{"company":"","email":"","first":"","last":"","phone":""},"status":"","tags":[{"key":"","value":""}],"taxId":"","source":"","sourceIP":"","invoiceId":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/quotes/:id',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "updateQuoteRequest": {\n "coupon": "",\n "currency": "",\n "expirationDateDays": 0,\n "fulfillmentTerm": "",\n "items": [\n {\n "product": "",\n "unitListPrice": "",\n "quantity": 0\n }\n ],\n "name": "",\n "notes": "",\n "netTermsDays": 0,\n "recipientAddress": {\n "addressLine1": "",\n "addressLine2": "",\n "city": "",\n "country": "",\n "postalCode": "",\n "region": ""\n },\n "recipient": {\n "company": "",\n "email": "",\n "first": "",\n "last": "",\n "phone": ""\n },\n "status": "",\n "tags": [\n {\n "key": "",\n "value": ""\n }\n ],\n "taxId": "",\n "source": "",\n "sourceIP": "",\n "invoiceId": ""\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 \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/quotes/:id")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/quotes/: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({
updateQuoteRequest: {
coupon: '',
currency: '',
expirationDateDays: 0,
fulfillmentTerm: '',
items: [{product: '', unitListPrice: '', quantity: 0}],
name: '',
notes: '',
netTermsDays: 0,
recipientAddress: {
addressLine1: '',
addressLine2: '',
city: '',
country: '',
postalCode: '',
region: ''
},
recipient: {company: '', email: '', first: '', last: '', phone: ''},
status: '',
tags: [{key: '', value: ''}],
taxId: '',
source: '',
sourceIP: '',
invoiceId: ''
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/quotes/:id',
headers: {'content-type': 'application/json'},
body: {
updateQuoteRequest: {
coupon: '',
currency: '',
expirationDateDays: 0,
fulfillmentTerm: '',
items: [{product: '', unitListPrice: '', quantity: 0}],
name: '',
notes: '',
netTermsDays: 0,
recipientAddress: {
addressLine1: '',
addressLine2: '',
city: '',
country: '',
postalCode: '',
region: ''
},
recipient: {company: '', email: '', first: '', last: '', phone: ''},
status: '',
tags: [{key: '', value: ''}],
taxId: '',
source: '',
sourceIP: '',
invoiceId: ''
}
},
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}}/quotes/:id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
updateQuoteRequest: {
coupon: '',
currency: '',
expirationDateDays: 0,
fulfillmentTerm: '',
items: [
{
product: '',
unitListPrice: '',
quantity: 0
}
],
name: '',
notes: '',
netTermsDays: 0,
recipientAddress: {
addressLine1: '',
addressLine2: '',
city: '',
country: '',
postalCode: '',
region: ''
},
recipient: {
company: '',
email: '',
first: '',
last: '',
phone: ''
},
status: '',
tags: [
{
key: '',
value: ''
}
],
taxId: '',
source: '',
sourceIP: '',
invoiceId: ''
}
});
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}}/quotes/:id',
headers: {'content-type': 'application/json'},
data: {
updateQuoteRequest: {
coupon: '',
currency: '',
expirationDateDays: 0,
fulfillmentTerm: '',
items: [{product: '', unitListPrice: '', quantity: 0}],
name: '',
notes: '',
netTermsDays: 0,
recipientAddress: {
addressLine1: '',
addressLine2: '',
city: '',
country: '',
postalCode: '',
region: ''
},
recipient: {company: '', email: '', first: '', last: '', phone: ''},
status: '',
tags: [{key: '', value: ''}],
taxId: '',
source: '',
sourceIP: '',
invoiceId: ''
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/quotes/:id';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"updateQuoteRequest":{"coupon":"","currency":"","expirationDateDays":0,"fulfillmentTerm":"","items":[{"product":"","unitListPrice":"","quantity":0}],"name":"","notes":"","netTermsDays":0,"recipientAddress":{"addressLine1":"","addressLine2":"","city":"","country":"","postalCode":"","region":""},"recipient":{"company":"","email":"","first":"","last":"","phone":""},"status":"","tags":[{"key":"","value":""}],"taxId":"","source":"","sourceIP":"","invoiceId":""}}'
};
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 = @{ @"updateQuoteRequest": @{ @"coupon": @"", @"currency": @"", @"expirationDateDays": @0, @"fulfillmentTerm": @"", @"items": @[ @{ @"product": @"", @"unitListPrice": @"", @"quantity": @0 } ], @"name": @"", @"notes": @"", @"netTermsDays": @0, @"recipientAddress": @{ @"addressLine1": @"", @"addressLine2": @"", @"city": @"", @"country": @"", @"postalCode": @"", @"region": @"" }, @"recipient": @{ @"company": @"", @"email": @"", @"first": @"", @"last": @"", @"phone": @"" }, @"status": @"", @"tags": @[ @{ @"key": @"", @"value": @"" } ], @"taxId": @"", @"source": @"", @"sourceIP": @"", @"invoiceId": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/quotes/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/quotes/:id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/quotes/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'updateQuoteRequest' => [
'coupon' => '',
'currency' => '',
'expirationDateDays' => 0,
'fulfillmentTerm' => '',
'items' => [
[
'product' => '',
'unitListPrice' => '',
'quantity' => 0
]
],
'name' => '',
'notes' => '',
'netTermsDays' => 0,
'recipientAddress' => [
'addressLine1' => '',
'addressLine2' => '',
'city' => '',
'country' => '',
'postalCode' => '',
'region' => ''
],
'recipient' => [
'company' => '',
'email' => '',
'first' => '',
'last' => '',
'phone' => ''
],
'status' => '',
'tags' => [
[
'key' => '',
'value' => ''
]
],
'taxId' => '',
'source' => '',
'sourceIP' => '',
'invoiceId' => ''
]
]),
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}}/quotes/:id', [
'body' => '{
"updateQuoteRequest": {
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"status": "",
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": "",
"invoiceId": ""
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/quotes/:id');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'updateQuoteRequest' => [
'coupon' => '',
'currency' => '',
'expirationDateDays' => 0,
'fulfillmentTerm' => '',
'items' => [
[
'product' => '',
'unitListPrice' => '',
'quantity' => 0
]
],
'name' => '',
'notes' => '',
'netTermsDays' => 0,
'recipientAddress' => [
'addressLine1' => '',
'addressLine2' => '',
'city' => '',
'country' => '',
'postalCode' => '',
'region' => ''
],
'recipient' => [
'company' => '',
'email' => '',
'first' => '',
'last' => '',
'phone' => ''
],
'status' => '',
'tags' => [
[
'key' => '',
'value' => ''
]
],
'taxId' => '',
'source' => '',
'sourceIP' => '',
'invoiceId' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'updateQuoteRequest' => [
'coupon' => '',
'currency' => '',
'expirationDateDays' => 0,
'fulfillmentTerm' => '',
'items' => [
[
'product' => '',
'unitListPrice' => '',
'quantity' => 0
]
],
'name' => '',
'notes' => '',
'netTermsDays' => 0,
'recipientAddress' => [
'addressLine1' => '',
'addressLine2' => '',
'city' => '',
'country' => '',
'postalCode' => '',
'region' => ''
],
'recipient' => [
'company' => '',
'email' => '',
'first' => '',
'last' => '',
'phone' => ''
],
'status' => '',
'tags' => [
[
'key' => '',
'value' => ''
]
],
'taxId' => '',
'source' => '',
'sourceIP' => '',
'invoiceId' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/quotes/:id');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/quotes/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"updateQuoteRequest": {
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"status": "",
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": "",
"invoiceId": ""
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/quotes/:id' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"updateQuoteRequest": {
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"status": "",
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": "",
"invoiceId": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/quotes/:id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/quotes/:id"
payload = { "updateQuoteRequest": {
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"status": "",
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": "",
"invoiceId": ""
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/quotes/:id"
payload <- "{\n \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\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}}/quotes/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\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/quotes/:id') do |req|
req.body = "{\n \"updateQuoteRequest\": {\n \"coupon\": \"\",\n \"currency\": \"\",\n \"expirationDateDays\": 0,\n \"fulfillmentTerm\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"unitListPrice\": \"\",\n \"quantity\": 0\n }\n ],\n \"name\": \"\",\n \"notes\": \"\",\n \"netTermsDays\": 0,\n \"recipientAddress\": {\n \"addressLine1\": \"\",\n \"addressLine2\": \"\",\n \"city\": \"\",\n \"country\": \"\",\n \"postalCode\": \"\",\n \"region\": \"\"\n },\n \"recipient\": {\n \"company\": \"\",\n \"email\": \"\",\n \"first\": \"\",\n \"last\": \"\",\n \"phone\": \"\"\n },\n \"status\": \"\",\n \"tags\": [\n {\n \"key\": \"\",\n \"value\": \"\"\n }\n ],\n \"taxId\": \"\",\n \"source\": \"\",\n \"sourceIP\": \"\",\n \"invoiceId\": \"\"\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}}/quotes/:id";
let payload = json!({"updateQuoteRequest": json!({
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": (
json!({
"product": "",
"unitListPrice": "",
"quantity": 0
})
),
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": json!({
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
}),
"recipient": json!({
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
}),
"status": "",
"tags": (
json!({
"key": "",
"value": ""
})
),
"taxId": "",
"source": "",
"sourceIP": "",
"invoiceId": ""
})});
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}}/quotes/:id \
--header 'content-type: application/json' \
--data '{
"updateQuoteRequest": {
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"status": "",
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": "",
"invoiceId": ""
}
}'
echo '{
"updateQuoteRequest": {
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
{
"product": "",
"unitListPrice": "",
"quantity": 0
}
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": {
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
},
"recipient": {
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
},
"status": "",
"tags": [
{
"key": "",
"value": ""
}
],
"taxId": "",
"source": "",
"sourceIP": "",
"invoiceId": ""
}
}' | \
http PUT {{baseUrl}}/quotes/:id \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "updateQuoteRequest": {\n "coupon": "",\n "currency": "",\n "expirationDateDays": 0,\n "fulfillmentTerm": "",\n "items": [\n {\n "product": "",\n "unitListPrice": "",\n "quantity": 0\n }\n ],\n "name": "",\n "notes": "",\n "netTermsDays": 0,\n "recipientAddress": {\n "addressLine1": "",\n "addressLine2": "",\n "city": "",\n "country": "",\n "postalCode": "",\n "region": ""\n },\n "recipient": {\n "company": "",\n "email": "",\n "first": "",\n "last": "",\n "phone": ""\n },\n "status": "",\n "tags": [\n {\n "key": "",\n "value": ""\n }\n ],\n "taxId": "",\n "source": "",\n "sourceIP": "",\n "invoiceId": ""\n }\n}' \
--output-document \
- {{baseUrl}}/quotes/:id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["updateQuoteRequest": [
"coupon": "",
"currency": "",
"expirationDateDays": 0,
"fulfillmentTerm": "",
"items": [
[
"product": "",
"unitListPrice": "",
"quantity": 0
]
],
"name": "",
"notes": "",
"netTermsDays": 0,
"recipientAddress": [
"addressLine1": "",
"addressLine2": "",
"city": "",
"country": "",
"postalCode": "",
"region": ""
],
"recipient": [
"company": "",
"email": "",
"first": "",
"last": "",
"phone": ""
],
"status": "",
"tags": [
[
"key": "",
"value": ""
]
],
"taxId": "",
"source": "",
"sourceIP": "",
"invoiceId": ""
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/quotes/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
*/*
RESPONSE BODY text
{
"id": "QUVJIVYZTQDFBOBEO7IGNXER3VBQ",
"coupon": "TENOFF",
"created": "2021-03-02T19:48:56.395Z",
"currency": "USD",
"expires": "2021-04-01T19:48:56.395Z",
"expirationDateDays": 30,
"fulfillmentTerm": "ON_QUOTE_ACCEPTANCE",
"name": "Quote for ABC Company",
"notes": "This is a Note",
"netTermsDays": 30,
"quoteUrl": "https://josemunoz.test.qa2.onfastspring.com/popup-defaultB2B/account/order/quote/QUVJIVYZTQDFBOBEO7IGNXER3VBQ",
"siteId": "pOBehkkfTGo",
"status": "OPEN",
"updated": "2021-03-02T19:48:56.395Z",
"taxId": "BE09999999XX",
"source": "MANAGER",
"sourceIP": "181.55.25.101",
"isGrossTax": false
}
POST
Create returns
{{baseUrl}}/returns
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/returns");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/returns")
require "http/client"
url = "{{baseUrl}}/returns"
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}}/returns"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/returns");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/returns"
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/returns HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/returns")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/returns"))
.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}}/returns")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/returns")
.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}}/returns');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/returns'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/returns';
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}}/returns',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/returns")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/returns',
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}}/returns'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/returns');
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}}/returns'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/returns';
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}}/returns"]
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}}/returns" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/returns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/returns');
echo $response->getBody();
setUrl('{{baseUrl}}/returns');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/returns');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/returns' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/returns' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = ""
conn.request("POST", "/baseUrl/returns", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/returns"
payload = ""
response = requests.post(url, data=payload)
print(response.json())
library(httr)
url <- "{{baseUrl}}/returns"
payload <- ""
response <- VERB("POST", url, body = payload, content_type(""))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/returns")
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/returns') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/returns";
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}}/returns
http POST {{baseUrl}}/returns
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/returns
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/returns")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"returns": [
{
"return": "JV8jCQrJT1GD7yndYgrorw",
"reference": "FUR191003-4739-52106X",
"completed": true,
"changed": 1570130905372,
"changedValue": 1570130905372,
"changedInSeconds": 1570130905,
"changedDisplay": "10/3/19",
"live": true,
"account": "2-hl9JWwQrualioCsY5lbg",
"currency": "USD",
"payoutCurrency": "USD",
"totalReturn": 5.31,
"totalReturnDisplay": "$5.31",
"totalReturnInPayoutCurrency": 5.31,
"totalReturnInPayoutCurrencyDisplay": "$5.31",
"tax": 0.36,
"taxDisplay": "$0.36",
"taxInPayoutCurrency": 0.36,
"taxInPayoutCurrencyDisplay": "$0.36",
"subtotal": 4.95,
"subtotalDisplay": "$4.95",
"subtotalInPayoutCurrency": 4.95,
"subtotalInPayoutCurrencyDisplay": "$4.95",
"totalRefundInPayoutCurrency": 5.31,
"payment": {
"type": "creditcard",
"creditcard": "visa",
"cardEnding": "0369"
},
"reason": "DUPLICATE_ORDER",
"note": "As requested by customer",
"original": {
"id": "kfPW5xbyTG-TuivKhtZYrA",
"order": "kfPW5xbyTG-TuivKhtZYrA",
"reference": "FUR191003-8210-23117",
"account": "2-hl9JWwQrualioCsY5lbg",
"currency": "USD",
"payoutCurrency": "USD",
"total": 5.31,
"totalDisplay": "$5.31",
"totalInPayoutCurrency": 5.31,
"totalInPayoutCurrencyDisplay": "$5.31",
"tax": 0.36,
"taxDisplay": "$0.36",
"taxInPayoutCurrency": 0.36,
"taxInPayoutCurrencyDisplay": "$0.36",
"subtotal": 4.95,
"subtotalDisplay": "$4.95",
"subtotalInPayoutCurrency": 4.95,
"subtotalInPayoutCurrencyDisplay": "$4.95",
"notes": []
},
"customer": {
"first": "Leeroy",
"last": "Jenkins",
"email": "ne1@all.com",
"company": null,
"phone": null
},
"items": [
{
"product": "eggs",
"quantity": 1,
"display": "Eggs",
"sku": "falcon1",
"subtotal": 4.95,
"subtotalDisplay": "$4.95",
"subtotalInPayoutCurrency": 4.95,
"subtotalInPayoutCurrencyDisplay": "$4.95",
"attributes": {
"conditions": "{exclude:{countries:['AT','GB']}}"
}
}
],
"action": "return.create",
"result": "success"
}
]
}
GET
Get returns
{{baseUrl}}/returns/:id
QUERY PARAMS
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/returns/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/returns/:id")
require "http/client"
url = "{{baseUrl}}/returns/:id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/returns/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/returns/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/returns/:id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/returns/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/returns/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/returns/:id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/returns/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/returns/:id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/returns/:id');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/returns/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/returns/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/returns/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/returns/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/returns/:id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'GET', url: '{{baseUrl}}/returns/:id'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/returns/:id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'GET', url: '{{baseUrl}}/returns/:id'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/returns/:id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/returns/:id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/returns/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/returns/:id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/returns/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/returns/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/returns/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/returns/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/returns/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/returns/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/returns/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/returns/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/returns/:id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/returns/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/returns/:id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/returns/:id
http GET {{baseUrl}}/returns/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/returns/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/returns/:id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"returns": [
{
"return": "QpMoe70PT5mMb5OMT4N5lA",
"reference": "SUD160811-6921-74128X",
"completed": true,
"changed": 1470953997043,
"changedValue": 1470953997043,
"changedInSeconds": 1470953997,
"changedDisplay": "8/11/16",
"live": false,
"account": "_sOMzG2pSIyAeWXkcoNgUA",
"currency": "USD",
"payoutCurrency": "USD",
"totalReturn": 10,
"totalReturnDisplay": "$10.00",
"totalReturnInPayoutCurrency": 10,
"totalReturnInPayoutCurrencyDisplay": "$10.00",
"tax": 0,
"taxDisplay": "$0.00",
"taxInPayoutCurrency": 0,
"taxInPayoutCurrencyDisplay": "$0.00",
"subtotal": 10,
"subtotalDisplay": "$10.00",
"subtotalInPayoutCurrency": 10,
"subtotalInPayoutCurrencyDisplay": "$10.00",
"totalRefundInPayoutCurrency": 10,
"payment": {
"type": "test",
"cardEnding": "4242"
},
"reason": "Product Not Received",
"note": "Note during the refund of the order(Canceling The Subscription)",
"type": "RETURN",
"original": {
"id": "embMdXyCQZinGxkk2v85GA",
"order": "embMdXyCQZinGxkk2v85GA",
"reference": "SUD160811-1752-43151",
"account": "_sOMzG2pSIyAeWXkcoNgUA",
"currency": "USD",
"payoutCurrency": "USD",
"total": 10,
"totalDisplay": "$10.00",
"totalInPayoutCurrency": 10,
"totalInPayoutCurrencyDisplay": "$10.00",
"tax": 0,
"taxDisplay": "$0.00",
"taxInPayoutCurrency": 0,
"taxInPayoutCurrencyDisplay": "$0.00",
"subtotal": 10,
"subtotalDisplay": "$10.00",
"subtotalInPayoutCurrency": 10,
"subtotalInPayoutCurrencyDisplay": "$10.00",
"notes": [
{
"note": "Before canceling the subscription",
"creator": "admin@yourexamplestore.com"
}
],
"subscriptions": [
"RPN1Bp62Q3mEXloZvxUxmg"
]
},
"customer": {
"first": "Test",
"last": "Order",
"email": "test@tes.com",
"company": "Test",
"phone": "1234567890"
},
"items": [
{
"product": "newtestsuborder",
"quantity": 1,
"display": "newtestsuborder",
"sku": null,
"subtotal": 10,
"subtotalDisplay": "$10.00",
"subtotalInPayoutCurrency": 10,
"subtotalInPayoutCurrencyDisplay": "$10.00",
"subscription": "RPN1Bp62Q3mEXloZvxUxmg"
}
],
"action": "return.get",
"result": "success"
}
]
}
POST
Create a session
{{baseUrl}}/sessions
BODY json
{
"account": "",
"items": [
{
"product": "",
"quantity": 0
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/sessions");
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 \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/sessions" {:content-type :json
:form-params {:account ""
:items [{:product ""
:quantity 0}]}})
require "http/client"
url = "{{baseUrl}}/sessions"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\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}}/sessions"),
Content = new StringContent("{\n \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\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}}/sessions");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/sessions"
payload := strings.NewReader("{\n \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\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/sessions HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 90
{
"account": "",
"items": [
{
"product": "",
"quantity": 0
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/sessions")
.setHeader("content-type", "application/json")
.setBody("{\n \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/sessions"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\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 \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/sessions")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/sessions")
.header("content-type", "application/json")
.body("{\n \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\n }\n ]\n}")
.asString();
const data = JSON.stringify({
account: '',
items: [
{
product: '',
quantity: 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}}/sessions');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/sessions',
headers: {'content-type': 'application/json'},
data: {account: '', items: [{product: '', quantity: 0}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/sessions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"account":"","items":[{"product":"","quantity":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}}/sessions',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "account": "",\n "items": [\n {\n "product": "",\n "quantity": 0\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 \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/sessions")
.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/sessions',
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({account: '', items: [{product: '', quantity: 0}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/sessions',
headers: {'content-type': 'application/json'},
body: {account: '', items: [{product: '', quantity: 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}}/sessions');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
account: '',
items: [
{
product: '',
quantity: 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}}/sessions',
headers: {'content-type': 'application/json'},
data: {account: '', items: [{product: '', quantity: 0}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/sessions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"account":"","items":[{"product":"","quantity":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 = @{ @"account": @"",
@"items": @[ @{ @"product": @"", @"quantity": @0 } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/sessions"]
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}}/sessions" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/sessions",
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([
'account' => '',
'items' => [
[
'product' => '',
'quantity' => 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}}/sessions', [
'body' => '{
"account": "",
"items": [
{
"product": "",
"quantity": 0
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/sessions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'account' => '',
'items' => [
[
'product' => '',
'quantity' => 0
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'account' => '',
'items' => [
[
'product' => '',
'quantity' => 0
]
]
]));
$request->setRequestUrl('{{baseUrl}}/sessions');
$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}}/sessions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"account": "",
"items": [
{
"product": "",
"quantity": 0
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/sessions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"account": "",
"items": [
{
"product": "",
"quantity": 0
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/sessions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/sessions"
payload = {
"account": "",
"items": [
{
"product": "",
"quantity": 0
}
]
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/sessions"
payload <- "{\n \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\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}}/sessions")
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 \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\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/sessions') do |req|
req.body = "{\n \"account\": \"\",\n \"items\": [\n {\n \"product\": \"\",\n \"quantity\": 0\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}}/sessions";
let payload = json!({
"account": "",
"items": (
json!({
"product": "",
"quantity": 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}}/sessions \
--header 'content-type: application/json' \
--data '{
"account": "",
"items": [
{
"product": "",
"quantity": 0
}
]
}'
echo '{
"account": "",
"items": [
{
"product": "",
"quantity": 0
}
]
}' | \
http POST {{baseUrl}}/sessions \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "account": "",\n "items": [\n {\n "product": "",\n "quantity": 0\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/sessions
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"account": "",
"items": [
[
"product": "",
"quantity": 0
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/sessions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"id": "FnE_y0t9R_WF5b2W0DI72Q",
"currency": "USD",
"expires": 1490109872476,
"order": null,
"account": "uKj7izONRfanVwBL9eiG_A",
"subtotal": 9.95,
"items": [
{
"product": "example-product-1",
"quantity": 1
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"message": "Can not parse request body.",
"params": []
}
DELETE
Cancel a subscription
{{baseUrl}}/subscriptions/:subscription_id
QUERY PARAMS
subscription_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/subscriptions/:subscription_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/subscriptions/:subscription_id")
require "http/client"
url = "{{baseUrl}}/subscriptions/:subscription_id"
response = HTTP::Client.delete url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/subscriptions/:subscription_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/subscriptions/:subscription_id");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/subscriptions/:subscription_id"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/subscriptions/:subscription_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/subscriptions/:subscription_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/subscriptions/:subscription_id"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/subscriptions/:subscription_id")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/subscriptions/:subscription_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/subscriptions/:subscription_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/subscriptions/:subscription_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/subscriptions/:subscription_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/subscriptions/:subscription_id',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/subscriptions/:subscription_id")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/subscriptions/:subscription_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/subscriptions/:subscription_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/subscriptions/:subscription_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/subscriptions/:subscription_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/subscriptions/:subscription_id';
const options = {method: 'DELETE'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/subscriptions/:subscription_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/subscriptions/:subscription_id" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/subscriptions/:subscription_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/subscriptions/:subscription_id');
echo $response->getBody();
setUrl('{{baseUrl}}/subscriptions/:subscription_id');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/subscriptions/:subscription_id');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/subscriptions/:subscription_id' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/subscriptions/:subscription_id' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/subscriptions/:subscription_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/subscriptions/:subscription_id"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/subscriptions/:subscription_id"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/subscriptions/:subscription_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/subscriptions/:subscription_id') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/subscriptions/:subscription_id";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/subscriptions/:subscription_id
http DELETE {{baseUrl}}/subscriptions/:subscription_id
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/subscriptions/:subscription_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/subscriptions/:subscription_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscriptions": [
{
"subscription": "id1",
"action": "subscription.cancel",
"result": "success"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": "subscription-id",
"action": "subscription.cancel",
"result": "error",
"error": {
"subscription": "the subscription is already canceled"
}
}
POST
Convert an Expired Trial Subscription without a Payment Method
{{baseUrl}}/subscriptions/:subscription_id/convert
QUERY PARAMS
subscription_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/subscriptions/:subscription_id/convert");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/subscriptions/:subscription_id/convert")
require "http/client"
url = "{{baseUrl}}/subscriptions/:subscription_id/convert"
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}}/subscriptions/:subscription_id/convert"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/subscriptions/:subscription_id/convert");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/subscriptions/:subscription_id/convert"
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/subscriptions/:subscription_id/convert HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/subscriptions/:subscription_id/convert")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/subscriptions/:subscription_id/convert"))
.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}}/subscriptions/:subscription_id/convert")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/subscriptions/:subscription_id/convert")
.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}}/subscriptions/:subscription_id/convert');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/subscriptions/:subscription_id/convert'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/subscriptions/:subscription_id/convert';
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}}/subscriptions/:subscription_id/convert',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/subscriptions/:subscription_id/convert")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/subscriptions/:subscription_id/convert',
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}}/subscriptions/:subscription_id/convert'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/subscriptions/:subscription_id/convert');
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}}/subscriptions/:subscription_id/convert'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/subscriptions/:subscription_id/convert';
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}}/subscriptions/:subscription_id/convert"]
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}}/subscriptions/:subscription_id/convert" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/subscriptions/:subscription_id/convert",
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}}/subscriptions/:subscription_id/convert');
echo $response->getBody();
setUrl('{{baseUrl}}/subscriptions/:subscription_id/convert');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/subscriptions/:subscription_id/convert');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/subscriptions/:subscription_id/convert' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/subscriptions/:subscription_id/convert' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/subscriptions/:subscription_id/convert")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/subscriptions/:subscription_id/convert"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/subscriptions/:subscription_id/convert"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/subscriptions/:subscription_id/convert")
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/subscriptions/:subscription_id/convert') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/subscriptions/:subscription_id/convert";
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}}/subscriptions/:subscription_id/convert
http POST {{baseUrl}}/subscriptions/:subscription_id/convert
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/subscriptions/:subscription_id/convert
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/subscriptions/:subscription_id/convert")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"id": "1665462758431",
"currency": "USD",
"expires": 1665549158235,
"order": null,
"account": "lGySekKpTm6Mrn4J0qH5fg",
"subtotal": 14.99,
"items": [
{
"product": "monthly-magazine",
"quantity": 1
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "subscription.convert",
"result": "error",
"error": {
"subscription.convert": "Unable to find subscription."
}
}
GET
Get a subscription
{{baseUrl}}/subscriptions/:subscription_id
QUERY PARAMS
subscription_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/subscriptions/:subscription_id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/subscriptions/:subscription_id")
require "http/client"
url = "{{baseUrl}}/subscriptions/:subscription_id"
response = HTTP::Client.get url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/subscriptions/:subscription_id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/subscriptions/:subscription_id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/subscriptions/:subscription_id"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/subscriptions/:subscription_id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/subscriptions/:subscription_id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/subscriptions/:subscription_id"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/subscriptions/:subscription_id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/subscriptions/:subscription_id")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/subscriptions/:subscription_id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/subscriptions/:subscription_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/subscriptions/:subscription_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/subscriptions/:subscription_id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/subscriptions/:subscription_id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/subscriptions/:subscription_id',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/subscriptions/:subscription_id'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/subscriptions/:subscription_id');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/subscriptions/:subscription_id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/subscriptions/:subscription_id';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/subscriptions/:subscription_id"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/subscriptions/:subscription_id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/subscriptions/:subscription_id",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/subscriptions/:subscription_id');
echo $response->getBody();
setUrl('{{baseUrl}}/subscriptions/:subscription_id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/subscriptions/:subscription_id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/subscriptions/:subscription_id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/subscriptions/:subscription_id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/subscriptions/:subscription_id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/subscriptions/:subscription_id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/subscriptions/:subscription_id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/subscriptions/:subscription_id")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/subscriptions/:subscription_id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/subscriptions/:subscription_id";
let client = reqwest::Client::new();
let response = client.get(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/subscriptions/:subscription_id
http GET {{baseUrl}}/subscriptions/:subscription_id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/subscriptions/:subscription_id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/subscriptions/:subscription_id")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"id": "AmYzjmPbSbWYkESv7MnwwA",
"subscription": "AmYzjmPbSbWYkESv7MnwwA",
"active": true,
"state": "trial",
"isSubscriptionEligibleForPauseByBuyer": false,
"isPauseScheduled": true,
"changed": 1573257599032,
"changedValue": 1573257599032,
"changedInSeconds": 1573257599,
"changedDisplay": "11/8/19",
"live": false,
"declineReason": "Invalid Card number",
"paymentMethod": "CREDIT_CARD",
"expiry": "12/25",
"cardEnding": 1234,
"cardType": "VISA",
"currency": "USD",
"account": "N8FjcSWcQNeYCc-suM1O8g",
"product": "example-monthly-subscription",
"sku": "skusub1",
"display": "Example Monthly Subscription",
"quantity": 1,
"adhoc": false,
"autoRenew": true,
"price": 14.95,
"priceDisplay": "$14.95",
"priceInPayoutCurrency": 14.95,
"priceInPayoutCurrencyDisplay": "$14.95",
"discount": 3.74,
"discountDisplay": "$3.74",
"discountInPayoutCurrency": 3.74,
"discountInPayoutCurrencyDisplay": "$3.74",
"subtotal": 16.21,
"subtotalDisplay": "$16.21",
"subtotalInPayoutCurrency": 16.21,
"subtotalInPayoutCurrencyDisplay": "$16.21",
"attributes": {
"Furious": "Falcon",
"CustomAttribute2": "CustomValue2",
"CustomAttribute1": "CustomValue1"
},
"discountDuration": 1,
"next": 1574380800000,
"nextInSeconds": 1574380800,
"nextDisplay": "11/22/19",
"end": null,
"endValue": null,
"endInSeconds": null,
"endDisplay": null,
"canceledDate": null,
"canceledDateValue": null,
"canceledDateInSeconds": null,
"canceledDateDisplay": null,
"deactivationDate": null,
"deactivationDateValue": null,
"deactivationDateInSeconds": null,
"deactivationDateDisplay": null,
"sequence": 1,
"periods": null,
"remainingPeriods": null,
"begin": 1573171200000,
"beginValue": 1573171200000,
"beginInSeconds": 1573171200,
"beginDisplay": "11/8/19",
"intervalUnit": "month",
"intervalLength": 1,
"nextChargeCurrency": "USD",
"nextChargeDate": 1574380800000,
"nextChargeDateValue": 1574380800000,
"nextChargeDateInSeconds": 1574380800,
"nextChargeDateDisplay": "11/22/19",
"nextChargePreTax": 16.21,
"nextChargePreTaxDisplay": "$16.21",
"nextChargePreTaxInPayoutCurrency": 16.21,
"nextChargePreTaxInPayoutCurrencyDisplay": "$16.21",
"nextChargeTotal": 16.21,
"nextChargeTotalDisplay": "$16.21",
"nextChargeTotalInPayoutCurrency": 16.21,
"nextChargeTotalInPayoutCurrencyDisplay": "$16.21",
"nextNotificationType": "PAYMENT_REMINDER",
"nextNotificationDate": 1574294400000,
"nextNotificationDateValue": 1574294400000,
"nextNotificationDateInSeconds": 1574294400,
"nextNotificationDateDisplay": "11/21/19",
"trialReminder": {
"intervalUnit": "day",
"intervalLength": 3
},
"paymentReminder": {
"intervalUnit": "day",
"intervalLength": 1
},
"paymentOverdue": {
"intervalUnit": "week",
"intervalLength": 2,
"total": 1,
"sent": 0
},
"cancellationSetting": {
"cancellation": "AFTER_LAST_NOTIFICATION",
"intervalUnit": "week",
"intervalLength": 1
},
"addons": [
{
"product": "example-product-3",
"sku": "skuex3",
"display": "Example Product 3",
"quantity": 1,
"price": 5,
"priceDisplay": "$5.00",
"priceInPayoutCurrency": 5,
"priceInPayoutCurrencyDisplay": "$5.00",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"subtotal": 5,
"subtotalDisplay": "$5.00",
"subtotalInPayoutCurrency": 5,
"subtotalInPayoutCurrencyDisplay": "$5.00",
"discounts": []
}
],
"discounts": [
{
"discountPath": "example-monthly-subscription",
"discountDuration": 1,
"percentValue": 25
}
],
"setupFee": {
"price": {
"USD": 9.95
},
"title": {
"en": "One-time Setup Fee"
}
},
"instructions": [
{
"type": "trial",
"periodStartDate": 1573171200000,
"periodStartDateValue": 1573171200000,
"periodStartDateInSeconds": 1573171200,
"periodStartDateDisplay": "11/8/19",
"periodEndDate": 1574294400000,
"periodEndDateValue": 1574294400000,
"periodEndDateInSeconds": 1574294400,
"periodEndDateDisplay": "11/21/19",
"discountDurationUnit": "day",
"discountDurationLength": 14,
"discountPercent": 100,
"discountPercentValue": 100,
"discountPercentDisplay": "100%",
"unitDiscount": 14.95,
"unitDiscountDisplay": "$14.95",
"unitDiscountInPayoutCurrency": 14.95,
"unitDiscountInPayoutCurrencyDisplay": "$14.95",
"discountTotal": 14.95,
"discountTotalDisplay": "$14.95",
"discountTotalInPayoutCurrency": 14.95,
"discountTotalInPayoutCurrencyDisplay": "$14.95",
"total": 0,
"totalDisplay": "$0.00",
"totalInPayoutCurrency": 0,
"totalInPayoutCurrencyDisplay": "$0.00",
"price": 14.95,
"priceDisplay": "$14.95",
"priceInPayoutCurrency": 14.95,
"priceInPayoutCurrencyDisplay": "$14.95",
"priceTotal": 14.95,
"priceTotalDisplay": "$14.95",
"priceTotalInPayoutCurrency": 14.95,
"priceTotalInPayoutCurrencyDisplay": "$14.95",
"unitPrice": 0,
"unitPriceDisplay": "$0.00",
"unitPriceInPayoutCurrency": 0,
"unitPriceInPayoutCurrencyDisplay": "$0.00"
},
{
"product": "example-monthly-subscription",
"type": "discounted",
"periodStartDate": 1574380800000,
"periodStartDateValue": 1574380800000,
"periodStartDateInSeconds": 1574380800,
"periodStartDateDisplay": "11/22/19",
"periodEndDate": 1576886400000,
"periodEndDateValue": 1576886400000,
"periodEndDateInSeconds": 1576886400,
"periodEndDateDisplay": "12/21/19",
"discountIntervalUnit": "month",
"discountIntervalLength": 1,
"discountDuration": 1,
"discountDurationUnit": "month",
"discountDurationLength": 1,
"unitDiscount": 3.74,
"unitDiscountDisplay": "$3.74",
"unitDiscountInPayoutCurrency": 3.74,
"unitDiscountInPayoutCurrencyDisplay": "$3.74",
"discountPercent": 25,
"discountPercentValue": 25,
"discountPercentDisplay": "25%",
"discountTotal": 3.74,
"discountTotalDisplay": "$3.74",
"discountTotalInPayoutCurrency": 3.74,
"discountTotalInPayoutCurrencyDisplay": "$3.74",
"price": 14.95,
"priceDisplay": "$14.95",
"priceInPayoutCurrency": 14.95,
"priceInPayoutCurrencyDisplay": "$14.95",
"priceTotal": 14.95,
"priceTotalDisplay": "$14.95",
"priceTotalInPayoutCurrency": 14.95,
"priceTotalInPayoutCurrencyDisplay": "$14.95",
"unitPrice": 11.21,
"unitPriceDisplay": "$11.21",
"unitPriceInPayoutCurrency": 11.21,
"unitPriceInPayoutCurrencyDisplay": "$11.21",
"total": 11.21,
"totalDisplay": "$11.21",
"totalInPayoutCurrency": 11.21,
"totalInPayoutCurrencyDisplay": "$11.21"
},
{
"product": "example-monthly-subscription",
"type": "regular",
"periodStartDate": 1576972800000,
"periodStartDateValue": 1576972800000,
"periodStartDateInSeconds": 1576972800,
"periodStartDateDisplay": "12/22/19",
"periodEndDate": null,
"periodEndDateValue": null,
"periodEndDateInSeconds": null,
"periodEndDateDisplay": null,
"intervalUnit": "month",
"intervalLength": 1,
"discountPercent": 0,
"discountPercentValue": 0,
"discountPercentDisplay": "0%",
"discountTotal": 0,
"discountTotalDisplay": "$0.00",
"discountTotalInPayoutCurrency": 0,
"discountTotalInPayoutCurrencyDisplay": "$0.00",
"unitDiscount": 0,
"unitDiscountDisplay": "$0.00",
"unitDiscountInPayoutCurrency": 0,
"unitDiscountInPayoutCurrencyDisplay": "$0.00",
"price": 14.95,
"priceDisplay": "$14.95",
"priceInPayoutCurrency": 14.95,
"priceInPayoutCurrencyDisplay": "$14.95",
"priceTotal": 14.95,
"priceTotalDisplay": "$14.95",
"priceTotalInPayoutCurrency": 14.95,
"priceTotalInPayoutCurrencyDisplay": "$14.95",
"unitPrice": 14.95,
"unitPriceDisplay": "$14.95",
"unitPriceInPayoutCurrency": 14.95,
"unitPriceInPayoutCurrencyDisplay": "$14.95",
"total": 14.95,
"totalDisplay": "$14.95",
"totalInPayoutCurrency": 14.95,
"totalInPayoutCurrencyDisplay": "$14.95"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": "subscription-id",
"action": "subscription.get",
"result": "error",
"error": {
"subscription": "Subscription not found"
}
}
GET
Get all subscriptions
{{baseUrl}}/subscriptions
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/subscriptions");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/subscriptions")
require "http/client"
url = "{{baseUrl}}/subscriptions"
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}}/subscriptions"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/subscriptions");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/subscriptions"
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/subscriptions HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/subscriptions")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/subscriptions"))
.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}}/subscriptions")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/subscriptions")
.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}}/subscriptions');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/subscriptions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/subscriptions';
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}}/subscriptions',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/subscriptions")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/subscriptions',
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}}/subscriptions'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/subscriptions');
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}}/subscriptions'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/subscriptions';
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}}/subscriptions"]
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}}/subscriptions" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/subscriptions",
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}}/subscriptions');
echo $response->getBody();
setUrl('{{baseUrl}}/subscriptions');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/subscriptions');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/subscriptions' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/subscriptions' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/subscriptions")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/subscriptions"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/subscriptions"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/subscriptions")
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/subscriptions') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/subscriptions";
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}}/subscriptions
http GET {{baseUrl}}/subscriptions
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/subscriptions
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/subscriptions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "subscription.getall",
"result": "success",
"nextPage": 3,
"subscriptions": [
"khyNPLY3TYiQhBfHyjZINg",
"w46bQ2-gTayzJfFXbV1VWg",
"86cFjtgCRlSmOPbLcX_mCA",
"v0yPCSTLSyarVe9NlNalSA",
"FWhWZ3b6StyfiJ_GnyHswQ",
"A5xx9TF_R26PcCMdagAC8Q",
"pgNumDwTSbaLeNY6FtUF3Q",
"IK2eD1nvSP-L3yilE6K7BQ",
"iZ8qUO-MSwuezTn_elPb3g",
"gLspcP3NRqmdOm615HSTig",
"HYKxh1JfTcyUhTgJxAxfWg",
"1RkJixj_QKOg_c7G_wGIZA",
"LiPzVuKnT2Go1WWteQkZtw",
"V5wXtLilSsWGkMYSiLVy2g",
"MseNZ_LBRu63R84k9knIKg"
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": "subscription-id",
"action": "subscription.get",
"result": "error",
"error": {
"subscription": "Subscription not found"
}
}
GET
Get subscription entries
{{baseUrl}}/subscriptions/:subscription_id/entries
QUERY PARAMS
subscription_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/subscriptions/:subscription_id/entries");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/subscriptions/:subscription_id/entries")
require "http/client"
url = "{{baseUrl}}/subscriptions/:subscription_id/entries"
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}}/subscriptions/:subscription_id/entries"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/subscriptions/:subscription_id/entries");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/subscriptions/:subscription_id/entries"
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/subscriptions/:subscription_id/entries HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/subscriptions/:subscription_id/entries")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/subscriptions/:subscription_id/entries"))
.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}}/subscriptions/:subscription_id/entries")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/subscriptions/:subscription_id/entries")
.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}}/subscriptions/:subscription_id/entries');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/subscriptions/:subscription_id/entries'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/subscriptions/:subscription_id/entries';
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}}/subscriptions/:subscription_id/entries',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/subscriptions/:subscription_id/entries")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/subscriptions/:subscription_id/entries',
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}}/subscriptions/:subscription_id/entries'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/subscriptions/:subscription_id/entries');
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}}/subscriptions/:subscription_id/entries'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/subscriptions/:subscription_id/entries';
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}}/subscriptions/:subscription_id/entries"]
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}}/subscriptions/:subscription_id/entries" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/subscriptions/:subscription_id/entries",
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}}/subscriptions/:subscription_id/entries');
echo $response->getBody();
setUrl('{{baseUrl}}/subscriptions/:subscription_id/entries');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/subscriptions/:subscription_id/entries');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/subscriptions/:subscription_id/entries' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/subscriptions/:subscription_id/entries' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/subscriptions/:subscription_id/entries")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/subscriptions/:subscription_id/entries"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/subscriptions/:subscription_id/entries"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/subscriptions/:subscription_id/entries")
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/subscriptions/:subscription_id/entries') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/subscriptions/:subscription_id/entries";
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}}/subscriptions/:subscription_id/entries
http GET {{baseUrl}}/subscriptions/:subscription_id/entries
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/subscriptions/:subscription_id/entries
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/subscriptions/:subscription_id/entries")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": "subscription-id",
"action": "subscription.get",
"result": "error",
"error": {
"subscription": "Subscription not found"
}
}
GET
Get subscription plan change history
{{baseUrl}}/subscriptions/:subscription_id/history
QUERY PARAMS
subscription_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/subscriptions/:subscription_id/history");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/subscriptions/:subscription_id/history")
require "http/client"
url = "{{baseUrl}}/subscriptions/:subscription_id/history"
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}}/subscriptions/:subscription_id/history"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/subscriptions/:subscription_id/history");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/subscriptions/:subscription_id/history"
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/subscriptions/:subscription_id/history HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/subscriptions/:subscription_id/history")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/subscriptions/:subscription_id/history"))
.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}}/subscriptions/:subscription_id/history")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/subscriptions/:subscription_id/history")
.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}}/subscriptions/:subscription_id/history');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/subscriptions/:subscription_id/history'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/subscriptions/:subscription_id/history';
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}}/subscriptions/:subscription_id/history',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/subscriptions/:subscription_id/history")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/subscriptions/:subscription_id/history',
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}}/subscriptions/:subscription_id/history'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/subscriptions/:subscription_id/history');
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}}/subscriptions/:subscription_id/history'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/subscriptions/:subscription_id/history';
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}}/subscriptions/:subscription_id/history"]
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}}/subscriptions/:subscription_id/history" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/subscriptions/:subscription_id/history",
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}}/subscriptions/:subscription_id/history');
echo $response->getBody();
setUrl('{{baseUrl}}/subscriptions/:subscription_id/history');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/subscriptions/:subscription_id/history');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/subscriptions/:subscription_id/history' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/subscriptions/:subscription_id/history' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/subscriptions/:subscription_id/history")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/subscriptions/:subscription_id/history"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/subscriptions/:subscription_id/history"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/subscriptions/:subscription_id/history")
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/subscriptions/:subscription_id/history') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/subscriptions/:subscription_id/history";
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}}/subscriptions/:subscription_id/history
http GET {{baseUrl}}/subscriptions/:subscription_id/history
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/subscriptions/:subscription_id/history
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/subscriptions/:subscription_id/history")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": "subscription-id",
"action": "subscription.get",
"result": "error",
"error": {
"subscription": "Subscription not found"
}
}
POST
Pause a subscription
{{baseUrl}}/subscriptions/:subscription_id/pause
QUERY PARAMS
subscription_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/subscriptions/:subscription_id/pause");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/subscriptions/:subscription_id/pause")
require "http/client"
url = "{{baseUrl}}/subscriptions/:subscription_id/pause"
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}}/subscriptions/:subscription_id/pause"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/subscriptions/:subscription_id/pause");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/subscriptions/:subscription_id/pause"
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/subscriptions/:subscription_id/pause HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/subscriptions/:subscription_id/pause")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/subscriptions/:subscription_id/pause"))
.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}}/subscriptions/:subscription_id/pause")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/subscriptions/:subscription_id/pause")
.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}}/subscriptions/:subscription_id/pause');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/subscriptions/:subscription_id/pause'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/subscriptions/:subscription_id/pause';
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}}/subscriptions/:subscription_id/pause',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/subscriptions/:subscription_id/pause")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/subscriptions/:subscription_id/pause',
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}}/subscriptions/:subscription_id/pause'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/subscriptions/:subscription_id/pause');
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}}/subscriptions/:subscription_id/pause'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/subscriptions/:subscription_id/pause';
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}}/subscriptions/:subscription_id/pause"]
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}}/subscriptions/:subscription_id/pause" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/subscriptions/:subscription_id/pause",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/subscriptions/:subscription_id/pause');
echo $response->getBody();
setUrl('{{baseUrl}}/subscriptions/:subscription_id/pause');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/subscriptions/:subscription_id/pause');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/subscriptions/:subscription_id/pause' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/subscriptions/:subscription_id/pause' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = ""
conn.request("POST", "/baseUrl/subscriptions/:subscription_id/pause", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/subscriptions/:subscription_id/pause"
payload = ""
response = requests.post(url, data=payload)
print(response.json())
library(httr)
url <- "{{baseUrl}}/subscriptions/:subscription_id/pause"
payload <- ""
response <- VERB("POST", url, body = payload, content_type(""))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/subscriptions/:subscription_id/pause")
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/subscriptions/:subscription_id/pause') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/subscriptions/:subscription_id/pause";
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}}/subscriptions/:subscription_id/pause
http POST {{baseUrl}}/subscriptions/:subscription_id/pause
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/subscriptions/:subscription_id/pause
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/subscriptions/:subscription_id/pause")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"id": "fPNQtjeSTOW0-tfaiyW6cA",
"quote": null,
"subscription": "fPNQtjeSTOW0-tfaiyW6cA",
"active": true,
"state": "active",
"isSubscriptionEligibleForPauseByBuyer": false,
"isPauseScheduled": true,
"changed": 1659631759255,
"changedValue": 1659631759255,
"changedInSeconds": 1659631759,
"changedDisplay": "8/4/22",
"changedDisplayISO8601": "2022-08-04",
"live": false,
"currency": "USD",
"account": "auqeDztxSrG_brzKUlZGng",
"product": "monthly-prodsub-digauto",
"sku": null,
"display": "Monthly prodSub DigAuto",
"quantity": 1,
"adhoc": false,
"autoRenew": true,
"price": 100,
"priceDisplay": "$100.00",
"priceInPayoutCurrency": 100,
"priceInPayoutCurrencyDisplay": "$100.00",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"subtotal": 100,
"subtotalDisplay": "$100.00",
"subtotalInPayoutCurrency": 100,
"subtotalInPayoutCurrencyDisplay": "$100.00",
"next": 1672790400000,
"nextValue": 1672790400000,
"nextInSeconds": 1672790400,
"nextDisplay": "1/4/23",
"nextDisplayISO8601": "2023-01-04",
"end": null,
"endValue": null,
"endInSeconds": null,
"endDisplay": null,
"endDisplayISO8601": null,
"canceledDate": null,
"canceledDateValue": null,
"canceledDateInSeconds": null,
"canceledDateDisplay": null,
"canceledDateDisplayISO8601": null,
"deactivationDate": null,
"deactivationDateValue": null,
"deactivationDateInSeconds": null,
"deactivationDateDisplay": null,
"deactivationDateDisplayISO8601": null,
"sequence": 1,
"periods": null,
"remainingPeriods": null,
"begin": 1659571200000,
"beginValue": 1659571200000,
"beginInSeconds": 1659571200,
"beginDisplay": "8/4/22",
"beginDisplayISO8601": "2022-08-04",
"intervalUnit": "month",
"intervalLength": 1,
"nextChargeCurrency": "USD",
"nextChargeDate": 1672790400000,
"nextChargeDateValue": 1672790400000,
"nextChargeDateInSeconds": 1672790400,
"nextChargeDateDisplay": "1/4/23",
"nextChargeDateDisplayISO8601": "2023-01-04",
"nextChargePreTax": 100,
"nextChargePreTaxDisplay": "$100.00",
"nextChargePreTaxInPayoutCurrency": 100,
"nextChargePreTaxInPayoutCurrencyDisplay": "$100.00",
"nextChargeTotal": 100,
"nextChargeTotalDisplay": "$100.00",
"nextChargeTotalInPayoutCurrency": 100,
"nextChargeTotalInPayoutCurrencyDisplay": "$100.00",
"paymentOverdue": {
"intervalUnit": "week",
"intervalLength": 1,
"total": 4,
"sent": 0
},
"cancellationSetting": {
"cancellation": "AFTER_LAST_NOTIFICATION",
"intervalUnit": "week",
"intervalLength": 1
},
"pauseDate": 1667520000000,
"pauseDateValue": 1667520000000,
"pauseDateInSeconds": 1667520000,
"pauseDateDisplay": "11/4/22",
"pauseDateDisplayISO8601": "2022-11-04",
"resumeDate": 1672790400000,
"resumeDateValue": 1672790400000,
"resumeDateInSeconds": 1672790400,
"resumeDateDisplay": "1/4/23",
"resumeDateDisplayISO8601": "2023-01-04",
"fulfillments": {},
"instructions": [
{
"product": "monthly-prodsub-digauto",
"type": "regular",
"periodStartDate": null,
"periodStartDateValue": null,
"periodStartDateInSeconds": null,
"periodStartDateDisplay": null,
"periodStartDateDisplayISO8601": null,
"periodEndDate": null,
"periodEndDateValue": null,
"periodEndDateInSeconds": null,
"periodEndDateDisplay": null,
"periodEndDateDisplayISO8601": null,
"intervalUnit": "month",
"intervalLength": 1,
"discountPercent": 0,
"discountPercentValue": 0,
"discountPercentDisplay": "0%",
"discountTotal": 0,
"discountTotalDisplay": "$0.00",
"discountTotalInPayoutCurrency": 0,
"discountTotalInPayoutCurrencyDisplay": "$0.00",
"unitDiscount": 0,
"unitDiscountDisplay": "$0.00",
"unitDiscountInPayoutCurrency": 0,
"unitDiscountInPayoutCurrencyDisplay": "$0.00",
"price": 100,
"priceDisplay": "$100.00",
"priceInPayoutCurrency": 100,
"priceInPayoutCurrencyDisplay": "$100.00",
"priceTotal": 100,
"priceTotalDisplay": "$100.00",
"priceTotalInPayoutCurrency": 100,
"priceTotalInPayoutCurrencyDisplay": "$100.00",
"unitPrice": 100,
"unitPriceDisplay": "$100.00",
"unitPriceInPayoutCurrency": 100,
"unitPriceInPayoutCurrencyDisplay": "$100.00",
"total": 100,
"totalDisplay": "$100.00",
"totalInPayoutCurrency": 100,
"totalInPayoutCurrencyDisplay": "$100.00"
}
],
"initialOrderId": "fEMc5woCSlWSwpL3u9-B9A",
"initialOrderReference": "KEV220804-8637-55123",
"action": "subscriptions.pause.get",
"result": "success"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "subscriptions.pause",
"result": "error",
"error": {
"subscription.pause": "Invalid number of Periods."
}
}
POST
Preview a proposed prorated plan change
{{baseUrl}}/subscriptions/estimate
BODY json
{
"subscription": "",
"product": "",
"quantity": 0,
"pricing": {
"USD": "",
"EUR": ""
},
"addons": [
{
"product": "",
"quantity": 0,
"pricing": {}
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/subscriptions/estimate");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/subscriptions/estimate" {:content-type :json
:form-params {:subscription ""
:product ""
:quantity 0
:pricing {:USD ""
:EUR ""}
:addons [{:product ""
:quantity 0
:pricing {}}]}})
require "http/client"
url = "{{baseUrl}}/subscriptions/estimate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\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}}/subscriptions/estimate"),
Content = new StringContent("{\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\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}}/subscriptions/estimate");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/subscriptions/estimate"
payload := strings.NewReader("{\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\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/subscriptions/estimate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 200
{
"subscription": "",
"product": "",
"quantity": 0,
"pricing": {
"USD": "",
"EUR": ""
},
"addons": [
{
"product": "",
"quantity": 0,
"pricing": {}
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/subscriptions/estimate")
.setHeader("content-type", "application/json")
.setBody("{\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/subscriptions/estimate"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\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 \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/subscriptions/estimate")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/subscriptions/estimate")
.header("content-type", "application/json")
.body("{\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\n }\n ]\n}")
.asString();
const data = JSON.stringify({
subscription: '',
product: '',
quantity: 0,
pricing: {
USD: '',
EUR: ''
},
addons: [
{
product: '',
quantity: 0,
pricing: {}
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/subscriptions/estimate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/subscriptions/estimate',
headers: {'content-type': 'application/json'},
data: {
subscription: '',
product: '',
quantity: 0,
pricing: {USD: '', EUR: ''},
addons: [{product: '', quantity: 0, pricing: {}}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/subscriptions/estimate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"subscription":"","product":"","quantity":0,"pricing":{"USD":"","EUR":""},"addons":[{"product":"","quantity":0,"pricing":{}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/subscriptions/estimate',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "subscription": "",\n "product": "",\n "quantity": 0,\n "pricing": {\n "USD": "",\n "EUR": ""\n },\n "addons": [\n {\n "product": "",\n "quantity": 0,\n "pricing": {}\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 \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/subscriptions/estimate")
.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/subscriptions/estimate',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
subscription: '',
product: '',
quantity: 0,
pricing: {USD: '', EUR: ''},
addons: [{product: '', quantity: 0, pricing: {}}]
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/subscriptions/estimate',
headers: {'content-type': 'application/json'},
body: {
subscription: '',
product: '',
quantity: 0,
pricing: {USD: '', EUR: ''},
addons: [{product: '', quantity: 0, pricing: {}}]
},
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}}/subscriptions/estimate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
subscription: '',
product: '',
quantity: 0,
pricing: {
USD: '',
EUR: ''
},
addons: [
{
product: '',
quantity: 0,
pricing: {}
}
]
});
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}}/subscriptions/estimate',
headers: {'content-type': 'application/json'},
data: {
subscription: '',
product: '',
quantity: 0,
pricing: {USD: '', EUR: ''},
addons: [{product: '', quantity: 0, pricing: {}}]
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/subscriptions/estimate';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"subscription":"","product":"","quantity":0,"pricing":{"USD":"","EUR":""},"addons":[{"product":"","quantity":0,"pricing":{}}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"subscription": @"",
@"product": @"",
@"quantity": @0,
@"pricing": @{ @"USD": @"", @"EUR": @"" },
@"addons": @[ @{ @"product": @"", @"quantity": @0, @"pricing": @{ } } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/subscriptions/estimate"]
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}}/subscriptions/estimate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/subscriptions/estimate",
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([
'subscription' => '',
'product' => '',
'quantity' => 0,
'pricing' => [
'USD' => '',
'EUR' => ''
],
'addons' => [
[
'product' => '',
'quantity' => 0,
'pricing' => [
]
]
]
]),
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}}/subscriptions/estimate', [
'body' => '{
"subscription": "",
"product": "",
"quantity": 0,
"pricing": {
"USD": "",
"EUR": ""
},
"addons": [
{
"product": "",
"quantity": 0,
"pricing": {}
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/subscriptions/estimate');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'subscription' => '',
'product' => '',
'quantity' => 0,
'pricing' => [
'USD' => '',
'EUR' => ''
],
'addons' => [
[
'product' => '',
'quantity' => 0,
'pricing' => [
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'subscription' => '',
'product' => '',
'quantity' => 0,
'pricing' => [
'USD' => '',
'EUR' => ''
],
'addons' => [
[
'product' => '',
'quantity' => 0,
'pricing' => [
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/subscriptions/estimate');
$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}}/subscriptions/estimate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"subscription": "",
"product": "",
"quantity": 0,
"pricing": {
"USD": "",
"EUR": ""
},
"addons": [
{
"product": "",
"quantity": 0,
"pricing": {}
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/subscriptions/estimate' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"subscription": "",
"product": "",
"quantity": 0,
"pricing": {
"USD": "",
"EUR": ""
},
"addons": [
{
"product": "",
"quantity": 0,
"pricing": {}
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/subscriptions/estimate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/subscriptions/estimate"
payload = {
"subscription": "",
"product": "",
"quantity": 0,
"pricing": {
"USD": "",
"EUR": ""
},
"addons": [
{
"product": "",
"quantity": 0,
"pricing": {}
}
]
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/subscriptions/estimate"
payload <- "{\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\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}}/subscriptions/estimate")
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 \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\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/subscriptions/estimate') do |req|
req.body = "{\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {\n \"USD\": \"\",\n \"EUR\": \"\"\n },\n \"addons\": [\n {\n \"product\": \"\",\n \"quantity\": 0,\n \"pricing\": {}\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}}/subscriptions/estimate";
let payload = json!({
"subscription": "",
"product": "",
"quantity": 0,
"pricing": json!({
"USD": "",
"EUR": ""
}),
"addons": (
json!({
"product": "",
"quantity": 0,
"pricing": 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}}/subscriptions/estimate \
--header 'content-type: application/json' \
--data '{
"subscription": "",
"product": "",
"quantity": 0,
"pricing": {
"USD": "",
"EUR": ""
},
"addons": [
{
"product": "",
"quantity": 0,
"pricing": {}
}
]
}'
echo '{
"subscription": "",
"product": "",
"quantity": 0,
"pricing": {
"USD": "",
"EUR": ""
},
"addons": [
{
"product": "",
"quantity": 0,
"pricing": {}
}
]
}' | \
http POST {{baseUrl}}/subscriptions/estimate \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "subscription": "",\n "product": "",\n "quantity": 0,\n "pricing": {\n "USD": "",\n "EUR": ""\n },\n "addons": [\n {\n "product": "",\n "quantity": 0,\n "pricing": {}\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/subscriptions/estimate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"subscription": "",
"product": "",
"quantity": 0,
"pricing": [
"USD": "",
"EUR": ""
],
"addons": [
[
"product": "",
"quantity": 0,
"pricing": []
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/subscriptions/estimate")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": "mG7NGFRMQXSz0ud-Ybp7gA",
"currency": "USD",
"timezone": "UTC",
"periodStartDate": 1679961600000,
"periodStartDateDisplay": "3/28/23",
"periodStartDateDisplayISO8601": "2023-03-28",
"periodEndDate": 1682553600000,
"periodEndDateDisplay": "4/27/23",
"periodEndDateDisplayISO8601": "2023-04-27",
"currentPlan": {
"display": "Basic",
"product": "basic",
"billingFrequency": "1 month",
"price": 200,
"priceDisplay": "$200.00",
"discount": 0,
"discountDisplay": "$0.00",
"quantity": 1,
"subtotal": 200,
"subtotalDisplay": "$200.00",
"tax": 0,
"taxDisplay": "$0.00",
"total": 200,
"totalDisplay": "$200.00",
"taxPercent": 7.75,
"taxPercentDisplay": "7.75%",
"periodStartDate": 1679961600000,
"periodStartDateDisplay": "3/28/23",
"periodStartDateDisplayISO8601": "2023-03-28",
"periodEndDate": 1679961600000,
"periodEndDateDisplay": "3/28/23",
"periodEndDateDisplayISO8601": "2023-03-28",
"proratedItemCharge": 300,
"proratedItemChargeDisplay": "$300.00",
"proratedItemCredit": 200,
"proratedItemCreditDisplay": "$200.00",
"proratedItemSubtotalDisplay": "$100.00",
"proratedItemTax": 0,
"proratedItemTaxDisplay": "$0.00",
"proratedItemTotal": 100,
"proratedItemTotalDisplay": "$100.00",
"addons": [],
"subscriptionSubtotal": 200,
"subscriptionSubtotalDisplay": "$200.00",
"subscriptionTax": 0,
"subscriptionTaxDisplay": "$0.00",
"subscriptionTotal": 200,
"subscriptionTotalDisplay": "$200.00",
"subscriptionProratedCredit": 200,
"subscriptionProratedCreditDisplay": "$200.00"
},
"proposedPlan": {
"display": "Premium",
"product": "premium",
"billingFrequency": "1 month",
"price": 300,
"priceDisplay": "$300.00",
"discount": 0,
"discountDisplay": "$0.00",
"quantity": 1,
"subtotal": 300,
"subtotalDisplay": "$300.00",
"tax": 0,
"taxDisplay": "$0.00",
"total": 300,
"totalDisplay": "$300.00",
"taxPercent": 7.75,
"taxPercentDisplay": "7.75%",
"periodStartDate": 1679961600000,
"periodStartDateDisplay": "3/28/23",
"periodStartDateDisplayISO8601": "2023-03-28",
"periodEndDate": 1682553600000,
"periodEndDateDisplay": "4/27/23",
"periodEndDateDisplayISO8601": "2023-04-27",
"proratedItemCharge": 300,
"proratedItemChargeDisplay": "$300.00",
"proratedItemCredit": 200,
"proratedItemCreditDisplay": "$200.00",
"proratedItemSubtotal": 100,
"proratedItemSubtotalDisplay": "$100.00",
"proratedItemTax": 0,
"proratedItemTaxDisplay": "$0.00",
"proratedItemTotal": 100,
"proratedItemTotalDisplay": "$100.00",
"addons": [],
"subscriptionSubtotal": 300,
"subscriptionSubtotalDisplay": "$300.00",
"subscriptionTax": 0,
"subscriptionTaxDisplay": "$0.00",
"subscriptionTotal": 300,
"subscriptionTotalDisplay": "$300.00",
"subscriptionProratedCharge": 300,
"subscriptionProratedChargeDisplay": "$300.00"
},
"amountDue": {
"prorationSubtotal": 100,
"prorationSubtotalDisplay": "$100.00",
"prorationTax": 0,
"prorationTaxDisplay": "$0.00",
"totalAmountDue": 100,
"totalAmountDueDisplay": "$100.00",
"nextChargeDate": 1682640000000,
"nextChargeDateDisplay": "4/28/23",
"nextChargeDateDisplayISO8601": "2023-04-28",
"nextChargeAmount": 300,
"nextChargeAmountDisplay": "$300.00"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "subscriptions.estimate.update",
"subscription": "VtKCOlk-SzSM_Zw2H5ntWw",
"result": "error",
"error": {
"subscription": "Subscription is not changeable."
}
}
POST
Rebill a managed subscription
{{baseUrl}}/subscriptions/charge
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/subscriptions/charge");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/subscriptions/charge")
require "http/client"
url = "{{baseUrl}}/subscriptions/charge"
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}}/subscriptions/charge"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/subscriptions/charge");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/subscriptions/charge"
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/subscriptions/charge HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/subscriptions/charge")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/subscriptions/charge"))
.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}}/subscriptions/charge")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/subscriptions/charge")
.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}}/subscriptions/charge');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/subscriptions/charge'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/subscriptions/charge';
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}}/subscriptions/charge',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/subscriptions/charge")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/subscriptions/charge',
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}}/subscriptions/charge'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/subscriptions/charge');
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}}/subscriptions/charge'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/subscriptions/charge';
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}}/subscriptions/charge"]
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}}/subscriptions/charge" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/subscriptions/charge",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/subscriptions/charge');
echo $response->getBody();
setUrl('{{baseUrl}}/subscriptions/charge');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/subscriptions/charge');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/subscriptions/charge' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/subscriptions/charge' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = ""
conn.request("POST", "/baseUrl/subscriptions/charge", payload)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/subscriptions/charge"
payload = ""
response = requests.post(url, data=payload)
print(response.json())
library(httr)
url <- "{{baseUrl}}/subscriptions/charge"
payload <- ""
response <- VERB("POST", url, body = payload, content_type(""))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/subscriptions/charge")
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/subscriptions/charge') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/subscriptions/charge";
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}}/subscriptions/charge
http POST {{baseUrl}}/subscriptions/charge
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/subscriptions/charge
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/subscriptions/charge")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": [
{
"subscription": "subscription-id-1",
"action": "subscription.charge",
"result": "success"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": "subscription-id",
"action": "subscription.charge",
"result": "error",
"error": {
"subscription": "EXPIRED_CARD"
}
}
POST
Remove a scheduled pause
{{baseUrl}}/subscriptions/:subscription_id/resume
QUERY PARAMS
subscription_id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/subscriptions/:subscription_id/resume");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/subscriptions/:subscription_id/resume")
require "http/client"
url = "{{baseUrl}}/subscriptions/:subscription_id/resume"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/subscriptions/:subscription_id/resume"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/subscriptions/:subscription_id/resume");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/subscriptions/:subscription_id/resume"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/subscriptions/:subscription_id/resume HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/subscriptions/:subscription_id/resume")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/subscriptions/:subscription_id/resume"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/subscriptions/:subscription_id/resume")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/subscriptions/:subscription_id/resume")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/subscriptions/:subscription_id/resume');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/subscriptions/:subscription_id/resume'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/subscriptions/:subscription_id/resume';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/subscriptions/:subscription_id/resume',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/subscriptions/:subscription_id/resume")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/subscriptions/:subscription_id/resume',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/subscriptions/:subscription_id/resume'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/subscriptions/:subscription_id/resume');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/subscriptions/:subscription_id/resume'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/subscriptions/:subscription_id/resume';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/subscriptions/:subscription_id/resume"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/subscriptions/:subscription_id/resume" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/subscriptions/:subscription_id/resume",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/subscriptions/:subscription_id/resume');
echo $response->getBody();
setUrl('{{baseUrl}}/subscriptions/:subscription_id/resume');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/subscriptions/:subscription_id/resume');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/subscriptions/:subscription_id/resume' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/subscriptions/:subscription_id/resume' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/subscriptions/:subscription_id/resume")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/subscriptions/:subscription_id/resume"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/subscriptions/:subscription_id/resume"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/subscriptions/:subscription_id/resume")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/subscriptions/:subscription_id/resume') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/subscriptions/:subscription_id/resume";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/subscriptions/:subscription_id/resume
http POST {{baseUrl}}/subscriptions/:subscription_id/resume
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/subscriptions/:subscription_id/resume
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/subscriptions/:subscription_id/resume")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"id": "AmYzjmPbSbWYkESv7MnwwA",
"subscription": "AmYzjmPbSbWYkESv7MnwwA",
"active": true,
"state": "trial",
"isSubscriptionEligibleForPauseByBuyer": false,
"isPauseScheduled": true,
"changed": 1573257599032,
"changedValue": 1573257599032,
"changedInSeconds": 1573257599,
"changedDisplay": "11/8/19",
"live": false,
"declineReason": "Invalid Card number",
"paymentMethod": "CREDIT_CARD",
"expiry": "12/25",
"cardEnding": 1234,
"cardType": "VISA",
"currency": "USD",
"account": "N8FjcSWcQNeYCc-suM1O8g",
"product": "example-monthly-subscription",
"sku": "skusub1",
"display": "Example Monthly Subscription",
"quantity": 1,
"adhoc": false,
"autoRenew": true,
"price": 14.95,
"priceDisplay": "$14.95",
"priceInPayoutCurrency": 14.95,
"priceInPayoutCurrencyDisplay": "$14.95",
"discount": 3.74,
"discountDisplay": "$3.74",
"discountInPayoutCurrency": 3.74,
"discountInPayoutCurrencyDisplay": "$3.74",
"subtotal": 16.21,
"subtotalDisplay": "$16.21",
"subtotalInPayoutCurrency": 16.21,
"subtotalInPayoutCurrencyDisplay": "$16.21",
"attributes": {
"Furious": "Falcon",
"CustomAttribute2": "CustomValue2",
"CustomAttribute1": "CustomValue1"
},
"discountDuration": 1,
"next": 1574380800000,
"nextInSeconds": 1574380800,
"nextDisplay": "11/22/19",
"end": null,
"endValue": null,
"endInSeconds": null,
"endDisplay": null,
"canceledDate": null,
"canceledDateValue": null,
"canceledDateInSeconds": null,
"canceledDateDisplay": null,
"deactivationDate": null,
"deactivationDateValue": null,
"deactivationDateInSeconds": null,
"deactivationDateDisplay": null,
"sequence": 1,
"periods": null,
"remainingPeriods": null,
"begin": 1573171200000,
"beginValue": 1573171200000,
"beginInSeconds": 1573171200,
"beginDisplay": "11/8/19",
"intervalUnit": "month",
"intervalLength": 1,
"nextChargeCurrency": "USD",
"nextChargeDate": 1574380800000,
"nextChargeDateValue": 1574380800000,
"nextChargeDateInSeconds": 1574380800,
"nextChargeDateDisplay": "11/22/19",
"nextChargePreTax": 16.21,
"nextChargePreTaxDisplay": "$16.21",
"nextChargePreTaxInPayoutCurrency": 16.21,
"nextChargePreTaxInPayoutCurrencyDisplay": "$16.21",
"nextChargeTotal": 16.21,
"nextChargeTotalDisplay": "$16.21",
"nextChargeTotalInPayoutCurrency": 16.21,
"nextChargeTotalInPayoutCurrencyDisplay": "$16.21",
"nextNotificationType": "PAYMENT_REMINDER",
"nextNotificationDate": 1574294400000,
"nextNotificationDateValue": 1574294400000,
"nextNotificationDateInSeconds": 1574294400,
"nextNotificationDateDisplay": "11/21/19",
"trialReminder": {
"intervalUnit": "day",
"intervalLength": 3
},
"paymentReminder": {
"intervalUnit": "day",
"intervalLength": 1
},
"paymentOverdue": {
"intervalUnit": "week",
"intervalLength": 2,
"total": 1,
"sent": 0
},
"cancellationSetting": {
"cancellation": "AFTER_LAST_NOTIFICATION",
"intervalUnit": "week",
"intervalLength": 1
},
"addons": [
{
"product": "example-product-3",
"sku": "skuex3",
"display": "Example Product 3",
"quantity": 1,
"price": 5,
"priceDisplay": "$5.00",
"priceInPayoutCurrency": 5,
"priceInPayoutCurrencyDisplay": "$5.00",
"discount": 0,
"discountDisplay": "$0.00",
"discountInPayoutCurrency": 0,
"discountInPayoutCurrencyDisplay": "$0.00",
"subtotal": 5,
"subtotalDisplay": "$5.00",
"subtotalInPayoutCurrency": 5,
"subtotalInPayoutCurrencyDisplay": "$5.00",
"discounts": []
}
],
"discounts": [
{
"discountPath": "example-monthly-subscription",
"discountDuration": 1,
"percentValue": 25
}
],
"setupFee": {
"price": {
"USD": 9.95
},
"title": {
"en": "One-time Setup Fee"
}
},
"instructions": [
{
"type": "trial",
"periodStartDate": 1573171200000,
"periodStartDateValue": 1573171200000,
"periodStartDateInSeconds": 1573171200,
"periodStartDateDisplay": "11/8/19",
"periodEndDate": 1574294400000,
"periodEndDateValue": 1574294400000,
"periodEndDateInSeconds": 1574294400,
"periodEndDateDisplay": "11/21/19",
"discountDurationUnit": "day",
"discountDurationLength": 14,
"discountPercent": 100,
"discountPercentValue": 100,
"discountPercentDisplay": "100%",
"unitDiscount": 14.95,
"unitDiscountDisplay": "$14.95",
"unitDiscountInPayoutCurrency": 14.95,
"unitDiscountInPayoutCurrencyDisplay": "$14.95",
"discountTotal": 14.95,
"discountTotalDisplay": "$14.95",
"discountTotalInPayoutCurrency": 14.95,
"discountTotalInPayoutCurrencyDisplay": "$14.95",
"total": 0,
"totalDisplay": "$0.00",
"totalInPayoutCurrency": 0,
"totalInPayoutCurrencyDisplay": "$0.00",
"price": 14.95,
"priceDisplay": "$14.95",
"priceInPayoutCurrency": 14.95,
"priceInPayoutCurrencyDisplay": "$14.95",
"priceTotal": 14.95,
"priceTotalDisplay": "$14.95",
"priceTotalInPayoutCurrency": 14.95,
"priceTotalInPayoutCurrencyDisplay": "$14.95",
"unitPrice": 0,
"unitPriceDisplay": "$0.00",
"unitPriceInPayoutCurrency": 0,
"unitPriceInPayoutCurrencyDisplay": "$0.00"
},
{
"product": "example-monthly-subscription",
"type": "discounted",
"periodStartDate": 1574380800000,
"periodStartDateValue": 1574380800000,
"periodStartDateInSeconds": 1574380800,
"periodStartDateDisplay": "11/22/19",
"periodEndDate": 1576886400000,
"periodEndDateValue": 1576886400000,
"periodEndDateInSeconds": 1576886400,
"periodEndDateDisplay": "12/21/19",
"discountIntervalUnit": "month",
"discountIntervalLength": 1,
"discountDuration": 1,
"discountDurationUnit": "month",
"discountDurationLength": 1,
"unitDiscount": 3.74,
"unitDiscountDisplay": "$3.74",
"unitDiscountInPayoutCurrency": 3.74,
"unitDiscountInPayoutCurrencyDisplay": "$3.74",
"discountPercent": 25,
"discountPercentValue": 25,
"discountPercentDisplay": "25%",
"discountTotal": 3.74,
"discountTotalDisplay": "$3.74",
"discountTotalInPayoutCurrency": 3.74,
"discountTotalInPayoutCurrencyDisplay": "$3.74",
"price": 14.95,
"priceDisplay": "$14.95",
"priceInPayoutCurrency": 14.95,
"priceInPayoutCurrencyDisplay": "$14.95",
"priceTotal": 14.95,
"priceTotalDisplay": "$14.95",
"priceTotalInPayoutCurrency": 14.95,
"priceTotalInPayoutCurrencyDisplay": "$14.95",
"unitPrice": 11.21,
"unitPriceDisplay": "$11.21",
"unitPriceInPayoutCurrency": 11.21,
"unitPriceInPayoutCurrencyDisplay": "$11.21",
"total": 11.21,
"totalDisplay": "$11.21",
"totalInPayoutCurrency": 11.21,
"totalInPayoutCurrencyDisplay": "$11.21"
},
{
"product": "example-monthly-subscription",
"type": "regular",
"periodStartDate": 1576972800000,
"periodStartDateValue": 1576972800000,
"periodStartDateInSeconds": 1576972800,
"periodStartDateDisplay": "12/22/19",
"periodEndDate": null,
"periodEndDateValue": null,
"periodEndDateInSeconds": null,
"periodEndDateDisplay": null,
"intervalUnit": "month",
"intervalLength": 1,
"discountPercent": 0,
"discountPercentValue": 0,
"discountPercentDisplay": "0%",
"discountTotal": 0,
"discountTotalDisplay": "$0.00",
"discountTotalInPayoutCurrency": 0,
"discountTotalInPayoutCurrencyDisplay": "$0.00",
"unitDiscount": 0,
"unitDiscountDisplay": "$0.00",
"unitDiscountInPayoutCurrency": 0,
"unitDiscountInPayoutCurrencyDisplay": "$0.00",
"price": 14.95,
"priceDisplay": "$14.95",
"priceInPayoutCurrency": 14.95,
"priceInPayoutCurrencyDisplay": "$14.95",
"priceTotal": 14.95,
"priceTotalDisplay": "$14.95",
"priceTotalInPayoutCurrency": 14.95,
"priceTotalInPayoutCurrencyDisplay": "$14.95",
"unitPrice": 14.95,
"unitPriceDisplay": "$14.95",
"unitPriceInPayoutCurrency": 14.95,
"unitPriceInPayoutCurrencyDisplay": "$14.95",
"total": 14.95,
"totalDisplay": "$14.95",
"totalInPayoutCurrency": 14.95,
"totalInPayoutCurrencyDisplay": "$14.95"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "subscriptions.resume",
"result": "error",
"error": {
"subscription.resume": "Unable to find subscription."
}
}
POST
Resume a canceled subscription
{{baseUrl}}/subscriptions/:subscription_id
QUERY PARAMS
subscription_id
BODY json
{
"subscriptions": [
{
"subscription": "",
"deactivation": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/subscriptions/:subscription_id");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/subscriptions/:subscription_id" {:content-type :json
:form-params {:subscriptions [{:subscription ""
:deactivation ""}]}})
require "http/client"
url = "{{baseUrl}}/subscriptions/:subscription_id"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\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}}/subscriptions/:subscription_id"),
Content = new StringContent("{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\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}}/subscriptions/:subscription_id");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/subscriptions/:subscription_id"
payload := strings.NewReader("{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\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/subscriptions/:subscription_id HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 91
{
"subscriptions": [
{
"subscription": "",
"deactivation": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/subscriptions/:subscription_id")
.setHeader("content-type", "application/json")
.setBody("{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/subscriptions/:subscription_id"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\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 \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/subscriptions/:subscription_id")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/subscriptions/:subscription_id")
.header("content-type", "application/json")
.body("{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
subscriptions: [
{
subscription: '',
deactivation: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/subscriptions/:subscription_id');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/subscriptions/:subscription_id',
headers: {'content-type': 'application/json'},
data: {subscriptions: [{subscription: '', deactivation: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/subscriptions/:subscription_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"subscriptions":[{"subscription":"","deactivation":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/subscriptions/:subscription_id',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "subscriptions": [\n {\n "subscription": "",\n "deactivation": ""\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 \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/subscriptions/:subscription_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/subscriptions/:subscription_id',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({subscriptions: [{subscription: '', deactivation: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/subscriptions/:subscription_id',
headers: {'content-type': 'application/json'},
body: {subscriptions: [{subscription: '', deactivation: ''}]},
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}}/subscriptions/:subscription_id');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
subscriptions: [
{
subscription: '',
deactivation: ''
}
]
});
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}}/subscriptions/:subscription_id',
headers: {'content-type': 'application/json'},
data: {subscriptions: [{subscription: '', deactivation: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/subscriptions/:subscription_id';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"subscriptions":[{"subscription":"","deactivation":""}]}'
};
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 = @{ @"subscriptions": @[ @{ @"subscription": @"", @"deactivation": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/subscriptions/:subscription_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}}/subscriptions/:subscription_id" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/subscriptions/:subscription_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([
'subscriptions' => [
[
'subscription' => '',
'deactivation' => ''
]
]
]),
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}}/subscriptions/:subscription_id', [
'body' => '{
"subscriptions": [
{
"subscription": "",
"deactivation": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/subscriptions/:subscription_id');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'subscriptions' => [
[
'subscription' => '',
'deactivation' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'subscriptions' => [
[
'subscription' => '',
'deactivation' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/subscriptions/:subscription_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}}/subscriptions/:subscription_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"subscriptions": [
{
"subscription": "",
"deactivation": ""
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/subscriptions/:subscription_id' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"subscriptions": [
{
"subscription": "",
"deactivation": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/subscriptions/:subscription_id", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/subscriptions/:subscription_id"
payload = { "subscriptions": [
{
"subscription": "",
"deactivation": ""
}
] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/subscriptions/:subscription_id"
payload <- "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\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}}/subscriptions/:subscription_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 \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\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/subscriptions/:subscription_id') do |req|
req.body = "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"deactivation\": \"\"\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}}/subscriptions/:subscription_id";
let payload = json!({"subscriptions": (
json!({
"subscription": "",
"deactivation": ""
})
)});
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}}/subscriptions/:subscription_id \
--header 'content-type: application/json' \
--data '{
"subscriptions": [
{
"subscription": "",
"deactivation": ""
}
]
}'
echo '{
"subscriptions": [
{
"subscription": "",
"deactivation": ""
}
]
}' | \
http POST {{baseUrl}}/subscriptions/:subscription_id \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "subscriptions": [\n {\n "subscription": "",\n "deactivation": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/subscriptions/:subscription_id
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["subscriptions": [
[
"subscription": "",
"deactivation": ""
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/subscriptions/:subscription_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()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscription": "subscription-id",
"action": "subscription.get",
"result": "error",
"error": {
"subscription": "Subscription not found"
}
}
POST
Update a subscription
{{baseUrl}}/subscriptions
BODY json
{
"subscriptions": [
{
"subscription": "",
"product": "",
"quantity": 0,
"taxExemptId": ""
}
]
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/subscriptions");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\n }\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/subscriptions" {:content-type :json
:form-params {:subscriptions [{:subscription ""
:product ""
:quantity 0
:taxExemptId ""}]}})
require "http/client"
url = "{{baseUrl}}/subscriptions"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\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}}/subscriptions"),
Content = new StringContent("{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\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}}/subscriptions");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\n }\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/subscriptions"
payload := strings.NewReader("{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\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/subscriptions HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 132
{
"subscriptions": [
{
"subscription": "",
"product": "",
"quantity": 0,
"taxExemptId": ""
}
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/subscriptions")
.setHeader("content-type", "application/json")
.setBody("{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\n }\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/subscriptions"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\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 \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\n }\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/subscriptions")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/subscriptions")
.header("content-type", "application/json")
.body("{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\n }\n ]\n}")
.asString();
const data = JSON.stringify({
subscriptions: [
{
subscription: '',
product: '',
quantity: 0,
taxExemptId: ''
}
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/subscriptions');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/subscriptions',
headers: {'content-type': 'application/json'},
data: {subscriptions: [{subscription: '', product: '', quantity: 0, taxExemptId: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/subscriptions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"subscriptions":[{"subscription":"","product":"","quantity":0,"taxExemptId":""}]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/subscriptions',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "subscriptions": [\n {\n "subscription": "",\n "product": "",\n "quantity": 0,\n "taxExemptId": ""\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 \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\n }\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/subscriptions")
.post(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/subscriptions',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({subscriptions: [{subscription: '', product: '', quantity: 0, taxExemptId: ''}]}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/subscriptions',
headers: {'content-type': 'application/json'},
body: {subscriptions: [{subscription: '', product: '', quantity: 0, taxExemptId: ''}]},
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}}/subscriptions');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
subscriptions: [
{
subscription: '',
product: '',
quantity: 0,
taxExemptId: ''
}
]
});
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}}/subscriptions',
headers: {'content-type': 'application/json'},
data: {subscriptions: [{subscription: '', product: '', quantity: 0, taxExemptId: ''}]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/subscriptions';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"subscriptions":[{"subscription":"","product":"","quantity":0,"taxExemptId":""}]}'
};
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 = @{ @"subscriptions": @[ @{ @"subscription": @"", @"product": @"", @"quantity": @0, @"taxExemptId": @"" } ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/subscriptions"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/subscriptions" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\n }\n ]\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'subscriptions' => [
[
'subscription' => '',
'product' => '',
'quantity' => 0,
'taxExemptId' => ''
]
]
]),
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}}/subscriptions', [
'body' => '{
"subscriptions": [
{
"subscription": "",
"product": "",
"quantity": 0,
"taxExemptId": ""
}
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/subscriptions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'subscriptions' => [
[
'subscription' => '',
'product' => '',
'quantity' => 0,
'taxExemptId' => ''
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'subscriptions' => [
[
'subscription' => '',
'product' => '',
'quantity' => 0,
'taxExemptId' => ''
]
]
]));
$request->setRequestUrl('{{baseUrl}}/subscriptions');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/subscriptions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"subscriptions": [
{
"subscription": "",
"product": "",
"quantity": 0,
"taxExemptId": ""
}
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/subscriptions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"subscriptions": [
{
"subscription": "",
"product": "",
"quantity": 0,
"taxExemptId": ""
}
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\n }\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/subscriptions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/subscriptions"
payload = { "subscriptions": [
{
"subscription": "",
"product": "",
"quantity": 0,
"taxExemptId": ""
}
] }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/subscriptions"
payload <- "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\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}}/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\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/subscriptions') do |req|
req.body = "{\n \"subscriptions\": [\n {\n \"subscription\": \"\",\n \"product\": \"\",\n \"quantity\": 0,\n \"taxExemptId\": \"\"\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}}/subscriptions";
let payload = json!({"subscriptions": (
json!({
"subscription": "",
"product": "",
"quantity": 0,
"taxExemptId": ""
})
)});
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}}/subscriptions \
--header 'content-type: application/json' \
--data '{
"subscriptions": [
{
"subscription": "",
"product": "",
"quantity": 0,
"taxExemptId": ""
}
]
}'
echo '{
"subscriptions": [
{
"subscription": "",
"product": "",
"quantity": 0,
"taxExemptId": ""
}
]
}' | \
http POST {{baseUrl}}/subscriptions \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "subscriptions": [\n {\n "subscription": "",\n "product": "",\n "quantity": 0,\n "taxExemptId": ""\n }\n ]\n}' \
--output-document \
- {{baseUrl}}/subscriptions
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["subscriptions": [
[
"subscription": "",
"product": "",
"quantity": 0,
"taxExemptId": ""
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/subscriptions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscriptions": [
{
"subscription": "subscription-id-1",
"action": "subscription.update",
"result": "success"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"subscriptions": [
{
"subscription": "subscription-id-2",
"action": "subscription.update",
"result": "error",
"error": {
"subscription": "Not found",
"next": "Date format yyyy-mm-dd or milliseconds",
"end": "Set 0 for no end date or Date format yyyy-mm-dd or milliseconds",
"product": "Not a subscription product",
"quantity": "Must be greater than zero",
"coupons": "coupon_code is not a valid coupon: DOES_NOT_EXIST/USE_LIMIT_REACHED/NOT_VALID_TODAY",
"prorate": "Can't prorate on-demand subscription",
"manualRenew": "Subscription is already set to manual renew"
}
}
]
}
POST
Update a webhook key secret
{{baseUrl}}/webhooks/keys
BODY json
{
"url": "",
"hmacSecret": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/webhooks/keys");
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 \"url\": \"\",\n \"hmacSecret\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/webhooks/keys" {:content-type :json
:form-params {:url ""
:hmacSecret ""}})
require "http/client"
url = "{{baseUrl}}/webhooks/keys"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"url\": \"\",\n \"hmacSecret\": \"\"\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}}/webhooks/keys"),
Content = new StringContent("{\n \"url\": \"\",\n \"hmacSecret\": \"\"\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}}/webhooks/keys");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"url\": \"\",\n \"hmacSecret\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/webhooks/keys"
payload := strings.NewReader("{\n \"url\": \"\",\n \"hmacSecret\": \"\"\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/webhooks/keys HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 35
{
"url": "",
"hmacSecret": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/webhooks/keys")
.setHeader("content-type", "application/json")
.setBody("{\n \"url\": \"\",\n \"hmacSecret\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/webhooks/keys"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"url\": \"\",\n \"hmacSecret\": \"\"\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 \"url\": \"\",\n \"hmacSecret\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/webhooks/keys")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/webhooks/keys")
.header("content-type", "application/json")
.body("{\n \"url\": \"\",\n \"hmacSecret\": \"\"\n}")
.asString();
const data = JSON.stringify({
url: '',
hmacSecret: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/webhooks/keys');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/webhooks/keys',
headers: {'content-type': 'application/json'},
data: {url: '', hmacSecret: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/webhooks/keys';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"url":"","hmacSecret":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/webhooks/keys',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "url": "",\n "hmacSecret": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"url\": \"\",\n \"hmacSecret\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/webhooks/keys")
.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/webhooks/keys',
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({url: '', hmacSecret: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/webhooks/keys',
headers: {'content-type': 'application/json'},
body: {url: '', hmacSecret: ''},
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}}/webhooks/keys');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
url: '',
hmacSecret: ''
});
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}}/webhooks/keys',
headers: {'content-type': 'application/json'},
data: {url: '', hmacSecret: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/webhooks/keys';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"url":"","hmacSecret":""}'
};
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 = @{ @"url": @"",
@"hmacSecret": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/webhooks/keys"]
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}}/webhooks/keys" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"url\": \"\",\n \"hmacSecret\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/webhooks/keys",
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([
'url' => '',
'hmacSecret' => ''
]),
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}}/webhooks/keys', [
'body' => '{
"url": "",
"hmacSecret": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/webhooks/keys');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'url' => '',
'hmacSecret' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'url' => '',
'hmacSecret' => ''
]));
$request->setRequestUrl('{{baseUrl}}/webhooks/keys');
$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}}/webhooks/keys' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": "",
"hmacSecret": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/webhooks/keys' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": "",
"hmacSecret": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"url\": \"\",\n \"hmacSecret\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/webhooks/keys", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/webhooks/keys"
payload = {
"url": "",
"hmacSecret": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/webhooks/keys"
payload <- "{\n \"url\": \"\",\n \"hmacSecret\": \"\"\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}}/webhooks/keys")
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 \"url\": \"\",\n \"hmacSecret\": \"\"\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/webhooks/keys') do |req|
req.body = "{\n \"url\": \"\",\n \"hmacSecret\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/webhooks/keys";
let payload = json!({
"url": "",
"hmacSecret": ""
});
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}}/webhooks/keys \
--header 'content-type: application/json' \
--data '{
"url": "",
"hmacSecret": ""
}'
echo '{
"url": "",
"hmacSecret": ""
}' | \
http POST {{baseUrl}}/webhooks/keys \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "url": "",\n "hmacSecret": ""\n}' \
--output-document \
- {{baseUrl}}/webhooks/keys
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"url": "",
"hmacSecret": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/webhooks/keys")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "webhooks.update",
"result": "success"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"action": "webhooks.update",
"result": "error",
"error": {
"url": "A URL is required"
}
}