Just Eat UK
POST
Delivery Attempt Failed (POST)
{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery
HEADERS
Authorization
QUERY PARAMS
tenant
orderId
BODY json
{
"ReasonCode": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"ReasonCode\": \"problem_with_address\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery" {:headers {:authorization ""}
:content-type :json
:form-params {:ReasonCode "problem_with_address"}})
require "http/client"
url = "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery"
headers = HTTP::Headers{
"authorization" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"ReasonCode\": \"problem_with_address\"\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}}/:tenant/orders/:orderId/queries/attempteddelivery"),
Headers =
{
{ "authorization", "" },
},
Content = new StringContent("{\n \"ReasonCode\": \"problem_with_address\"\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}}/:tenant/orders/:orderId/queries/attempteddelivery");
var request = new RestRequest("", Method.Post);
request.AddHeader("authorization", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"ReasonCode\": \"problem_with_address\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery"
payload := strings.NewReader("{\n \"ReasonCode\": \"problem_with_address\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "")
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/:tenant/orders/:orderId/queries/attempteddelivery HTTP/1.1
Authorization:
Content-Type: application/json
Host: example.com
Content-Length: 42
{
"ReasonCode": "problem_with_address"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery")
.setHeader("authorization", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"ReasonCode\": \"problem_with_address\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery"))
.header("authorization", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"ReasonCode\": \"problem_with_address\"\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 \"ReasonCode\": \"problem_with_address\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery")
.post(body)
.addHeader("authorization", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery")
.header("authorization", "")
.header("content-type", "application/json")
.body("{\n \"ReasonCode\": \"problem_with_address\"\n}")
.asString();
const data = JSON.stringify({
ReasonCode: 'problem_with_address'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery');
xhr.setRequestHeader('authorization', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery',
headers: {authorization: '', 'content-type': 'application/json'},
data: {ReasonCode: 'problem_with_address'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery';
const options = {
method: 'POST',
headers: {authorization: '', 'content-type': 'application/json'},
body: '{"ReasonCode":"problem_with_address"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery',
method: 'POST',
headers: {
authorization: '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "ReasonCode": "problem_with_address"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"ReasonCode\": \"problem_with_address\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery")
.post(body)
.addHeader("authorization", "")
.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/:tenant/orders/:orderId/queries/attempteddelivery',
headers: {
authorization: '',
'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({ReasonCode: 'problem_with_address'}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery',
headers: {authorization: '', 'content-type': 'application/json'},
body: {ReasonCode: 'problem_with_address'},
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}}/:tenant/orders/:orderId/queries/attempteddelivery');
req.headers({
authorization: '',
'content-type': 'application/json'
});
req.type('json');
req.send({
ReasonCode: 'problem_with_address'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery',
headers: {authorization: '', 'content-type': 'application/json'},
data: {ReasonCode: 'problem_with_address'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery';
const options = {
method: 'POST',
headers: {authorization: '', 'content-type': 'application/json'},
body: '{"ReasonCode":"problem_with_address"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"authorization": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"ReasonCode": @"problem_with_address" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery"]
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}}/:tenant/orders/:orderId/queries/attempteddelivery" in
let headers = Header.add_list (Header.init ()) [
("authorization", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"ReasonCode\": \"problem_with_address\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery",
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([
'ReasonCode' => 'problem_with_address'
]),
CURLOPT_HTTPHEADER => [
"authorization: ",
"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}}/:tenant/orders/:orderId/queries/attempteddelivery', [
'body' => '{
"ReasonCode": "problem_with_address"
}',
'headers' => [
'authorization' => '',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'authorization' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'ReasonCode' => 'problem_with_address'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'ReasonCode' => 'problem_with_address'
]));
$request->setRequestUrl('{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'authorization' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("authorization", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"ReasonCode": "problem_with_address"
}'
$headers=@{}
$headers.Add("authorization", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"ReasonCode": "problem_with_address"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"ReasonCode\": \"problem_with_address\"\n}"
headers = {
'authorization': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/:tenant/orders/:orderId/queries/attempteddelivery", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery"
payload = { "ReasonCode": "problem_with_address" }
headers = {
"authorization": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery"
payload <- "{\n \"ReasonCode\": \"problem_with_address\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('authorization' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"ReasonCode\": \"problem_with_address\"\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/:tenant/orders/:orderId/queries/attempteddelivery') do |req|
req.headers['authorization'] = ''
req.body = "{\n \"ReasonCode\": \"problem_with_address\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery";
let payload = json!({"ReasonCode": "problem_with_address"});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("authorization", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery \
--header 'authorization: ' \
--header 'content-type: application/json' \
--data '{
"ReasonCode": "problem_with_address"
}'
echo '{
"ReasonCode": "problem_with_address"
}' | \
http POST {{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery \
authorization:'' \
content-type:application/json
wget --quiet \
--method POST \
--header 'authorization: ' \
--header 'content-type: application/json' \
--body-data '{\n "ReasonCode": "problem_with_address"\n}' \
--output-document \
- {{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery
import Foundation
let headers = [
"authorization": "",
"content-type": "application/json"
]
let parameters = ["ReasonCode": "problem_with_address"] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery")! 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
Request Redelivery of the Order
{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder
HEADERS
Authorization
QUERY PARAMS
tenant
orderId
BODY json
{
"NewDueDate": "",
"Status": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder" {:headers {:authorization ""}
:content-type :json
:form-params {:NewDueDate "2018-03-10T14:45:28Z"
:Status "driver_at_address"}})
require "http/client"
url = "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder"
headers = HTTP::Headers{
"authorization" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\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}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder"),
Headers =
{
{ "authorization", "" },
},
Content = new StringContent("{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\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}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder");
var request = new RestRequest("", Method.Post);
request.AddHeader("authorization", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder"
payload := strings.NewReader("{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "")
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/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder HTTP/1.1
Authorization:
Content-Type: application/json
Host: example.com
Content-Length: 75
{
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "driver_at_address"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder")
.setHeader("authorization", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder"))
.header("authorization", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\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 \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder")
.post(body)
.addHeader("authorization", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder")
.header("authorization", "")
.header("content-type", "application/json")
.body("{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\n}")
.asString();
const data = JSON.stringify({
NewDueDate: '2018-03-10T14:45:28Z',
Status: 'driver_at_address'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder');
xhr.setRequestHeader('authorization', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder',
headers: {authorization: '', 'content-type': 'application/json'},
data: {NewDueDate: '2018-03-10T14:45:28Z', Status: 'driver_at_address'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder';
const options = {
method: 'POST',
headers: {authorization: '', 'content-type': 'application/json'},
body: '{"NewDueDate":"2018-03-10T14:45:28Z","Status":"driver_at_address"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder',
method: 'POST',
headers: {
authorization: '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "NewDueDate": "2018-03-10T14:45:28Z",\n "Status": "driver_at_address"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder")
.post(body)
.addHeader("authorization", "")
.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/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder',
headers: {
authorization: '',
'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({NewDueDate: '2018-03-10T14:45:28Z', Status: 'driver_at_address'}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder',
headers: {authorization: '', 'content-type': 'application/json'},
body: {NewDueDate: '2018-03-10T14:45:28Z', Status: 'driver_at_address'},
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}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder');
req.headers({
authorization: '',
'content-type': 'application/json'
});
req.type('json');
req.send({
NewDueDate: '2018-03-10T14:45:28Z',
Status: 'driver_at_address'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder',
headers: {authorization: '', 'content-type': 'application/json'},
data: {NewDueDate: '2018-03-10T14:45:28Z', Status: 'driver_at_address'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder';
const options = {
method: 'POST',
headers: {authorization: '', 'content-type': 'application/json'},
body: '{"NewDueDate":"2018-03-10T14:45:28Z","Status":"driver_at_address"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"authorization": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"NewDueDate": @"2018-03-10T14:45:28Z",
@"Status": @"driver_at_address" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder"]
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}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder" in
let headers = Header.add_list (Header.init ()) [
("authorization", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder",
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([
'NewDueDate' => '2018-03-10T14:45:28Z',
'Status' => 'driver_at_address'
]),
CURLOPT_HTTPHEADER => [
"authorization: ",
"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}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder', [
'body' => '{
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "driver_at_address"
}',
'headers' => [
'authorization' => '',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'authorization' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'NewDueDate' => '2018-03-10T14:45:28Z',
'Status' => 'driver_at_address'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'NewDueDate' => '2018-03-10T14:45:28Z',
'Status' => 'driver_at_address'
]));
$request->setRequestUrl('{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'authorization' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("authorization", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "driver_at_address"
}'
$headers=@{}
$headers.Add("authorization", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "driver_at_address"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\n}"
headers = {
'authorization': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder"
payload = {
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "driver_at_address"
}
headers = {
"authorization": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder"
payload <- "{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('authorization' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\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/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder') do |req|
req.headers['authorization'] = ''
req.body = "{\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"driver_at_address\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder";
let payload = json!({
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "driver_at_address"
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("authorization", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder \
--header 'authorization: ' \
--header 'content-type: application/json' \
--data '{
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "driver_at_address"
}'
echo '{
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "driver_at_address"
}' | \
http POST {{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder \
authorization:'' \
content-type:application/json
wget --quiet \
--method POST \
--header 'authorization: ' \
--header 'content-type: application/json' \
--body-data '{\n "NewDueDate": "2018-03-10T14:45:28Z",\n "Status": "driver_at_address"\n}' \
--output-document \
- {{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder
import Foundation
let headers = [
"authorization": "",
"content-type": "application/json"
]
let parameters = [
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "driver_at_address"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/:tenant/orders/:orderId/queries/attempteddelivery/resolution/redeliverorder")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Attempted delivery query resolved
{{baseUrl}}/attempted-delivery-query-resolved
BODY json
{
"OrderId": "",
"Resolution": {
"Cancellation": {
"Reason": ""
},
"Redelivery": {
"CustomerTimeZone": "",
"NewDueDate": "",
"Status": ""
},
"Type": ""
},
"Tenant": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/attempted-delivery-query-resolved");
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 \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/attempted-delivery-query-resolved" {:content-type :json
:form-params {:OrderId "wiej234idf09i29jijgf4"
:Resolution {:Redelivery {:CustomerTimeZone "Europe/London"
:NewDueDate "2018-03-10T14:45:28Z"
:Status "repreparing"}
:Type "redeliver_order"}
:Tenant "uk"}})
require "http/client"
url = "{{baseUrl}}/attempted-delivery-query-resolved"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\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}}/attempted-delivery-query-resolved"),
Content = new StringContent("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\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}}/attempted-delivery-query-resolved");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/attempted-delivery-query-resolved"
payload := strings.NewReader("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\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/attempted-delivery-query-resolved HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 255
{
"OrderId": "wiej234idf09i29jijgf4",
"Resolution": {
"Redelivery": {
"CustomerTimeZone": "Europe/London",
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "repreparing"
},
"Type": "redeliver_order"
},
"Tenant": "uk"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/attempted-delivery-query-resolved")
.setHeader("content-type", "application/json")
.setBody("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/attempted-delivery-query-resolved"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\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 \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/attempted-delivery-query-resolved")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/attempted-delivery-query-resolved")
.header("content-type", "application/json")
.body("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\n}")
.asString();
const data = JSON.stringify({
OrderId: 'wiej234idf09i29jijgf4',
Resolution: {
Redelivery: {
CustomerTimeZone: 'Europe/London',
NewDueDate: '2018-03-10T14:45:28Z',
Status: 'repreparing'
},
Type: 'redeliver_order'
},
Tenant: 'uk'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/attempted-delivery-query-resolved');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/attempted-delivery-query-resolved',
headers: {'content-type': 'application/json'},
data: {
OrderId: 'wiej234idf09i29jijgf4',
Resolution: {
Redelivery: {
CustomerTimeZone: 'Europe/London',
NewDueDate: '2018-03-10T14:45:28Z',
Status: 'repreparing'
},
Type: 'redeliver_order'
},
Tenant: 'uk'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/attempted-delivery-query-resolved';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"OrderId":"wiej234idf09i29jijgf4","Resolution":{"Redelivery":{"CustomerTimeZone":"Europe/London","NewDueDate":"2018-03-10T14:45:28Z","Status":"repreparing"},"Type":"redeliver_order"},"Tenant":"uk"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/attempted-delivery-query-resolved',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "OrderId": "wiej234idf09i29jijgf4",\n "Resolution": {\n "Redelivery": {\n "CustomerTimeZone": "Europe/London",\n "NewDueDate": "2018-03-10T14:45:28Z",\n "Status": "repreparing"\n },\n "Type": "redeliver_order"\n },\n "Tenant": "uk"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/attempted-delivery-query-resolved")
.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/attempted-delivery-query-resolved',
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({
OrderId: 'wiej234idf09i29jijgf4',
Resolution: {
Redelivery: {
CustomerTimeZone: 'Europe/London',
NewDueDate: '2018-03-10T14:45:28Z',
Status: 'repreparing'
},
Type: 'redeliver_order'
},
Tenant: 'uk'
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/attempted-delivery-query-resolved',
headers: {'content-type': 'application/json'},
body: {
OrderId: 'wiej234idf09i29jijgf4',
Resolution: {
Redelivery: {
CustomerTimeZone: 'Europe/London',
NewDueDate: '2018-03-10T14:45:28Z',
Status: 'repreparing'
},
Type: 'redeliver_order'
},
Tenant: 'uk'
},
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}}/attempted-delivery-query-resolved');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
OrderId: 'wiej234idf09i29jijgf4',
Resolution: {
Redelivery: {
CustomerTimeZone: 'Europe/London',
NewDueDate: '2018-03-10T14:45:28Z',
Status: 'repreparing'
},
Type: 'redeliver_order'
},
Tenant: 'uk'
});
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}}/attempted-delivery-query-resolved',
headers: {'content-type': 'application/json'},
data: {
OrderId: 'wiej234idf09i29jijgf4',
Resolution: {
Redelivery: {
CustomerTimeZone: 'Europe/London',
NewDueDate: '2018-03-10T14:45:28Z',
Status: 'repreparing'
},
Type: 'redeliver_order'
},
Tenant: 'uk'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/attempted-delivery-query-resolved';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"OrderId":"wiej234idf09i29jijgf4","Resolution":{"Redelivery":{"CustomerTimeZone":"Europe/London","NewDueDate":"2018-03-10T14:45:28Z","Status":"repreparing"},"Type":"redeliver_order"},"Tenant":"uk"}'
};
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 = @{ @"OrderId": @"wiej234idf09i29jijgf4",
@"Resolution": @{ @"Redelivery": @{ @"CustomerTimeZone": @"Europe/London", @"NewDueDate": @"2018-03-10T14:45:28Z", @"Status": @"repreparing" }, @"Type": @"redeliver_order" },
@"Tenant": @"uk" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/attempted-delivery-query-resolved"]
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}}/attempted-delivery-query-resolved" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/attempted-delivery-query-resolved",
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([
'OrderId' => 'wiej234idf09i29jijgf4',
'Resolution' => [
'Redelivery' => [
'CustomerTimeZone' => 'Europe/London',
'NewDueDate' => '2018-03-10T14:45:28Z',
'Status' => 'repreparing'
],
'Type' => 'redeliver_order'
],
'Tenant' => 'uk'
]),
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}}/attempted-delivery-query-resolved', [
'body' => '{
"OrderId": "wiej234idf09i29jijgf4",
"Resolution": {
"Redelivery": {
"CustomerTimeZone": "Europe/London",
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "repreparing"
},
"Type": "redeliver_order"
},
"Tenant": "uk"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/attempted-delivery-query-resolved');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'OrderId' => 'wiej234idf09i29jijgf4',
'Resolution' => [
'Redelivery' => [
'CustomerTimeZone' => 'Europe/London',
'NewDueDate' => '2018-03-10T14:45:28Z',
'Status' => 'repreparing'
],
'Type' => 'redeliver_order'
],
'Tenant' => 'uk'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'OrderId' => 'wiej234idf09i29jijgf4',
'Resolution' => [
'Redelivery' => [
'CustomerTimeZone' => 'Europe/London',
'NewDueDate' => '2018-03-10T14:45:28Z',
'Status' => 'repreparing'
],
'Type' => 'redeliver_order'
],
'Tenant' => 'uk'
]));
$request->setRequestUrl('{{baseUrl}}/attempted-delivery-query-resolved');
$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}}/attempted-delivery-query-resolved' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"OrderId": "wiej234idf09i29jijgf4",
"Resolution": {
"Redelivery": {
"CustomerTimeZone": "Europe/London",
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "repreparing"
},
"Type": "redeliver_order"
},
"Tenant": "uk"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/attempted-delivery-query-resolved' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"OrderId": "wiej234idf09i29jijgf4",
"Resolution": {
"Redelivery": {
"CustomerTimeZone": "Europe/London",
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "repreparing"
},
"Type": "redeliver_order"
},
"Tenant": "uk"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/attempted-delivery-query-resolved", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/attempted-delivery-query-resolved"
payload = {
"OrderId": "wiej234idf09i29jijgf4",
"Resolution": {
"Redelivery": {
"CustomerTimeZone": "Europe/London",
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "repreparing"
},
"Type": "redeliver_order"
},
"Tenant": "uk"
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/attempted-delivery-query-resolved"
payload <- "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\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}}/attempted-delivery-query-resolved")
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 \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\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/attempted-delivery-query-resolved') do |req|
req.body = "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Resolution\": {\n \"Redelivery\": {\n \"CustomerTimeZone\": \"Europe/London\",\n \"NewDueDate\": \"2018-03-10T14:45:28Z\",\n \"Status\": \"repreparing\"\n },\n \"Type\": \"redeliver_order\"\n },\n \"Tenant\": \"uk\"\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}}/attempted-delivery-query-resolved";
let payload = json!({
"OrderId": "wiej234idf09i29jijgf4",
"Resolution": json!({
"Redelivery": json!({
"CustomerTimeZone": "Europe/London",
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "repreparing"
}),
"Type": "redeliver_order"
}),
"Tenant": "uk"
});
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}}/attempted-delivery-query-resolved \
--header 'content-type: application/json' \
--data '{
"OrderId": "wiej234idf09i29jijgf4",
"Resolution": {
"Redelivery": {
"CustomerTimeZone": "Europe/London",
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "repreparing"
},
"Type": "redeliver_order"
},
"Tenant": "uk"
}'
echo '{
"OrderId": "wiej234idf09i29jijgf4",
"Resolution": {
"Redelivery": {
"CustomerTimeZone": "Europe/London",
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "repreparing"
},
"Type": "redeliver_order"
},
"Tenant": "uk"
}' | \
http PUT {{baseUrl}}/attempted-delivery-query-resolved \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "OrderId": "wiej234idf09i29jijgf4",\n "Resolution": {\n "Redelivery": {\n "CustomerTimeZone": "Europe/London",\n "NewDueDate": "2018-03-10T14:45:28Z",\n "Status": "repreparing"\n },\n "Type": "redeliver_order"\n },\n "Tenant": "uk"\n}' \
--output-document \
- {{baseUrl}}/attempted-delivery-query-resolved
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"OrderId": "wiej234idf09i29jijgf4",
"Resolution": [
"Redelivery": [
"CustomerTimeZone": "Europe/London",
"NewDueDate": "2018-03-10T14:45:28Z",
"Status": "repreparing"
],
"Type": "redeliver_order"
],
"Tenant": "uk"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/attempted-delivery-query-resolved")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Delivery Attempt Failed
{{baseUrl}}/delivery-failed
BODY json
{
"OrderId": "",
"Reason": "",
"RestaurantId": "",
"Tenant": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery-failed");
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 \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/delivery-failed" {:content-type :json
:form-params {:OrderId "wiej234idf09i29jijgf4"
:Reason "Customer did not answer the door"
:RestaurantId 110230
:Tenant "uk"}})
require "http/client"
url = "{{baseUrl}}/delivery-failed"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\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}}/delivery-failed"),
Content = new StringContent("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\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}}/delivery-failed");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery-failed"
payload := strings.NewReader("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\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/delivery-failed HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 132
{
"OrderId": "wiej234idf09i29jijgf4",
"Reason": "Customer did not answer the door",
"RestaurantId": 110230,
"Tenant": "uk"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/delivery-failed")
.setHeader("content-type", "application/json")
.setBody("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery-failed"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\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 \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/delivery-failed")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/delivery-failed")
.header("content-type", "application/json")
.body("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\n}")
.asString();
const data = JSON.stringify({
OrderId: 'wiej234idf09i29jijgf4',
Reason: 'Customer did not answer the door',
RestaurantId: 110230,
Tenant: 'uk'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/delivery-failed');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/delivery-failed',
headers: {'content-type': 'application/json'},
data: {
OrderId: 'wiej234idf09i29jijgf4',
Reason: 'Customer did not answer the door',
RestaurantId: 110230,
Tenant: 'uk'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery-failed';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"OrderId":"wiej234idf09i29jijgf4","Reason":"Customer did not answer the door","RestaurantId":110230,"Tenant":"uk"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/delivery-failed',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "OrderId": "wiej234idf09i29jijgf4",\n "Reason": "Customer did not answer the door",\n "RestaurantId": 110230,\n "Tenant": "uk"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/delivery-failed")
.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/delivery-failed',
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({
OrderId: 'wiej234idf09i29jijgf4',
Reason: 'Customer did not answer the door',
RestaurantId: 110230,
Tenant: 'uk'
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/delivery-failed',
headers: {'content-type': 'application/json'},
body: {
OrderId: 'wiej234idf09i29jijgf4',
Reason: 'Customer did not answer the door',
RestaurantId: 110230,
Tenant: 'uk'
},
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}}/delivery-failed');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
OrderId: 'wiej234idf09i29jijgf4',
Reason: 'Customer did not answer the door',
RestaurantId: 110230,
Tenant: 'uk'
});
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}}/delivery-failed',
headers: {'content-type': 'application/json'},
data: {
OrderId: 'wiej234idf09i29jijgf4',
Reason: 'Customer did not answer the door',
RestaurantId: 110230,
Tenant: 'uk'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery-failed';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"OrderId":"wiej234idf09i29jijgf4","Reason":"Customer did not answer the door","RestaurantId":110230,"Tenant":"uk"}'
};
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 = @{ @"OrderId": @"wiej234idf09i29jijgf4",
@"Reason": @"Customer did not answer the door",
@"RestaurantId": @110230,
@"Tenant": @"uk" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/delivery-failed"]
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}}/delivery-failed" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery-failed",
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([
'OrderId' => 'wiej234idf09i29jijgf4',
'Reason' => 'Customer did not answer the door',
'RestaurantId' => 110230,
'Tenant' => 'uk'
]),
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}}/delivery-failed', [
'body' => '{
"OrderId": "wiej234idf09i29jijgf4",
"Reason": "Customer did not answer the door",
"RestaurantId": 110230,
"Tenant": "uk"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/delivery-failed');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'OrderId' => 'wiej234idf09i29jijgf4',
'Reason' => 'Customer did not answer the door',
'RestaurantId' => 110230,
'Tenant' => 'uk'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'OrderId' => 'wiej234idf09i29jijgf4',
'Reason' => 'Customer did not answer the door',
'RestaurantId' => 110230,
'Tenant' => 'uk'
]));
$request->setRequestUrl('{{baseUrl}}/delivery-failed');
$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}}/delivery-failed' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"OrderId": "wiej234idf09i29jijgf4",
"Reason": "Customer did not answer the door",
"RestaurantId": 110230,
"Tenant": "uk"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery-failed' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"OrderId": "wiej234idf09i29jijgf4",
"Reason": "Customer did not answer the door",
"RestaurantId": 110230,
"Tenant": "uk"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/delivery-failed", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery-failed"
payload = {
"OrderId": "wiej234idf09i29jijgf4",
"Reason": "Customer did not answer the door",
"RestaurantId": 110230,
"Tenant": "uk"
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery-failed"
payload <- "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\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}}/delivery-failed")
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 \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\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/delivery-failed') do |req|
req.body = "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Reason\": \"Customer did not answer the door\",\n \"RestaurantId\": 110230,\n \"Tenant\": \"uk\"\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}}/delivery-failed";
let payload = json!({
"OrderId": "wiej234idf09i29jijgf4",
"Reason": "Customer did not answer the door",
"RestaurantId": 110230,
"Tenant": "uk"
});
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}}/delivery-failed \
--header 'content-type: application/json' \
--data '{
"OrderId": "wiej234idf09i29jijgf4",
"Reason": "Customer did not answer the door",
"RestaurantId": 110230,
"Tenant": "uk"
}'
echo '{
"OrderId": "wiej234idf09i29jijgf4",
"Reason": "Customer did not answer the door",
"RestaurantId": 110230,
"Tenant": "uk"
}' | \
http PUT {{baseUrl}}/delivery-failed \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "OrderId": "wiej234idf09i29jijgf4",\n "Reason": "Customer did not answer the door",\n "RestaurantId": 110230,\n "Tenant": "uk"\n}' \
--output-document \
- {{baseUrl}}/delivery-failed
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"OrderId": "wiej234idf09i29jijgf4",
"Reason": "Customer did not answer the door",
"RestaurantId": 110230,
"Tenant": "uk"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery-failed")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Available Fulfilment Times
{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes
HEADERS
User-Agent
QUERY PARAMS
tenant
checkoutId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "user-agent: ");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes" {:headers {:user-agent ""}})
require "http/client"
url = "{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes"
headers = HTTP::Headers{
"user-agent" => ""
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes"),
Headers =
{
{ "user-agent", "" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes");
var request = new RestRequest("", Method.Get);
request.AddHeader("user-agent", "");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("user-agent", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/checkout/:tenant/:checkoutId/fulfilment/availabletimes HTTP/1.1
User-Agent:
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes")
.setHeader("user-agent", "")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes"))
.header("user-agent", "")
.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}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes")
.get()
.addHeader("user-agent", "")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes")
.header("user-agent", "")
.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}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes');
xhr.setRequestHeader('user-agent', '');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes',
headers: {'user-agent': ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes';
const options = {method: 'GET', headers: {'user-agent': ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes',
method: 'GET',
headers: {
'user-agent': ''
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes")
.get()
.addHeader("user-agent", "")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/checkout/:tenant/:checkoutId/fulfilment/availabletimes',
headers: {
'user-agent': ''
}
};
const req = http.request(options, function (res) {
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}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes',
headers: {'user-agent': ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes');
req.headers({
'user-agent': ''
});
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}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes',
headers: {'user-agent': ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes';
const options = {method: 'GET', headers: {'user-agent': ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"user-agent": @"" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes" in
let headers = Header.add (Header.init ()) "user-agent" "" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"user-agent: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes', [
'headers' => [
'user-agent' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'user-agent' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes');
$request->setRequestMethod('GET');
$request->setHeaders([
'user-agent' => ''
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("user-agent", "")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes' -Method GET -Headers $headers
$headers=@{}
$headers.Add("user-agent", "")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'user-agent': "" }
conn.request("GET", "/baseUrl/checkout/:tenant/:checkoutId/fulfilment/availabletimes", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes"
headers = {"user-agent": ""}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes"
response <- VERB("GET", url, add_headers('user-agent' = ''), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["user-agent"] = ''
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/checkout/:tenant/:checkoutId/fulfilment/availabletimes') do |req|
req.headers['user-agent'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("user-agent", "".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes \
--header 'user-agent: '
http GET {{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes \
user-agent:''
wget --quiet \
--method GET \
--header 'user-agent: ' \
--output-document \
- {{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes
import Foundation
let headers = ["user-agent": ""]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/checkout/:tenant/:checkoutId/fulfilment/availabletimes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as 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
{
"asapAvailable": true,
"times": [
{
"from": "2020-01-01T00:30:00.000Z",
"to": "2020-01-01T00:45:00.000Z"
},
{
"from": "2020-01-01T00:45:00.000Z",
"to": "2020-01-01T01:00:00.000Z"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "The tenant is invalid",
"errorCode": "TENANT_INVALID"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "The tenant is not supported",
"errorCode": "TENANT_NOT_SUPPORTED"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "The fulfilment time bands are in an invalid state",
"errorCode": "FULFILMENT_TIME_BANDS_INVALID"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Couldn't complete request"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Couldn't complete request"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
GET
Get Checkout
{{baseUrl}}/checkout/:tenant/:checkoutId
HEADERS
User-Agent
QUERY PARAMS
tenant
checkoutId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/checkout/:tenant/:checkoutId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "user-agent: ");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/checkout/:tenant/:checkoutId" {:headers {:user-agent ""}})
require "http/client"
url = "{{baseUrl}}/checkout/:tenant/:checkoutId"
headers = HTTP::Headers{
"user-agent" => ""
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/checkout/:tenant/:checkoutId"),
Headers =
{
{ "user-agent", "" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/checkout/:tenant/:checkoutId");
var request = new RestRequest("", Method.Get);
request.AddHeader("user-agent", "");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/checkout/:tenant/:checkoutId"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("user-agent", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/checkout/:tenant/:checkoutId HTTP/1.1
User-Agent:
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/checkout/:tenant/:checkoutId")
.setHeader("user-agent", "")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/checkout/:tenant/:checkoutId"))
.header("user-agent", "")
.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}}/checkout/:tenant/:checkoutId")
.get()
.addHeader("user-agent", "")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/checkout/:tenant/:checkoutId")
.header("user-agent", "")
.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}}/checkout/:tenant/:checkoutId');
xhr.setRequestHeader('user-agent', '');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/checkout/:tenant/:checkoutId',
headers: {'user-agent': ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/checkout/:tenant/:checkoutId';
const options = {method: 'GET', headers: {'user-agent': ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/checkout/:tenant/:checkoutId',
method: 'GET',
headers: {
'user-agent': ''
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/checkout/:tenant/:checkoutId")
.get()
.addHeader("user-agent", "")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/checkout/:tenant/:checkoutId',
headers: {
'user-agent': ''
}
};
const req = http.request(options, function (res) {
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}}/checkout/:tenant/:checkoutId',
headers: {'user-agent': ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/checkout/:tenant/:checkoutId');
req.headers({
'user-agent': ''
});
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}}/checkout/:tenant/:checkoutId',
headers: {'user-agent': ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/checkout/:tenant/:checkoutId';
const options = {method: 'GET', headers: {'user-agent': ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"user-agent": @"" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/checkout/:tenant/:checkoutId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/checkout/:tenant/:checkoutId" in
let headers = Header.add (Header.init ()) "user-agent" "" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/checkout/:tenant/:checkoutId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"user-agent: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/checkout/:tenant/:checkoutId', [
'headers' => [
'user-agent' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/checkout/:tenant/:checkoutId');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'user-agent' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/checkout/:tenant/:checkoutId');
$request->setRequestMethod('GET');
$request->setHeaders([
'user-agent' => ''
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("user-agent", "")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/checkout/:tenant/:checkoutId' -Method GET -Headers $headers
$headers=@{}
$headers.Add("user-agent", "")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/checkout/:tenant/:checkoutId' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'user-agent': "" }
conn.request("GET", "/baseUrl/checkout/:tenant/:checkoutId", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/checkout/:tenant/:checkoutId"
headers = {"user-agent": ""}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/checkout/:tenant/:checkoutId"
response <- VERB("GET", url, add_headers('user-agent' = ''), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/checkout/:tenant/:checkoutId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["user-agent"] = ''
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/checkout/:tenant/:checkoutId') do |req|
req.headers['user-agent'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/checkout/:tenant/:checkoutId";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("user-agent", "".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/checkout/:tenant/:checkoutId \
--header 'user-agent: '
http GET {{baseUrl}}/checkout/:tenant/:checkoutId \
user-agent:''
wget --quiet \
--method GET \
--header 'user-agent: ' \
--output-document \
- {{baseUrl}}/checkout/:tenant/:checkoutId
import Foundation
let headers = ["user-agent": ""]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/checkout/:tenant/:checkoutId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"customer": {
"firstName": "Joe",
"lastName": "Bloggs",
"phoneNumber": "+447111111111"
},
"fulfilment": {
"location": {
"address": {
"administrativeArea": "Somerset",
"lines": [
"1 Bristol Road"
],
"locality": "Bristol",
"postalCode": "BS1 1AA"
},
"geolocation": {
"latitude": 1,
"longitude": -1
}
},
"time": {
"asap": false,
"scheduled": {
"from": "2020-01-01T00:30:00.000Z",
"to": "2020-01-01T00:30:00.000Z"
}
}
},
"isFulfillable": true,
"issues": [
{
"code": "RESTAURANT_NOT_TAKING_ORDERS"
},
{
"additionalSpendRequired": 100,
"code": "MINIMUM_ORDER_VALUE_NOT_MET",
"currency": "GBP",
"minimumOrderValue": 1000
}
],
"restaurant": {
"availabilityId": "5678",
"id": "1234"
},
"serviceType": "delivery"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "The tenant is invalid",
"errorCode": "TENANT_INVALID"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Authentication required to access this resource"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Access to the resource is forbidden"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "The tenant is not supported",
"errorCode": "TENANT_NOT_SUPPORTED"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "The checkout is in an invalid state",
"errorCode": "CHECKOUT_INVALID"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Couldn't complete request"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Couldn't complete request"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
PATCH
Update Checkout
{{baseUrl}}/checkout/:tenant/:checkoutId
HEADERS
User-Agent
QUERY PARAMS
tenant
checkoutId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/checkout/:tenant/:checkoutId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "user-agent: ");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/checkout/:tenant/:checkoutId" {:headers {:user-agent ""}})
require "http/client"
url = "{{baseUrl}}/checkout/:tenant/:checkoutId"
headers = HTTP::Headers{
"user-agent" => ""
}
response = HTTP::Client.patch url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/checkout/:tenant/:checkoutId"),
Headers =
{
{ "user-agent", "" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/checkout/:tenant/:checkoutId");
var request = new RestRequest("", Method.Patch);
request.AddHeader("user-agent", "");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/checkout/:tenant/:checkoutId"
req, _ := http.NewRequest("PATCH", url, nil)
req.Header.Add("user-agent", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/checkout/:tenant/:checkoutId HTTP/1.1
User-Agent:
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/checkout/:tenant/:checkoutId")
.setHeader("user-agent", "")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/checkout/:tenant/:checkoutId"))
.header("user-agent", "")
.method("PATCH", 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}}/checkout/:tenant/:checkoutId")
.patch(null)
.addHeader("user-agent", "")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/checkout/:tenant/:checkoutId")
.header("user-agent", "")
.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('PATCH', '{{baseUrl}}/checkout/:tenant/:checkoutId');
xhr.setRequestHeader('user-agent', '');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/checkout/:tenant/:checkoutId',
headers: {'user-agent': ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/checkout/:tenant/:checkoutId';
const options = {method: 'PATCH', headers: {'user-agent': ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/checkout/:tenant/:checkoutId',
method: 'PATCH',
headers: {
'user-agent': ''
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/checkout/:tenant/:checkoutId")
.patch(null)
.addHeader("user-agent", "")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/checkout/:tenant/:checkoutId',
headers: {
'user-agent': ''
}
};
const req = http.request(options, function (res) {
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: 'PATCH',
url: '{{baseUrl}}/checkout/:tenant/:checkoutId',
headers: {'user-agent': ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/checkout/:tenant/:checkoutId');
req.headers({
'user-agent': ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/checkout/:tenant/:checkoutId',
headers: {'user-agent': ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/checkout/:tenant/:checkoutId';
const options = {method: 'PATCH', headers: {'user-agent': ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"user-agent": @"" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/checkout/:tenant/:checkoutId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/checkout/:tenant/:checkoutId" in
let headers = Header.add (Header.init ()) "user-agent" "" in
Client.call ~headers `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/checkout/:tenant/:checkoutId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"user-agent: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/checkout/:tenant/:checkoutId', [
'headers' => [
'user-agent' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/checkout/:tenant/:checkoutId');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'user-agent' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/checkout/:tenant/:checkoutId');
$request->setRequestMethod('PATCH');
$request->setHeaders([
'user-agent' => ''
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("user-agent", "")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/checkout/:tenant/:checkoutId' -Method PATCH -Headers $headers
$headers=@{}
$headers.Add("user-agent", "")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/checkout/:tenant/:checkoutId' -Method PATCH -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'user-agent': "" }
conn.request("PATCH", "/baseUrl/checkout/:tenant/:checkoutId", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/checkout/:tenant/:checkoutId"
headers = {"user-agent": ""}
response = requests.patch(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/checkout/:tenant/:checkoutId"
response <- VERB("PATCH", url, add_headers('user-agent' = ''), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/checkout/:tenant/:checkoutId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["user-agent"] = ''
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.patch('/baseUrl/checkout/:tenant/:checkoutId') do |req|
req.headers['user-agent'] = ''
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/checkout/:tenant/:checkoutId";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("user-agent", "".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/checkout/:tenant/:checkoutId \
--header 'user-agent: '
http PATCH {{baseUrl}}/checkout/:tenant/:checkoutId \
user-agent:''
wget --quiet \
--method PATCH \
--header 'user-agent: ' \
--output-document \
- {{baseUrl}}/checkout/:tenant/:checkoutId
import Foundation
let headers = ["user-agent": ""]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/checkout/:tenant/:checkoutId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as 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
{
"isFulfillable": true,
"issues": [
{
"code": "RESTAURANT_NOT_TAKING_ORDERS"
},
{
"additionalSpendRequired": 100,
"code": "MINIMUM_ORDER_VALUE_NOT_MET",
"currency": "GBP",
"minimumOrderValue": 1000
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "The tenant is invalid",
"errorCode": "TENANT_INVALID"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Authentication required to access this resource"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Access to the resource is forbidden"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "The tenant is not supported",
"errorCode": "TENANT_NOT_SUPPORTED"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "The checkout is in an invalid state",
"errorCode": "CHECKOUT_INVALID"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Couldn't complete request"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"fault": {
"errors": [
{
"description": "Couldn't complete request"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
}
POST
late order compensation query, restaurant response required
{{baseUrl}}/late-order-compensation-query
BODY json
{
"compensationOptions": [
{
"amount": "",
"isRecommended": false
}
],
"orderId": "",
"restaurantId": "",
"tenant": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/late-order-compensation-query");
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 \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/late-order-compensation-query" {:content-type :json
:form-params {:CompensationOptions [{:Amount 200
:IsRecommended false} {:Amount 300
:IsRecommended true} {:Amount 400
:IsRecommended false}]
:OrderId "wiej234idf09i29jijgf4"
:RestaurantId "110230"
:Tenant "uk"}})
require "http/client"
url = "{{baseUrl}}/late-order-compensation-query"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\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}}/late-order-compensation-query"),
Content = new StringContent("{\n \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\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}}/late-order-compensation-query");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/late-order-compensation-query"
payload := strings.NewReader("{\n \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\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/late-order-compensation-query HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 305
{
"CompensationOptions": [
{
"Amount": 200,
"IsRecommended": false
},
{
"Amount": 300,
"IsRecommended": true
},
{
"Amount": 400,
"IsRecommended": false
}
],
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/late-order-compensation-query")
.setHeader("content-type", "application/json")
.setBody("{\n \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/late-order-compensation-query"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\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 \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/late-order-compensation-query")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/late-order-compensation-query")
.header("content-type", "application/json")
.body("{\n \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}")
.asString();
const data = JSON.stringify({
CompensationOptions: [
{
Amount: 200,
IsRecommended: false
},
{
Amount: 300,
IsRecommended: true
},
{
Amount: 400,
IsRecommended: false
}
],
OrderId: 'wiej234idf09i29jijgf4',
RestaurantId: '110230',
Tenant: 'uk'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/late-order-compensation-query');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/late-order-compensation-query',
headers: {'content-type': 'application/json'},
data: {
CompensationOptions: [
{Amount: 200, IsRecommended: false},
{Amount: 300, IsRecommended: true},
{Amount: 400, IsRecommended: false}
],
OrderId: 'wiej234idf09i29jijgf4',
RestaurantId: '110230',
Tenant: 'uk'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/late-order-compensation-query';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"CompensationOptions":[{"Amount":200,"IsRecommended":false},{"Amount":300,"IsRecommended":true},{"Amount":400,"IsRecommended":false}],"OrderId":"wiej234idf09i29jijgf4","RestaurantId":"110230","Tenant":"uk"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/late-order-compensation-query',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "CompensationOptions": [\n {\n "Amount": 200,\n "IsRecommended": false\n },\n {\n "Amount": 300,\n "IsRecommended": true\n },\n {\n "Amount": 400,\n "IsRecommended": false\n }\n ],\n "OrderId": "wiej234idf09i29jijgf4",\n "RestaurantId": "110230",\n "Tenant": "uk"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/late-order-compensation-query")
.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/late-order-compensation-query',
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({
CompensationOptions: [
{Amount: 200, IsRecommended: false},
{Amount: 300, IsRecommended: true},
{Amount: 400, IsRecommended: false}
],
OrderId: 'wiej234idf09i29jijgf4',
RestaurantId: '110230',
Tenant: 'uk'
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/late-order-compensation-query',
headers: {'content-type': 'application/json'},
body: {
CompensationOptions: [
{Amount: 200, IsRecommended: false},
{Amount: 300, IsRecommended: true},
{Amount: 400, IsRecommended: false}
],
OrderId: 'wiej234idf09i29jijgf4',
RestaurantId: '110230',
Tenant: 'uk'
},
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}}/late-order-compensation-query');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
CompensationOptions: [
{
Amount: 200,
IsRecommended: false
},
{
Amount: 300,
IsRecommended: true
},
{
Amount: 400,
IsRecommended: false
}
],
OrderId: 'wiej234idf09i29jijgf4',
RestaurantId: '110230',
Tenant: 'uk'
});
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}}/late-order-compensation-query',
headers: {'content-type': 'application/json'},
data: {
CompensationOptions: [
{Amount: 200, IsRecommended: false},
{Amount: 300, IsRecommended: true},
{Amount: 400, IsRecommended: false}
],
OrderId: 'wiej234idf09i29jijgf4',
RestaurantId: '110230',
Tenant: 'uk'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/late-order-compensation-query';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"CompensationOptions":[{"Amount":200,"IsRecommended":false},{"Amount":300,"IsRecommended":true},{"Amount":400,"IsRecommended":false}],"OrderId":"wiej234idf09i29jijgf4","RestaurantId":"110230","Tenant":"uk"}'
};
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 = @{ @"CompensationOptions": @[ @{ @"Amount": @200, @"IsRecommended": @NO }, @{ @"Amount": @300, @"IsRecommended": @YES }, @{ @"Amount": @400, @"IsRecommended": @NO } ],
@"OrderId": @"wiej234idf09i29jijgf4",
@"RestaurantId": @"110230",
@"Tenant": @"uk" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/late-order-compensation-query"]
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}}/late-order-compensation-query" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/late-order-compensation-query",
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([
'CompensationOptions' => [
[
'Amount' => 200,
'IsRecommended' => null
],
[
'Amount' => 300,
'IsRecommended' => null
],
[
'Amount' => 400,
'IsRecommended' => null
]
],
'OrderId' => 'wiej234idf09i29jijgf4',
'RestaurantId' => '110230',
'Tenant' => 'uk'
]),
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}}/late-order-compensation-query', [
'body' => '{
"CompensationOptions": [
{
"Amount": 200,
"IsRecommended": false
},
{
"Amount": 300,
"IsRecommended": true
},
{
"Amount": 400,
"IsRecommended": false
}
],
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/late-order-compensation-query');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'CompensationOptions' => [
[
'Amount' => 200,
'IsRecommended' => null
],
[
'Amount' => 300,
'IsRecommended' => null
],
[
'Amount' => 400,
'IsRecommended' => null
]
],
'OrderId' => 'wiej234idf09i29jijgf4',
'RestaurantId' => '110230',
'Tenant' => 'uk'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'CompensationOptions' => [
[
'Amount' => 200,
'IsRecommended' => null
],
[
'Amount' => 300,
'IsRecommended' => null
],
[
'Amount' => 400,
'IsRecommended' => null
]
],
'OrderId' => 'wiej234idf09i29jijgf4',
'RestaurantId' => '110230',
'Tenant' => 'uk'
]));
$request->setRequestUrl('{{baseUrl}}/late-order-compensation-query');
$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}}/late-order-compensation-query' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CompensationOptions": [
{
"Amount": 200,
"IsRecommended": false
},
{
"Amount": 300,
"IsRecommended": true
},
{
"Amount": 400,
"IsRecommended": false
}
],
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/late-order-compensation-query' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CompensationOptions": [
{
"Amount": 200,
"IsRecommended": false
},
{
"Amount": 300,
"IsRecommended": true
},
{
"Amount": 400,
"IsRecommended": false
}
],
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/late-order-compensation-query", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/late-order-compensation-query"
payload = {
"CompensationOptions": [
{
"Amount": 200,
"IsRecommended": False
},
{
"Amount": 300,
"IsRecommended": True
},
{
"Amount": 400,
"IsRecommended": False
}
],
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/late-order-compensation-query"
payload <- "{\n \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\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}}/late-order-compensation-query")
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 \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\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/late-order-compensation-query') do |req|
req.body = "{\n \"CompensationOptions\": [\n {\n \"Amount\": 200,\n \"IsRecommended\": false\n },\n {\n \"Amount\": 300,\n \"IsRecommended\": true\n },\n {\n \"Amount\": 400,\n \"IsRecommended\": false\n }\n ],\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/late-order-compensation-query";
let payload = json!({
"CompensationOptions": (
json!({
"Amount": 200,
"IsRecommended": false
}),
json!({
"Amount": 300,
"IsRecommended": true
}),
json!({
"Amount": 400,
"IsRecommended": false
})
),
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
});
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}}/late-order-compensation-query \
--header 'content-type: application/json' \
--data '{
"CompensationOptions": [
{
"Amount": 200,
"IsRecommended": false
},
{
"Amount": 300,
"IsRecommended": true
},
{
"Amount": 400,
"IsRecommended": false
}
],
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}'
echo '{
"CompensationOptions": [
{
"Amount": 200,
"IsRecommended": false
},
{
"Amount": 300,
"IsRecommended": true
},
{
"Amount": 400,
"IsRecommended": false
}
],
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}' | \
http POST {{baseUrl}}/late-order-compensation-query \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "CompensationOptions": [\n {\n "Amount": 200,\n "IsRecommended": false\n },\n {\n "Amount": 300,\n "IsRecommended": true\n },\n {\n "Amount": 400,\n "IsRecommended": false\n }\n ],\n "OrderId": "wiej234idf09i29jijgf4",\n "RestaurantId": "110230",\n "Tenant": "uk"\n}' \
--output-document \
- {{baseUrl}}/late-order-compensation-query
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"CompensationOptions": [
[
"Amount": 200,
"IsRecommended": false
],
[
"Amount": 300,
"IsRecommended": true
],
[
"Amount": 400,
"IsRecommended": false
]
],
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/late-order-compensation-query")! 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
late order query, restaurant response required
{{baseUrl}}/late-order-query
BODY json
{
"orderId": "",
"restaurantId": "",
"tenant": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/late-order-query");
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 \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/late-order-query" {:content-type :json
:form-params {:OrderId "wiej234idf09i29jijgf4"
:RestaurantId "110230"
:Tenant "uk"}})
require "http/client"
url = "{{baseUrl}}/late-order-query"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\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}}/late-order-query"),
Content = new StringContent("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\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}}/late-order-query");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/late-order-query"
payload := strings.NewReader("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\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/late-order-query HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 86
{
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/late-order-query")
.setHeader("content-type", "application/json")
.setBody("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/late-order-query"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\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 \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/late-order-query")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/late-order-query")
.header("content-type", "application/json")
.body("{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}")
.asString();
const data = JSON.stringify({
OrderId: 'wiej234idf09i29jijgf4',
RestaurantId: '110230',
Tenant: 'uk'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/late-order-query');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/late-order-query',
headers: {'content-type': 'application/json'},
data: {OrderId: 'wiej234idf09i29jijgf4', RestaurantId: '110230', Tenant: 'uk'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/late-order-query';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"OrderId":"wiej234idf09i29jijgf4","RestaurantId":"110230","Tenant":"uk"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/late-order-query',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "OrderId": "wiej234idf09i29jijgf4",\n "RestaurantId": "110230",\n "Tenant": "uk"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/late-order-query")
.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/late-order-query',
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({OrderId: 'wiej234idf09i29jijgf4', RestaurantId: '110230', Tenant: 'uk'}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/late-order-query',
headers: {'content-type': 'application/json'},
body: {OrderId: 'wiej234idf09i29jijgf4', RestaurantId: '110230', Tenant: 'uk'},
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}}/late-order-query');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
OrderId: 'wiej234idf09i29jijgf4',
RestaurantId: '110230',
Tenant: 'uk'
});
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}}/late-order-query',
headers: {'content-type': 'application/json'},
data: {OrderId: 'wiej234idf09i29jijgf4', RestaurantId: '110230', Tenant: 'uk'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/late-order-query';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"OrderId":"wiej234idf09i29jijgf4","RestaurantId":"110230","Tenant":"uk"}'
};
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 = @{ @"OrderId": @"wiej234idf09i29jijgf4",
@"RestaurantId": @"110230",
@"Tenant": @"uk" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/late-order-query"]
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}}/late-order-query" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/late-order-query",
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([
'OrderId' => 'wiej234idf09i29jijgf4',
'RestaurantId' => '110230',
'Tenant' => 'uk'
]),
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}}/late-order-query', [
'body' => '{
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/late-order-query');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'OrderId' => 'wiej234idf09i29jijgf4',
'RestaurantId' => '110230',
'Tenant' => 'uk'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'OrderId' => 'wiej234idf09i29jijgf4',
'RestaurantId' => '110230',
'Tenant' => 'uk'
]));
$request->setRequestUrl('{{baseUrl}}/late-order-query');
$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}}/late-order-query' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/late-order-query' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/late-order-query", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/late-order-query"
payload = {
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/late-order-query"
payload <- "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\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}}/late-order-query")
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 \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\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/late-order-query') do |req|
req.body = "{\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"RestaurantId\": \"110230\",\n \"Tenant\": \"uk\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/late-order-query";
let payload = json!({
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
});
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}}/late-order-query \
--header 'content-type: application/json' \
--data '{
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}'
echo '{
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
}' | \
http POST {{baseUrl}}/late-order-query \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "OrderId": "wiej234idf09i29jijgf4",\n "RestaurantId": "110230",\n "Tenant": "uk"\n}' \
--output-document \
- {{baseUrl}}/late-order-query
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"OrderId": "wiej234idf09i29jijgf4",
"RestaurantId": "110230",
"Tenant": "uk"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/late-order-query")! 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
Response to Late Order Update Request
{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse
HEADERS
Authorization
QUERY PARAMS
tenant
orderId
BODY json
{
"additionalDeliveryTimeToAddMinutes": 0,
"lateOrderStatus": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse" {:headers {:authorization ""}
:content-type :json
:form-params {:additionalDeliveryTimeToAddMinutes 0
:lateOrderStatus ""}})
require "http/client"
url = "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse"
headers = HTTP::Headers{
"authorization" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\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/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse"),
Headers =
{
{ "authorization", "" },
},
Content = new StringContent("{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\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/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse");
var request = new RestRequest("", Method.Post);
request.AddHeader("authorization", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse"
payload := strings.NewReader("{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "")
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/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse HTTP/1.1
Authorization:
Content-Type: application/json
Host: example.com
Content-Length: 70
{
"additionalDeliveryTimeToAddMinutes": 0,
"lateOrderStatus": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse")
.setHeader("authorization", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse"))
.header("authorization", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\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 \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse")
.post(body)
.addHeader("authorization", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse")
.header("authorization", "")
.header("content-type", "application/json")
.body("{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\n}")
.asString();
const data = JSON.stringify({
additionalDeliveryTimeToAddMinutes: 0,
lateOrderStatus: ''
});
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/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse');
xhr.setRequestHeader('authorization', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse',
headers: {authorization: '', 'content-type': 'application/json'},
data: {additionalDeliveryTimeToAddMinutes: 0, lateOrderStatus: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse';
const options = {
method: 'POST',
headers: {authorization: '', 'content-type': 'application/json'},
body: '{"additionalDeliveryTimeToAddMinutes":0,"lateOrderStatus":""}'
};
try {
const response = await 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/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse',
method: 'POST',
headers: {
authorization: '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "additionalDeliveryTimeToAddMinutes": 0,\n "lateOrderStatus": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse")
.post(body)
.addHeader("authorization", "")
.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/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse',
headers: {
authorization: '',
'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({additionalDeliveryTimeToAddMinutes: 0, lateOrderStatus: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse',
headers: {authorization: '', 'content-type': 'application/json'},
body: {additionalDeliveryTimeToAddMinutes: 0, lateOrderStatus: ''},
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/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse');
req.headers({
authorization: '',
'content-type': 'application/json'
});
req.type('json');
req.send({
additionalDeliveryTimeToAddMinutes: 0,
lateOrderStatus: ''
});
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/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse',
headers: {authorization: '', 'content-type': 'application/json'},
data: {additionalDeliveryTimeToAddMinutes: 0, lateOrderStatus: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse';
const options = {
method: 'POST',
headers: {authorization: '', 'content-type': 'application/json'},
body: '{"additionalDeliveryTimeToAddMinutes":0,"lateOrderStatus":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"authorization": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"additionalDeliveryTimeToAddMinutes": @0,
@"lateOrderStatus": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse"]
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/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse" in
let headers = Header.add_list (Header.init ()) [
("authorization", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse",
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([
'additionalDeliveryTimeToAddMinutes' => 0,
'lateOrderStatus' => ''
]),
CURLOPT_HTTPHEADER => [
"authorization: ",
"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/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse', [
'body' => '{
"additionalDeliveryTimeToAddMinutes": 0,
"lateOrderStatus": ""
}',
'headers' => [
'authorization' => '',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'authorization' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'additionalDeliveryTimeToAddMinutes' => 0,
'lateOrderStatus' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'additionalDeliveryTimeToAddMinutes' => 0,
'lateOrderStatus' => ''
]));
$request->setRequestUrl('{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'authorization' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("authorization", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additionalDeliveryTimeToAddMinutes": 0,
"lateOrderStatus": ""
}'
$headers=@{}
$headers.Add("authorization", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"additionalDeliveryTimeToAddMinutes": 0,
"lateOrderStatus": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\n}"
headers = {
'authorization': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse"
payload = {
"additionalDeliveryTimeToAddMinutes": 0,
"lateOrderStatus": ""
}
headers = {
"authorization": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse"
payload <- "{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('authorization' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\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/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse') do |req|
req.headers['authorization'] = ''
req.body = "{\n \"additionalDeliveryTimeToAddMinutes\": 0,\n \"lateOrderStatus\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse";
let payload = json!({
"additionalDeliveryTimeToAddMinutes": 0,
"lateOrderStatus": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("authorization", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse \
--header 'authorization: ' \
--header 'content-type: application/json' \
--data '{
"additionalDeliveryTimeToAddMinutes": 0,
"lateOrderStatus": ""
}'
echo '{
"additionalDeliveryTimeToAddMinutes": 0,
"lateOrderStatus": ""
}' | \
http POST {{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse \
authorization:'' \
content-type:application/json
wget --quiet \
--method POST \
--header 'authorization: ' \
--header 'content-type: application/json' \
--body-data '{\n "additionalDeliveryTimeToAddMinutes": 0,\n "lateOrderStatus": ""\n}' \
--output-document \
- {{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse
import Foundation
let headers = [
"authorization": "",
"content-type": "application/json"
]
let parameters = [
"additionalDeliveryTimeToAddMinutes": 0,
"lateOrderStatus": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateorder/restaurantresponse")! 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
{
"errors": [
{
"description": "Justification notes are required for this query. Query Type:type Tenant:tenant QueryId:queryId OrderId:orderId",
"errorCode": "BadRequest"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Unauthorized.",
"errorCode": "Unauthorized"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Order 1234 was not found",
"errorCode": "NotFound"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Query 1234 cannot be responded to at this time",
"errorCode": "Conflict"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
POST
Update late order compensation request with Restaurant response
{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse
HEADERS
Authorization
QUERY PARAMS
tenant
orderId
BODY json
{
"acceptedAmount": 0,
"isAccepted": false,
"orderId": "",
"rejectedReasonCode": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse" {:headers {:authorization ""}
:content-type :json
:form-params {:acceptedAmount 0
:isAccepted false
:orderId ""
:rejectedReasonCode ""}})
require "http/client"
url = "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse"
headers = HTTP::Headers{
"authorization" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\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/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse"),
Headers =
{
{ "authorization", "" },
},
Content = new StringContent("{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\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/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse");
var request = new RestRequest("", Method.Post);
request.AddHeader("authorization", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse"
payload := strings.NewReader("{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "")
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/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse HTTP/1.1
Authorization:
Content-Type: application/json
Host: example.com
Content-Length: 93
{
"acceptedAmount": 0,
"isAccepted": false,
"orderId": "",
"rejectedReasonCode": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse")
.setHeader("authorization", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse"))
.header("authorization", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\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 \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse")
.post(body)
.addHeader("authorization", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse")
.header("authorization", "")
.header("content-type", "application/json")
.body("{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\n}")
.asString();
const data = JSON.stringify({
acceptedAmount: 0,
isAccepted: false,
orderId: '',
rejectedReasonCode: ''
});
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/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse');
xhr.setRequestHeader('authorization', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse',
headers: {authorization: '', 'content-type': 'application/json'},
data: {acceptedAmount: 0, isAccepted: false, orderId: '', rejectedReasonCode: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse';
const options = {
method: 'POST',
headers: {authorization: '', 'content-type': 'application/json'},
body: '{"acceptedAmount":0,"isAccepted":false,"orderId":"","rejectedReasonCode":""}'
};
try {
const response = await 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/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse',
method: 'POST',
headers: {
authorization: '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "acceptedAmount": 0,\n "isAccepted": false,\n "orderId": "",\n "rejectedReasonCode": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse")
.post(body)
.addHeader("authorization", "")
.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/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse',
headers: {
authorization: '',
'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({acceptedAmount: 0, isAccepted: false, orderId: '', rejectedReasonCode: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse',
headers: {authorization: '', 'content-type': 'application/json'},
body: {acceptedAmount: 0, isAccepted: false, orderId: '', rejectedReasonCode: ''},
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/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse');
req.headers({
authorization: '',
'content-type': 'application/json'
});
req.type('json');
req.send({
acceptedAmount: 0,
isAccepted: false,
orderId: '',
rejectedReasonCode: ''
});
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/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse',
headers: {authorization: '', 'content-type': 'application/json'},
data: {acceptedAmount: 0, isAccepted: false, orderId: '', rejectedReasonCode: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse';
const options = {
method: 'POST',
headers: {authorization: '', 'content-type': 'application/json'},
body: '{"acceptedAmount":0,"isAccepted":false,"orderId":"","rejectedReasonCode":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"authorization": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"acceptedAmount": @0,
@"isAccepted": @NO,
@"orderId": @"",
@"rejectedReasonCode": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse"]
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/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse" in
let headers = Header.add_list (Header.init ()) [
("authorization", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse",
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([
'acceptedAmount' => 0,
'isAccepted' => null,
'orderId' => '',
'rejectedReasonCode' => ''
]),
CURLOPT_HTTPHEADER => [
"authorization: ",
"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/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse', [
'body' => '{
"acceptedAmount": 0,
"isAccepted": false,
"orderId": "",
"rejectedReasonCode": ""
}',
'headers' => [
'authorization' => '',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'authorization' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'acceptedAmount' => 0,
'isAccepted' => null,
'orderId' => '',
'rejectedReasonCode' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'acceptedAmount' => 0,
'isAccepted' => null,
'orderId' => '',
'rejectedReasonCode' => ''
]));
$request->setRequestUrl('{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'authorization' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("authorization", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"acceptedAmount": 0,
"isAccepted": false,
"orderId": "",
"rejectedReasonCode": ""
}'
$headers=@{}
$headers.Add("authorization", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"acceptedAmount": 0,
"isAccepted": false,
"orderId": "",
"rejectedReasonCode": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\n}"
headers = {
'authorization': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse"
payload = {
"acceptedAmount": 0,
"isAccepted": False,
"orderId": "",
"rejectedReasonCode": ""
}
headers = {
"authorization": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse"
payload <- "{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('authorization' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\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/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse') do |req|
req.headers['authorization'] = ''
req.body = "{\n \"acceptedAmount\": 0,\n \"isAccepted\": false,\n \"orderId\": \"\",\n \"rejectedReasonCode\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse";
let payload = json!({
"acceptedAmount": 0,
"isAccepted": false,
"orderId": "",
"rejectedReasonCode": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("authorization", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse \
--header 'authorization: ' \
--header 'content-type: application/json' \
--data '{
"acceptedAmount": 0,
"isAccepted": false,
"orderId": "",
"rejectedReasonCode": ""
}'
echo '{
"acceptedAmount": 0,
"isAccepted": false,
"orderId": "",
"rejectedReasonCode": ""
}' | \
http POST {{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse \
authorization:'' \
content-type:application/json
wget --quiet \
--method POST \
--header 'authorization: ' \
--header 'content-type: application/json' \
--body-data '{\n "acceptedAmount": 0,\n "isAccepted": false,\n "orderId": "",\n "rejectedReasonCode": ""\n}' \
--output-document \
- {{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse
import Foundation
let headers = [
"authorization": "",
"content-type": "application/json"
]
let parameters = [
"acceptedAmount": 0,
"isAccepted": false,
"orderId": "",
"rejectedReasonCode": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:tenant/:orderId/consumerqueries/lateordercompensation/restaurantresponse")! 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
{
"errors": [
{
"description": "A reason is required when compensation is rejected.",
"errorCode": "BadRequest"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Unauthorized.",
"errorCode": "Unauthorized"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Order 1234 was not found",
"errorCode": "NotFound"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Query 1234 cannot be responded to at this time",
"errorCode": "Conflict"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
POST
Create consumer
{{baseUrl}}/consumers/:tenant
QUERY PARAMS
tenant
BODY json
{
"emailAddress": "",
"firstName": "",
"lastName": "",
"marketingPreferences": [
{
"channelName": "",
"dateUpdated": "",
"isSubscribed": false
}
],
"password": "",
"registrationSource": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/consumers/:tenant");
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 \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/consumers/:tenant" {:content-type :json
:form-params {:emailAddress ""
:firstName ""
:lastName ""
:marketingPreferences [{:channelName ""
:dateUpdated ""
:isSubscribed false}]
:password ""
:registrationSource ""}})
require "http/client"
url = "{{baseUrl}}/consumers/:tenant"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\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}}/consumers/:tenant"),
Content = new StringContent("{\n \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\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}}/consumers/:tenant");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/consumers/:tenant"
payload := strings.NewReader("{\n \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\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/consumers/:tenant HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 230
{
"emailAddress": "",
"firstName": "",
"lastName": "",
"marketingPreferences": [
{
"channelName": "",
"dateUpdated": "",
"isSubscribed": false
}
],
"password": "",
"registrationSource": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/consumers/:tenant")
.setHeader("content-type", "application/json")
.setBody("{\n \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/consumers/:tenant"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\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 \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/consumers/:tenant")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/consumers/:tenant")
.header("content-type", "application/json")
.body("{\n \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\n}")
.asString();
const data = JSON.stringify({
emailAddress: '',
firstName: '',
lastName: '',
marketingPreferences: [
{
channelName: '',
dateUpdated: '',
isSubscribed: false
}
],
password: '',
registrationSource: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/consumers/:tenant');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/consumers/:tenant',
headers: {'content-type': 'application/json'},
data: {
emailAddress: '',
firstName: '',
lastName: '',
marketingPreferences: [{channelName: '', dateUpdated: '', isSubscribed: false}],
password: '',
registrationSource: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/consumers/:tenant';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"emailAddress":"","firstName":"","lastName":"","marketingPreferences":[{"channelName":"","dateUpdated":"","isSubscribed":false}],"password":"","registrationSource":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/consumers/:tenant',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "emailAddress": "",\n "firstName": "",\n "lastName": "",\n "marketingPreferences": [\n {\n "channelName": "",\n "dateUpdated": "",\n "isSubscribed": false\n }\n ],\n "password": "",\n "registrationSource": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/consumers/:tenant")
.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/consumers/:tenant',
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({
emailAddress: '',
firstName: '',
lastName: '',
marketingPreferences: [{channelName: '', dateUpdated: '', isSubscribed: false}],
password: '',
registrationSource: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/consumers/:tenant',
headers: {'content-type': 'application/json'},
body: {
emailAddress: '',
firstName: '',
lastName: '',
marketingPreferences: [{channelName: '', dateUpdated: '', isSubscribed: false}],
password: '',
registrationSource: ''
},
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}}/consumers/:tenant');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
emailAddress: '',
firstName: '',
lastName: '',
marketingPreferences: [
{
channelName: '',
dateUpdated: '',
isSubscribed: false
}
],
password: '',
registrationSource: ''
});
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}}/consumers/:tenant',
headers: {'content-type': 'application/json'},
data: {
emailAddress: '',
firstName: '',
lastName: '',
marketingPreferences: [{channelName: '', dateUpdated: '', isSubscribed: false}],
password: '',
registrationSource: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/consumers/:tenant';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"emailAddress":"","firstName":"","lastName":"","marketingPreferences":[{"channelName":"","dateUpdated":"","isSubscribed":false}],"password":"","registrationSource":""}'
};
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 = @{ @"emailAddress": @"",
@"firstName": @"",
@"lastName": @"",
@"marketingPreferences": @[ @{ @"channelName": @"", @"dateUpdated": @"", @"isSubscribed": @NO } ],
@"password": @"",
@"registrationSource": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/consumers/:tenant"]
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}}/consumers/:tenant" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/consumers/:tenant",
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([
'emailAddress' => '',
'firstName' => '',
'lastName' => '',
'marketingPreferences' => [
[
'channelName' => '',
'dateUpdated' => '',
'isSubscribed' => null
]
],
'password' => '',
'registrationSource' => ''
]),
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}}/consumers/:tenant', [
'body' => '{
"emailAddress": "",
"firstName": "",
"lastName": "",
"marketingPreferences": [
{
"channelName": "",
"dateUpdated": "",
"isSubscribed": false
}
],
"password": "",
"registrationSource": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/consumers/:tenant');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'emailAddress' => '',
'firstName' => '',
'lastName' => '',
'marketingPreferences' => [
[
'channelName' => '',
'dateUpdated' => '',
'isSubscribed' => null
]
],
'password' => '',
'registrationSource' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'emailAddress' => '',
'firstName' => '',
'lastName' => '',
'marketingPreferences' => [
[
'channelName' => '',
'dateUpdated' => '',
'isSubscribed' => null
]
],
'password' => '',
'registrationSource' => ''
]));
$request->setRequestUrl('{{baseUrl}}/consumers/:tenant');
$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}}/consumers/:tenant' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"emailAddress": "",
"firstName": "",
"lastName": "",
"marketingPreferences": [
{
"channelName": "",
"dateUpdated": "",
"isSubscribed": false
}
],
"password": "",
"registrationSource": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/consumers/:tenant' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"emailAddress": "",
"firstName": "",
"lastName": "",
"marketingPreferences": [
{
"channelName": "",
"dateUpdated": "",
"isSubscribed": false
}
],
"password": "",
"registrationSource": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/consumers/:tenant", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/consumers/:tenant"
payload = {
"emailAddress": "",
"firstName": "",
"lastName": "",
"marketingPreferences": [
{
"channelName": "",
"dateUpdated": "",
"isSubscribed": False
}
],
"password": "",
"registrationSource": ""
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/consumers/:tenant"
payload <- "{\n \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\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}}/consumers/:tenant")
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 \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\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/consumers/:tenant') do |req|
req.body = "{\n \"emailAddress\": \"\",\n \"firstName\": \"\",\n \"lastName\": \"\",\n \"marketingPreferences\": [\n {\n \"channelName\": \"\",\n \"dateUpdated\": \"\",\n \"isSubscribed\": false\n }\n ],\n \"password\": \"\",\n \"registrationSource\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/consumers/:tenant";
let payload = json!({
"emailAddress": "",
"firstName": "",
"lastName": "",
"marketingPreferences": (
json!({
"channelName": "",
"dateUpdated": "",
"isSubscribed": false
})
),
"password": "",
"registrationSource": ""
});
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}}/consumers/:tenant \
--header 'content-type: application/json' \
--data '{
"emailAddress": "",
"firstName": "",
"lastName": "",
"marketingPreferences": [
{
"channelName": "",
"dateUpdated": "",
"isSubscribed": false
}
],
"password": "",
"registrationSource": ""
}'
echo '{
"emailAddress": "",
"firstName": "",
"lastName": "",
"marketingPreferences": [
{
"channelName": "",
"dateUpdated": "",
"isSubscribed": false
}
],
"password": "",
"registrationSource": ""
}' | \
http POST {{baseUrl}}/consumers/:tenant \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "emailAddress": "",\n "firstName": "",\n "lastName": "",\n "marketingPreferences": [\n {\n "channelName": "",\n "dateUpdated": "",\n "isSubscribed": false\n }\n ],\n "password": "",\n "registrationSource": ""\n}' \
--output-document \
- {{baseUrl}}/consumers/:tenant
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"emailAddress": "",
"firstName": "",
"lastName": "",
"marketingPreferences": [
[
"channelName": "",
"dateUpdated": "",
"isSubscribed": false
]
],
"password": "",
"registrationSource": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/consumers/:tenant")! 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
{
"token": "SKgaDl0wZxnwjNgLxBnU646PDTquWLHOyPuyzidIZIg=",
"type": "otac"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Email is required.",
"errorCode": "BadRequest"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Not authorized to do this.",
"errorCode": "Forbidden"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Tenant not found",
"errorCode": "TenantNotFound"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "The specified email already exists",
"errorCode": "Conflict"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
GET
Get channel subscriptions for a given consumer's communication preference type
{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type
QUERY PARAMS
tenant
type
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type")
require "http/client"
url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type"
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}}/consumers/:tenant/me/communication-preferences/:type"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type"
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/consumers/:tenant/me/communication-preferences/:type HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type"))
.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}}/consumers/:tenant/me/communication-preferences/:type")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type")
.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}}/consumers/:tenant/me/communication-preferences/:type');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type';
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}}/consumers/:tenant/me/communication-preferences/:type',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/consumers/:tenant/me/communication-preferences/:type',
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}}/consumers/:tenant/me/communication-preferences/:type'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type';
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}}/consumers/:tenant/me/communication-preferences/:type"]
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}}/consumers/:tenant/me/communication-preferences/:type" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type",
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}}/consumers/:tenant/me/communication-preferences/:type');
echo $response->getBody();
setUrl('{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/consumers/:tenant/me/communication-preferences/:type")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type")
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/consumers/:tenant/me/communication-preferences/:type') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type";
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}}/consumers/:tenant/me/communication-preferences/:type
http GET {{baseUrl}}/consumers/:tenant/me/communication-preferences/:type
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/consumers/:tenant/me/communication-preferences/:type
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type")! 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
{
"isDefault": false,
"subscribedChannels": [
"email",
"sms"
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "You are unauthorized to perform this request.",
"errorCode": "Unauthorized"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "You are forbidden from performing this request.",
"errorCode": "Forbidden"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Tenant could not be found.",
"errorCode": "NotFound"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
GET
Get communication preferences
{{baseUrl}}/consumers/:tenant/me/communication-preferences
QUERY PARAMS
tenant
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/consumers/:tenant/me/communication-preferences");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/consumers/:tenant/me/communication-preferences")
require "http/client"
url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences"
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}}/consumers/:tenant/me/communication-preferences"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/consumers/:tenant/me/communication-preferences");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/consumers/:tenant/me/communication-preferences"
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/consumers/:tenant/me/communication-preferences HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/consumers/:tenant/me/communication-preferences")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/consumers/:tenant/me/communication-preferences"))
.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}}/consumers/:tenant/me/communication-preferences")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/consumers/:tenant/me/communication-preferences")
.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}}/consumers/:tenant/me/communication-preferences');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/consumers/:tenant/me/communication-preferences'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/consumers/:tenant/me/communication-preferences';
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}}/consumers/:tenant/me/communication-preferences',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/consumers/:tenant/me/communication-preferences")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/consumers/:tenant/me/communication-preferences',
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}}/consumers/:tenant/me/communication-preferences'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/consumers/:tenant/me/communication-preferences');
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}}/consumers/:tenant/me/communication-preferences'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/consumers/:tenant/me/communication-preferences';
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}}/consumers/:tenant/me/communication-preferences"]
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}}/consumers/:tenant/me/communication-preferences" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/consumers/:tenant/me/communication-preferences",
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}}/consumers/:tenant/me/communication-preferences');
echo $response->getBody();
setUrl('{{baseUrl}}/consumers/:tenant/me/communication-preferences');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/consumers/:tenant/me/communication-preferences');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/consumers/:tenant/me/communication-preferences' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/consumers/:tenant/me/communication-preferences' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/consumers/:tenant/me/communication-preferences")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/consumers/:tenant/me/communication-preferences"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/consumers/:tenant/me/communication-preferences")
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/consumers/:tenant/me/communication-preferences') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences";
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}}/consumers/:tenant/me/communication-preferences
http GET {{baseUrl}}/consumers/:tenant/me/communication-preferences
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/consumers/:tenant/me/communication-preferences
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/consumers/:tenant/me/communication-preferences")! 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
{
"marketing": {
"isDefault": false,
"subscribedChannels": [
"email",
"sms"
]
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "You are unauthorized to perform this request.",
"errorCode": "Unauthorized"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "You are forbidden from performing this request.",
"errorCode": "Forbidden"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Tenant could not be found.",
"errorCode": "NotFound"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
GET
Get consumers details
{{baseUrl}}/consumers/:tenant
QUERY PARAMS
emailAddress
accountType
count
tenant
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/consumers/:tenant" {:query-params {:emailAddress ""
:accountType ""
:count ""}})
require "http/client"
url = "{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count="
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}}/consumers/:tenant?emailAddress=&accountType=&count="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count="
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/consumers/:tenant?emailAddress=&accountType=&count= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count="))
.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}}/consumers/:tenant?emailAddress=&accountType=&count=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count=")
.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}}/consumers/:tenant?emailAddress=&accountType=&count=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/consumers/:tenant',
params: {emailAddress: '', accountType: '', count: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count=';
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}}/consumers/:tenant?emailAddress=&accountType=&count=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/consumers/:tenant?emailAddress=&accountType=&count=',
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}}/consumers/:tenant',
qs: {emailAddress: '', accountType: '', count: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/consumers/:tenant');
req.query({
emailAddress: '',
accountType: '',
count: ''
});
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}}/consumers/:tenant',
params: {emailAddress: '', accountType: '', count: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count=';
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}}/consumers/:tenant?emailAddress=&accountType=&count="]
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}}/consumers/:tenant?emailAddress=&accountType=&count=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count=",
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}}/consumers/:tenant?emailAddress=&accountType=&count=');
echo $response->getBody();
setUrl('{{baseUrl}}/consumers/:tenant');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'emailAddress' => '',
'accountType' => '',
'count' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/consumers/:tenant');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'emailAddress' => '',
'accountType' => '',
'count' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/consumers/:tenant?emailAddress=&accountType=&count=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/consumers/:tenant"
querystring = {"emailAddress":"","accountType":"","count":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/consumers/:tenant"
queryString <- list(
emailAddress = "",
accountType = "",
count = ""
)
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count=")
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/consumers/:tenant') do |req|
req.params['emailAddress'] = ''
req.params['accountType'] = ''
req.params['count'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/consumers/:tenant";
let querystring = [
("emailAddress", ""),
("accountType", ""),
("count", ""),
];
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}}/consumers/:tenant?emailAddress=&accountType=&count='
http GET '{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/consumers/:tenant?emailAddress=&accountType=&count=")! 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
1
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "The Email is missing or invalid.",
"errorCode": "InvalidEmail"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Tenant not found",
"errorCode": "TenantNotFound"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Non-Count queries have not been implemented",
"errorCode": "NotImplemented"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
DELETE
Remove subscription of a specific communication preference channel
{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel
QUERY PARAMS
tenant
type
channel
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
require "http/client"
url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"
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/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"))
.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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
.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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel';
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel',
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel');
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel';
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"]
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel",
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel');
echo $response->getBody();
setUrl('{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
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/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel";
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel
http DELETE {{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")! 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
{
"errors": [
{
"description": "You are unauthorized to perform this request.",
"errorCode": "Unauthorized"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Tenant could not be found.",
"errorCode": "NotFound"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
PUT
Set only the channel subscriptions for a given consumer's communication preference type
{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type
QUERY PARAMS
tenant
type
BODY json
{
"subscribedChannels": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type");
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 \"subscribedChannels\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type" {:content-type :json
:form-params {:subscribedChannels []}})
require "http/client"
url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"subscribedChannels\": []\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}}/consumers/:tenant/me/communication-preferences/:type"),
Content = new StringContent("{\n \"subscribedChannels\": []\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}}/consumers/:tenant/me/communication-preferences/:type");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"subscribedChannels\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type"
payload := strings.NewReader("{\n \"subscribedChannels\": []\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/consumers/:tenant/me/communication-preferences/:type HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 30
{
"subscribedChannels": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type")
.setHeader("content-type", "application/json")
.setBody("{\n \"subscribedChannels\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"subscribedChannels\": []\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 \"subscribedChannels\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type")
.header("content-type", "application/json")
.body("{\n \"subscribedChannels\": []\n}")
.asString();
const data = JSON.stringify({
subscribedChannels: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type',
headers: {'content-type': 'application/json'},
data: {subscribedChannels: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"subscribedChannels":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "subscribedChannels": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"subscribedChannels\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type")
.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/consumers/:tenant/me/communication-preferences/:type',
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({subscribedChannels: []}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type',
headers: {'content-type': 'application/json'},
body: {subscribedChannels: []},
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}}/consumers/:tenant/me/communication-preferences/:type');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
subscribedChannels: []
});
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}}/consumers/:tenant/me/communication-preferences/:type',
headers: {'content-type': 'application/json'},
data: {subscribedChannels: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"subscribedChannels":[]}'
};
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 = @{ @"subscribedChannels": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type"]
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}}/consumers/:tenant/me/communication-preferences/:type" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"subscribedChannels\": []\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type",
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([
'subscribedChannels' => [
]
]),
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}}/consumers/:tenant/me/communication-preferences/:type', [
'body' => '{
"subscribedChannels": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'subscribedChannels' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'subscribedChannels' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type');
$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}}/consumers/:tenant/me/communication-preferences/:type' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"subscribedChannels": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"subscribedChannels": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"subscribedChannels\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/consumers/:tenant/me/communication-preferences/:type", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type"
payload = { "subscribedChannels": [] }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type"
payload <- "{\n \"subscribedChannels\": []\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}}/consumers/:tenant/me/communication-preferences/:type")
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 \"subscribedChannels\": []\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/consumers/:tenant/me/communication-preferences/:type') do |req|
req.body = "{\n \"subscribedChannels\": []\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}}/consumers/:tenant/me/communication-preferences/:type";
let payload = json!({"subscribedChannels": ()});
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}}/consumers/:tenant/me/communication-preferences/:type \
--header 'content-type: application/json' \
--data '{
"subscribedChannels": []
}'
echo '{
"subscribedChannels": []
}' | \
http PUT {{baseUrl}}/consumers/:tenant/me/communication-preferences/:type \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "subscribedChannels": []\n}' \
--output-document \
- {{baseUrl}}/consumers/:tenant/me/communication-preferences/:type
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["subscribedChannels": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "You are unauthorized to perform this request.",
"errorCode": "Unauthorized"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Tenant could not be found.",
"errorCode": "NotFound"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
POST
Subscribe to a specific communication preference channel
{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel
QUERY PARAMS
tenant
type
channel
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
require "http/client"
url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"
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/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"))
.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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
.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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel';
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel',
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel');
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel';
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"]
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel",
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel');
echo $response->getBody();
setUrl('{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")
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/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel";
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}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel
http POST {{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/consumers/:tenant/me/communication-preferences/:type/subscribedChannels/:channel")! 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
{
"errors": [
{
"description": "You are unauthorized to perform this request.",
"errorCode": "Unauthorized"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "You are forbidden from performing this request.",
"errorCode": "Forbidden"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Tenant could not be found.",
"errorCode": "NotFound"
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
PUT
Add restaurants to an existing delivery pool
{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")
require "http/client"
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"
response = HTTP::Client.put url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants");
var request = new RestRequest("", Method.Put);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/delivery/pools/:deliveryPoolId/restaurants HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"))
.method("PUT", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")
.put(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants';
const options = {method: 'PUT'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants',
method: 'PUT',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")
.put(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/delivery/pools/:deliveryPoolId/restaurants',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants');
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}}/delivery/pools/:deliveryPoolId/restaurants'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants';
const options = {method: 'PUT'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants" in
Client.call `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants');
echo $response->getBody();
setUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants');
$request->setRequestMethod('PUT');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants' -Method PUT
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants' -Method PUT
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("PUT", "/baseUrl/delivery/pools/:deliveryPoolId/restaurants")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"
response = requests.put(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"
response <- VERB("PUT", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.put('/baseUrl/delivery/pools/:deliveryPoolId/restaurants') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants
http PUT {{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants
wget --quiet \
--method PUT \
--output-document \
- {{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"restaurants": [
123,
456
]
}
POST
Create a new delivery pool
{{baseUrl}}/delivery/pools
BODY json
{
"name": "",
"restaurants": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery/pools");
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 \"name\": \"\",\n \"restaurants\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/delivery/pools" {:content-type :json
:form-params {:name ""
:restaurants []}})
require "http/client"
url = "{{baseUrl}}/delivery/pools"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\",\n \"restaurants\": []\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}}/delivery/pools"),
Content = new StringContent("{\n \"name\": \"\",\n \"restaurants\": []\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}}/delivery/pools");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\",\n \"restaurants\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery/pools"
payload := strings.NewReader("{\n \"name\": \"\",\n \"restaurants\": []\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/delivery/pools HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 37
{
"name": "",
"restaurants": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/delivery/pools")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\",\n \"restaurants\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery/pools"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\",\n \"restaurants\": []\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 \"name\": \"\",\n \"restaurants\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/delivery/pools")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/delivery/pools")
.header("content-type", "application/json")
.body("{\n \"name\": \"\",\n \"restaurants\": []\n}")
.asString();
const data = JSON.stringify({
name: '',
restaurants: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/delivery/pools');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/delivery/pools',
headers: {'content-type': 'application/json'},
data: {name: '', restaurants: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery/pools';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":"","restaurants":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/delivery/pools',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": "",\n "restaurants": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"name\": \"\",\n \"restaurants\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/delivery/pools")
.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/delivery/pools',
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({name: '', restaurants: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/delivery/pools',
headers: {'content-type': 'application/json'},
body: {name: '', restaurants: []},
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}}/delivery/pools');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
name: '',
restaurants: []
});
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}}/delivery/pools',
headers: {'content-type': 'application/json'},
data: {name: '', restaurants: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery/pools';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"name":"","restaurants":[]}'
};
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 = @{ @"name": @"",
@"restaurants": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/delivery/pools"]
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}}/delivery/pools" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\",\n \"restaurants\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery/pools",
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([
'name' => '',
'restaurants' => [
]
]),
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}}/delivery/pools', [
'body' => '{
"name": "",
"restaurants": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/delivery/pools');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => '',
'restaurants' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => '',
'restaurants' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/delivery/pools');
$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}}/delivery/pools' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"restaurants": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery/pools' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"restaurants": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\",\n \"restaurants\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/delivery/pools", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery/pools"
payload = {
"name": "",
"restaurants": []
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery/pools"
payload <- "{\n \"name\": \"\",\n \"restaurants\": []\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}}/delivery/pools")
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 \"name\": \"\",\n \"restaurants\": []\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/delivery/pools') do |req|
req.body = "{\n \"name\": \"\",\n \"restaurants\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/delivery/pools";
let payload = json!({
"name": "",
"restaurants": ()
});
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}}/delivery/pools \
--header 'content-type: application/json' \
--data '{
"name": "",
"restaurants": []
}'
echo '{
"name": "",
"restaurants": []
}' | \
http POST {{baseUrl}}/delivery/pools \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "name": "",\n "restaurants": []\n}' \
--output-document \
- {{baseUrl}}/delivery/pools
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"name": "",
"restaurants": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery/pools")! 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
{
"name": [
"'Name' should not be empty"
]
}
RESPONSE HEADERS
Content-Type
text/plain
RESPONSE BODY text
Internal Server Error
DELETE
Delete a delivery pool
{{baseUrl}}/delivery/pools/:deliveryPoolId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery/pools/:deliveryPoolId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/delivery/pools/:deliveryPoolId")
require "http/client"
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId"
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}}/delivery/pools/:deliveryPoolId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/delivery/pools/:deliveryPoolId");
var request = new RestRequest("", Method.Delete);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery/pools/:deliveryPoolId"
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/delivery/pools/:deliveryPoolId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/delivery/pools/:deliveryPoolId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery/pools/:deliveryPoolId"))
.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}}/delivery/pools/:deliveryPoolId")
.delete(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/delivery/pools/:deliveryPoolId")
.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}}/delivery/pools/:deliveryPoolId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId';
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}}/delivery/pools/:deliveryPoolId',
method: 'DELETE',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId")
.delete(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/delivery/pools/:deliveryPoolId',
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}}/delivery/pools/:deliveryPoolId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/delivery/pools/:deliveryPoolId');
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}}/delivery/pools/:deliveryPoolId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId';
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}}/delivery/pools/:deliveryPoolId"]
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}}/delivery/pools/:deliveryPoolId" in
Client.call `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery/pools/:deliveryPoolId",
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}}/delivery/pools/:deliveryPoolId');
echo $response->getBody();
setUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId');
$request->setMethod(HTTP_METH_DELETE);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId');
$request->setRequestMethod('DELETE');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId' -Method DELETE
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId' -Method DELETE
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("DELETE", "/baseUrl/delivery/pools/:deliveryPoolId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId"
response = requests.delete(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery/pools/:deliveryPoolId"
response <- VERB("DELETE", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/delivery/pools/:deliveryPoolId")
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/delivery/pools/:deliveryPoolId') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/delivery/pools/:deliveryPoolId";
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}}/delivery/pools/:deliveryPoolId
http DELETE {{baseUrl}}/delivery/pools/:deliveryPoolId
wget --quiet \
--method DELETE \
--output-document \
- {{baseUrl}}/delivery/pools/:deliveryPoolId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery/pools/:deliveryPoolId")! 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
text/plain
RESPONSE BODY text
Internal Server Error
GET
Get an individual delivery pool
{{baseUrl}}/delivery/pools/:deliveryPoolId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery/pools/:deliveryPoolId");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/delivery/pools/:deliveryPoolId")
require "http/client"
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId"
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}}/delivery/pools/:deliveryPoolId"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/delivery/pools/:deliveryPoolId");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery/pools/:deliveryPoolId"
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/delivery/pools/:deliveryPoolId HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/delivery/pools/:deliveryPoolId")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery/pools/:deliveryPoolId"))
.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}}/delivery/pools/:deliveryPoolId")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/delivery/pools/:deliveryPoolId")
.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}}/delivery/pools/:deliveryPoolId');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId';
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}}/delivery/pools/:deliveryPoolId',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/delivery/pools/:deliveryPoolId',
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}}/delivery/pools/:deliveryPoolId'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/delivery/pools/:deliveryPoolId');
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}}/delivery/pools/:deliveryPoolId'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId';
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}}/delivery/pools/:deliveryPoolId"]
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}}/delivery/pools/:deliveryPoolId" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery/pools/:deliveryPoolId",
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}}/delivery/pools/:deliveryPoolId');
echo $response->getBody();
setUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/delivery/pools/:deliveryPoolId")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery/pools/:deliveryPoolId"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/delivery/pools/:deliveryPoolId")
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/delivery/pools/:deliveryPoolId') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/delivery/pools/:deliveryPoolId";
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}}/delivery/pools/:deliveryPoolId
http GET {{baseUrl}}/delivery/pools/:deliveryPoolId
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/delivery/pools/:deliveryPoolId
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery/pools/:deliveryPoolId")! 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
{
"name": "Toronto - West",
"restaurants": [
123,
456
]
}
RESPONSE HEADERS
Content-Type
text/plain
RESPONSE BODY text
Internal Server Error
GET
Get availability for pickup
{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative")
require "http/client"
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative"
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}}/delivery/pools/:deliveryPoolId/availability/relative"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative"
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/delivery/pools/:deliveryPoolId/availability/relative HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative"))
.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}}/delivery/pools/:deliveryPoolId/availability/relative")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative")
.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}}/delivery/pools/:deliveryPoolId/availability/relative');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative';
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}}/delivery/pools/:deliveryPoolId/availability/relative',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/delivery/pools/:deliveryPoolId/availability/relative',
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}}/delivery/pools/:deliveryPoolId/availability/relative'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative');
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}}/delivery/pools/:deliveryPoolId/availability/relative'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative';
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}}/delivery/pools/:deliveryPoolId/availability/relative"]
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}}/delivery/pools/:deliveryPoolId/availability/relative" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative",
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}}/delivery/pools/:deliveryPoolId/availability/relative');
echo $response->getBody();
setUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/delivery/pools/:deliveryPoolId/availability/relative")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative")
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/delivery/pools/:deliveryPoolId/availability/relative') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative";
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}}/delivery/pools/:deliveryPoolId/availability/relative
http GET {{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative")! 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
{
"bestGuess": "00:35:00"
}
GET
Get your delivery pools
{{baseUrl}}/delivery/pools
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery/pools");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/delivery/pools")
require "http/client"
url = "{{baseUrl}}/delivery/pools"
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}}/delivery/pools"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/delivery/pools");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery/pools"
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/delivery/pools HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/delivery/pools")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery/pools"))
.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}}/delivery/pools")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/delivery/pools")
.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}}/delivery/pools');
xhr.send(data);
import axios from 'axios';
const options = {method: 'GET', url: '{{baseUrl}}/delivery/pools'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery/pools';
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}}/delivery/pools',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/delivery/pools")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/delivery/pools',
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}}/delivery/pools'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/delivery/pools');
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}}/delivery/pools'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery/pools';
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}}/delivery/pools"]
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}}/delivery/pools" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery/pools",
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}}/delivery/pools');
echo $response->getBody();
setUrl('{{baseUrl}}/delivery/pools');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/delivery/pools');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/delivery/pools' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery/pools' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/delivery/pools")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery/pools"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery/pools"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/delivery/pools")
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/delivery/pools') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/delivery/pools";
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}}/delivery/pools
http GET {{baseUrl}}/delivery/pools
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/delivery/pools
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery/pools")! 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
{
"b9c6673b8e5948b98cfbd14a982de2c2": {
"name": "Toronto - East",
"restaurants": [
789
]
},
"d5f72466a6dd49a08166d5a044c5b9e4": {
"name": "Toronto - West",
"restaurants": [
123,
456
]
}
}
RESPONSE HEADERS
Content-Type
text/plain
RESPONSE BODY text
Internal Server Error
PATCH
Modify a delivery pool
{{baseUrl}}/delivery/pools/:deliveryPoolId
BODY json
{
"name": "",
"restaurants": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery/pools/:deliveryPoolId");
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 \"name\": \"\",\n \"restaurants\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/delivery/pools/:deliveryPoolId" {:content-type :json
:form-params {:name ""
:restaurants []}})
require "http/client"
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\",\n \"restaurants\": []\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/delivery/pools/:deliveryPoolId"),
Content = new StringContent("{\n \"name\": \"\",\n \"restaurants\": []\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}}/delivery/pools/:deliveryPoolId");
var request = new RestRequest("", Method.Patch);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\",\n \"restaurants\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery/pools/:deliveryPoolId"
payload := strings.NewReader("{\n \"name\": \"\",\n \"restaurants\": []\n}")
req, _ := http.NewRequest("PATCH", 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))
}
PATCH /baseUrl/delivery/pools/:deliveryPoolId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 37
{
"name": "",
"restaurants": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/delivery/pools/:deliveryPoolId")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\",\n \"restaurants\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery/pools/:deliveryPoolId"))
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\",\n \"restaurants\": []\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 \"name\": \"\",\n \"restaurants\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId")
.patch(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/delivery/pools/:deliveryPoolId")
.header("content-type", "application/json")
.body("{\n \"name\": \"\",\n \"restaurants\": []\n}")
.asString();
const data = JSON.stringify({
name: '',
restaurants: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/delivery/pools/:deliveryPoolId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId',
headers: {'content-type': 'application/json'},
data: {name: '', restaurants: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"name":"","restaurants":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId',
method: 'PATCH',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": "",\n "restaurants": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"name\": \"\",\n \"restaurants\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId")
.patch(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/delivery/pools/:deliveryPoolId',
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({name: '', restaurants: []}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId',
headers: {'content-type': 'application/json'},
body: {name: '', restaurants: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/delivery/pools/:deliveryPoolId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
name: '',
restaurants: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId',
headers: {'content-type': 'application/json'},
data: {name: '', restaurants: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId';
const options = {
method: 'PATCH',
headers: {'content-type': 'application/json'},
body: '{"name":"","restaurants":[]}'
};
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 = @{ @"name": @"",
@"restaurants": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/delivery/pools/:deliveryPoolId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[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}}/delivery/pools/:deliveryPoolId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\",\n \"restaurants\": []\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery/pools/:deliveryPoolId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '',
'restaurants' => [
]
]),
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('PATCH', '{{baseUrl}}/delivery/pools/:deliveryPoolId', [
'body' => '{
"name": "",
"restaurants": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => '',
'restaurants' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => '',
'restaurants' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId');
$request->setRequestMethod('PATCH');
$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}}/delivery/pools/:deliveryPoolId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"restaurants": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"restaurants": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\",\n \"restaurants\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PATCH", "/baseUrl/delivery/pools/:deliveryPoolId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId"
payload = {
"name": "",
"restaurants": []
}
headers = {"content-type": "application/json"}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery/pools/:deliveryPoolId"
payload <- "{\n \"name\": \"\",\n \"restaurants\": []\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/delivery/pools/:deliveryPoolId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"name\": \"\",\n \"restaurants\": []\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.patch('/baseUrl/delivery/pools/:deliveryPoolId') do |req|
req.body = "{\n \"name\": \"\",\n \"restaurants\": []\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}}/delivery/pools/:deliveryPoolId";
let payload = json!({
"name": "",
"restaurants": ()
});
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("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/delivery/pools/:deliveryPoolId \
--header 'content-type: application/json' \
--data '{
"name": "",
"restaurants": []
}'
echo '{
"name": "",
"restaurants": []
}' | \
http PATCH {{baseUrl}}/delivery/pools/:deliveryPoolId \
content-type:application/json
wget --quiet \
--method PATCH \
--header 'content-type: application/json' \
--body-data '{\n "name": "",\n "restaurants": []\n}' \
--output-document \
- {{baseUrl}}/delivery/pools/:deliveryPoolId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"name": "",
"restaurants": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery/pools/:deliveryPoolId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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
{
"name": "Toronto - North",
"restaurants": [
123,
456
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"name": [
"'Name' should not be empty"
]
}
RESPONSE HEADERS
Content-Type
text/plain
RESPONSE BODY text
Restaurant(s) are already assigned to pools : `{RestaurantId:55474, PoolId:cccebb96452349b799b71a7adc51df66}`
RESPONSE HEADERS
Content-Type
text/plain
RESPONSE BODY text
Internal Server Error
DELETE
Remove restaurants from a delivery pool
{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants
BODY json
{
"restaurants": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants");
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 \"restaurants\": [\n 123,\n 456\n ]\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants" {:content-type :json
:form-params {:restaurants [123 456]}})
require "http/client"
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"restaurants\": [\n 123,\n 456\n ]\n}"
response = HTTP::Client.delete url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"),
Content = new StringContent("{\n \"restaurants\": [\n 123,\n 456\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}}/delivery/pools/:deliveryPoolId/restaurants");
var request = new RestRequest("", Method.Delete);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"restaurants\": [\n 123,\n 456\n ]\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"
payload := strings.NewReader("{\n \"restaurants\": [\n 123,\n 456\n ]\n}")
req, _ := http.NewRequest("DELETE", 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))
}
DELETE /baseUrl/delivery/pools/:deliveryPoolId/restaurants HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 43
{
"restaurants": [
123,
456
]
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")
.setHeader("content-type", "application/json")
.setBody("{\n \"restaurants\": [\n 123,\n 456\n ]\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"))
.header("content-type", "application/json")
.method("DELETE", HttpRequest.BodyPublishers.ofString("{\n \"restaurants\": [\n 123,\n 456\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 \"restaurants\": [\n 123,\n 456\n ]\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")
.delete(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")
.header("content-type", "application/json")
.body("{\n \"restaurants\": [\n 123,\n 456\n ]\n}")
.asString();
const data = JSON.stringify({
restaurants: [
123,
456
]
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants',
headers: {'content-type': 'application/json'},
data: {restaurants: [123, 456]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants';
const options = {
method: 'DELETE',
headers: {'content-type': 'application/json'},
body: '{"restaurants":[123,456]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants',
method: 'DELETE',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "restaurants": [\n 123,\n 456\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 \"restaurants\": [\n 123,\n 456\n ]\n}")
val request = Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")
.delete(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/delivery/pools/:deliveryPoolId/restaurants',
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({restaurants: [123, 456]}));
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants',
headers: {'content-type': 'application/json'},
body: {restaurants: [123, 456]},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
restaurants: [
123,
456
]
});
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}}/delivery/pools/:deliveryPoolId/restaurants',
headers: {'content-type': 'application/json'},
data: {restaurants: [123, 456]}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants';
const options = {
method: 'DELETE',
headers: {'content-type': 'application/json'},
body: '{"restaurants":[123,456]}'
};
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 = @{ @"restaurants": @[ @123, @456 ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[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}}/delivery/pools/:deliveryPoolId/restaurants" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"restaurants\": [\n 123,\n 456\n ]\n}" in
Client.call ~headers ~body `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => json_encode([
'restaurants' => [
123,
456
]
]),
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('DELETE', '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants', [
'body' => '{
"restaurants": [
123,
456
]
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'restaurants' => [
123,
456
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'restaurants' => [
123,
456
]
]));
$request->setRequestUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants');
$request->setRequestMethod('DELETE');
$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}}/delivery/pools/:deliveryPoolId/restaurants' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{
"restaurants": [
123,
456
]
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants' -Method DELETE -Headers $headers -ContentType 'application/json' -Body '{
"restaurants": [
123,
456
]
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"restaurants\": [\n 123,\n 456\n ]\n}"
headers = { 'content-type': "application/json" }
conn.request("DELETE", "/baseUrl/delivery/pools/:deliveryPoolId/restaurants", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"
payload = { "restaurants": [123, 456] }
headers = {"content-type": "application/json"}
response = requests.delete(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants"
payload <- "{\n \"restaurants\": [\n 123,\n 456\n ]\n}"
encode <- "json"
response <- VERB("DELETE", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"restaurants\": [\n 123,\n 456\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.delete('/baseUrl/delivery/pools/:deliveryPoolId/restaurants') do |req|
req.body = "{\n \"restaurants\": [\n 123,\n 456\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}}/delivery/pools/:deliveryPoolId/restaurants";
let payload = json!({"restaurants": (123, 456)});
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("DELETE").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants \
--header 'content-type: application/json' \
--data '{
"restaurants": [
123,
456
]
}'
echo '{
"restaurants": [
123,
456
]
}' | \
http DELETE {{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants \
content-type:application/json
wget --quiet \
--method DELETE \
--header 'content-type: application/json' \
--body-data '{\n "restaurants": [\n 123,\n 456\n ]\n}' \
--output-document \
- {{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["restaurants": [123, 456]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery/pools/:deliveryPoolId/restaurants")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Replace an existing delivery pool
{{baseUrl}}/delivery/pools/:deliveryPoolId
BODY json
{
"name": "",
"restaurants": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery/pools/:deliveryPoolId");
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 \"name\": \"\",\n \"restaurants\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/delivery/pools/:deliveryPoolId" {:content-type :json
:form-params {:name ""
:restaurants []}})
require "http/client"
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\",\n \"restaurants\": []\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}}/delivery/pools/:deliveryPoolId"),
Content = new StringContent("{\n \"name\": \"\",\n \"restaurants\": []\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}}/delivery/pools/:deliveryPoolId");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\",\n \"restaurants\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery/pools/:deliveryPoolId"
payload := strings.NewReader("{\n \"name\": \"\",\n \"restaurants\": []\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/delivery/pools/:deliveryPoolId HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 37
{
"name": "",
"restaurants": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/delivery/pools/:deliveryPoolId")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\",\n \"restaurants\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery/pools/:deliveryPoolId"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\",\n \"restaurants\": []\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 \"name\": \"\",\n \"restaurants\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/delivery/pools/:deliveryPoolId")
.header("content-type", "application/json")
.body("{\n \"name\": \"\",\n \"restaurants\": []\n}")
.asString();
const data = JSON.stringify({
name: '',
restaurants: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/delivery/pools/:deliveryPoolId');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId',
headers: {'content-type': 'application/json'},
data: {name: '', restaurants: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"name":"","restaurants":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": "",\n "restaurants": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"name\": \"\",\n \"restaurants\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId")
.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/delivery/pools/:deliveryPoolId',
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({name: '', restaurants: []}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId',
headers: {'content-type': 'application/json'},
body: {name: '', restaurants: []},
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}}/delivery/pools/:deliveryPoolId');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
name: '',
restaurants: []
});
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}}/delivery/pools/:deliveryPoolId',
headers: {'content-type': 'application/json'},
data: {name: '', restaurants: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"name":"","restaurants":[]}'
};
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 = @{ @"name": @"",
@"restaurants": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/delivery/pools/:deliveryPoolId"]
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}}/delivery/pools/:deliveryPoolId" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\",\n \"restaurants\": []\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery/pools/:deliveryPoolId",
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([
'name' => '',
'restaurants' => [
]
]),
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}}/delivery/pools/:deliveryPoolId', [
'body' => '{
"name": "",
"restaurants": []
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => '',
'restaurants' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => '',
'restaurants' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId');
$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}}/delivery/pools/:deliveryPoolId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"restaurants": []
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"restaurants": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\",\n \"restaurants\": []\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/delivery/pools/:deliveryPoolId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId"
payload = {
"name": "",
"restaurants": []
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery/pools/:deliveryPoolId"
payload <- "{\n \"name\": \"\",\n \"restaurants\": []\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}}/delivery/pools/:deliveryPoolId")
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 \"name\": \"\",\n \"restaurants\": []\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/delivery/pools/:deliveryPoolId') do |req|
req.body = "{\n \"name\": \"\",\n \"restaurants\": []\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}}/delivery/pools/:deliveryPoolId";
let payload = json!({
"name": "",
"restaurants": ()
});
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}}/delivery/pools/:deliveryPoolId \
--header 'content-type: application/json' \
--data '{
"name": "",
"restaurants": []
}'
echo '{
"name": "",
"restaurants": []
}' | \
http PUT {{baseUrl}}/delivery/pools/:deliveryPoolId \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "name": "",\n "restaurants": []\n}' \
--output-document \
- {{baseUrl}}/delivery/pools/:deliveryPoolId
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"name": "",
"restaurants": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery/pools/:deliveryPoolId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"name": "Toronto - West",
"restaurants": [
123,
456
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"name": [
"'Name' should not be empty"
]
}
RESPONSE HEADERS
Content-Type
text/plain
RESPONSE BODY text
Restaurant(s) are already assigned to pools : `{RestaurantId:55474, PoolId:cccebb96452349b799b71a7adc51df66}`
RESPONSE HEADERS
Content-Type
text/plain
RESPONSE BODY text
Internal Server Error
PUT
Set availability for pickup
{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative
BODY json
{
"bestGuess": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative");
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 \"bestGuess\": \"00:35:00\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative" {:content-type :json
:form-params {:bestGuess "00:35:00"}})
require "http/client"
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"bestGuess\": \"00:35:00\"\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}}/delivery/pools/:deliveryPoolId/availability/relative"),
Content = new StringContent("{\n \"bestGuess\": \"00:35:00\"\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}}/delivery/pools/:deliveryPoolId/availability/relative");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"bestGuess\": \"00:35:00\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative"
payload := strings.NewReader("{\n \"bestGuess\": \"00:35:00\"\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/delivery/pools/:deliveryPoolId/availability/relative HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 29
{
"bestGuess": "00:35:00"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative")
.setHeader("content-type", "application/json")
.setBody("{\n \"bestGuess\": \"00:35:00\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"bestGuess\": \"00:35:00\"\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 \"bestGuess\": \"00:35:00\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative")
.header("content-type", "application/json")
.body("{\n \"bestGuess\": \"00:35:00\"\n}")
.asString();
const data = JSON.stringify({
bestGuess: '00:35:00'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative',
headers: {'content-type': 'application/json'},
data: {bestGuess: '00:35:00'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"bestGuess":"00:35:00"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "bestGuess": "00:35:00"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"bestGuess\": \"00:35:00\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative")
.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/delivery/pools/:deliveryPoolId/availability/relative',
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({bestGuess: '00:35:00'}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative',
headers: {'content-type': 'application/json'},
body: {bestGuess: '00:35:00'},
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}}/delivery/pools/:deliveryPoolId/availability/relative');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
bestGuess: '00:35:00'
});
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}}/delivery/pools/:deliveryPoolId/availability/relative',
headers: {'content-type': 'application/json'},
data: {bestGuess: '00:35:00'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"bestGuess":"00:35:00"}'
};
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 = @{ @"bestGuess": @"00:35:00" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative"]
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}}/delivery/pools/:deliveryPoolId/availability/relative" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"bestGuess\": \"00:35:00\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative",
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([
'bestGuess' => '00:35:00'
]),
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}}/delivery/pools/:deliveryPoolId/availability/relative', [
'body' => '{
"bestGuess": "00:35:00"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'bestGuess' => '00:35:00'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'bestGuess' => '00:35:00'
]));
$request->setRequestUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative');
$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}}/delivery/pools/:deliveryPoolId/availability/relative' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"bestGuess": "00:35:00"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"bestGuess": "00:35:00"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"bestGuess\": \"00:35:00\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/delivery/pools/:deliveryPoolId/availability/relative", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative"
payload = { "bestGuess": "00:35:00" }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative"
payload <- "{\n \"bestGuess\": \"00:35:00\"\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}}/delivery/pools/:deliveryPoolId/availability/relative")
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 \"bestGuess\": \"00:35:00\"\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/delivery/pools/:deliveryPoolId/availability/relative') do |req|
req.body = "{\n \"bestGuess\": \"00:35:00\"\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}}/delivery/pools/:deliveryPoolId/availability/relative";
let payload = json!({"bestGuess": "00:35:00"});
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}}/delivery/pools/:deliveryPoolId/availability/relative \
--header 'content-type: application/json' \
--data '{
"bestGuess": "00:35:00"
}'
echo '{
"bestGuess": "00:35:00"
}' | \
http PUT {{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "bestGuess": "00:35:00"\n}' \
--output-document \
- {{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["bestGuess": "00:35:00"] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery/pools/:deliveryPoolId/availability/relative")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Set the delivery pools daily start and end times
{{baseUrl}}/delivery/pools/:deliveryPoolId/hours
BODY json
{
"friday": {
"closed": false,
"poolTimes": [
{
"endTime": "",
"startTime": ""
}
]
},
"monday": {
"closed": false,
"poolTimes": [
{
"endTime": "",
"startTime": ""
}
]
},
"saturday": {
"closed": false,
"poolTimes": [
{
"endTime": "",
"startTime": ""
}
]
},
"sunday": {
"closed": false,
"poolTimes": [
{
"endTime": "",
"startTime": ""
}
]
},
"thursday": {
"closed": false,
"poolTimes": [
{
"endTime": "",
"startTime": ""
}
]
},
"tuesday": {
"closed": false,
"poolTimes": [
{
"endTime": "",
"startTime": ""
}
]
},
"wednesday": {
"closed": false,
"poolTimes": [
{
"endTime": "",
"startTime": ""
}
]
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery/pools/:deliveryPoolId/hours");
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 \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/delivery/pools/:deliveryPoolId/hours" {:content-type :json
:form-params {:friday {:closed false
:poolTimes [{:endTime "01:00"
:startTime "12:00"}]}
:monday {:closed false
:poolTimes [{:endTime "21:00"
:startTime "09:00"}]}
:saturday {:closed false
:poolTimes [{:endTime "23:00"
:startTime "11:00"}]}
:sunday {:closed false
:poolTimes [{:endTime "19:00"
:startTime "13:00"}]}
:thursday {:closed false
:poolTimes [{:endTime "03:00"
:startTime "12:00"}]}
:tuesday {:closed true
:poolTimes [{:endTime "19:00"
:startTime "10:00"}]}
:wednesday {:closed false
:poolTimes [{:endTime "18:00"
:startTime "08:00"}]}}})
require "http/client"
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/hours"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/delivery/pools/:deliveryPoolId/hours"),
Content = new StringContent("{\n \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\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}}/delivery/pools/:deliveryPoolId/hours");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery/pools/:deliveryPoolId/hours"
payload := strings.NewReader("{\n \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/delivery/pools/:deliveryPoolId/hours HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 975
{
"friday": {
"closed": false,
"poolTimes": [
{
"endTime": "01:00",
"startTime": "12:00"
}
]
},
"monday": {
"closed": false,
"poolTimes": [
{
"endTime": "21:00",
"startTime": "09:00"
}
]
},
"saturday": {
"closed": false,
"poolTimes": [
{
"endTime": "23:00",
"startTime": "11:00"
}
]
},
"sunday": {
"closed": false,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "13:00"
}
]
},
"thursday": {
"closed": false,
"poolTimes": [
{
"endTime": "03:00",
"startTime": "12:00"
}
]
},
"tuesday": {
"closed": true,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "10:00"
}
]
},
"wednesday": {
"closed": false,
"poolTimes": [
{
"endTime": "18:00",
"startTime": "08:00"
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/delivery/pools/:deliveryPoolId/hours")
.setHeader("content-type", "application/json")
.setBody("{\n \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery/pools/:deliveryPoolId/hours"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\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 \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId/hours")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/delivery/pools/:deliveryPoolId/hours")
.header("content-type", "application/json")
.body("{\n \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
friday: {
closed: false,
poolTimes: [
{
endTime: '01:00',
startTime: '12:00'
}
]
},
monday: {
closed: false,
poolTimes: [
{
endTime: '21:00',
startTime: '09:00'
}
]
},
saturday: {
closed: false,
poolTimes: [
{
endTime: '23:00',
startTime: '11:00'
}
]
},
sunday: {
closed: false,
poolTimes: [
{
endTime: '19:00',
startTime: '13:00'
}
]
},
thursday: {
closed: false,
poolTimes: [
{
endTime: '03:00',
startTime: '12:00'
}
]
},
tuesday: {
closed: true,
poolTimes: [
{
endTime: '19:00',
startTime: '10:00'
}
]
},
wednesday: {
closed: false,
poolTimes: [
{
endTime: '18:00',
startTime: '08:00'
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/delivery/pools/:deliveryPoolId/hours');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/hours',
headers: {'content-type': 'application/json'},
data: {
friday: {closed: false, poolTimes: [{endTime: '01:00', startTime: '12:00'}]},
monday: {closed: false, poolTimes: [{endTime: '21:00', startTime: '09:00'}]},
saturday: {closed: false, poolTimes: [{endTime: '23:00', startTime: '11:00'}]},
sunday: {closed: false, poolTimes: [{endTime: '19:00', startTime: '13:00'}]},
thursday: {closed: false, poolTimes: [{endTime: '03:00', startTime: '12:00'}]},
tuesday: {closed: true, poolTimes: [{endTime: '19:00', startTime: '10:00'}]},
wednesday: {closed: false, poolTimes: [{endTime: '18:00', startTime: '08:00'}]}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId/hours';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"friday":{"closed":false,"poolTimes":[{"endTime":"01:00","startTime":"12:00"}]},"monday":{"closed":false,"poolTimes":[{"endTime":"21:00","startTime":"09:00"}]},"saturday":{"closed":false,"poolTimes":[{"endTime":"23:00","startTime":"11:00"}]},"sunday":{"closed":false,"poolTimes":[{"endTime":"19:00","startTime":"13:00"}]},"thursday":{"closed":false,"poolTimes":[{"endTime":"03:00","startTime":"12:00"}]},"tuesday":{"closed":true,"poolTimes":[{"endTime":"19:00","startTime":"10:00"}]},"wednesday":{"closed":false,"poolTimes":[{"endTime":"18:00","startTime":"08:00"}]}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/hours',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "friday": {\n "closed": false,\n "poolTimes": [\n {\n "endTime": "01:00",\n "startTime": "12:00"\n }\n ]\n },\n "monday": {\n "closed": false,\n "poolTimes": [\n {\n "endTime": "21:00",\n "startTime": "09:00"\n }\n ]\n },\n "saturday": {\n "closed": false,\n "poolTimes": [\n {\n "endTime": "23:00",\n "startTime": "11:00"\n }\n ]\n },\n "sunday": {\n "closed": false,\n "poolTimes": [\n {\n "endTime": "19:00",\n "startTime": "13:00"\n }\n ]\n },\n "thursday": {\n "closed": false,\n "poolTimes": [\n {\n "endTime": "03:00",\n "startTime": "12:00"\n }\n ]\n },\n "tuesday": {\n "closed": true,\n "poolTimes": [\n {\n "endTime": "19:00",\n "startTime": "10:00"\n }\n ]\n },\n "wednesday": {\n "closed": false,\n "poolTimes": [\n {\n "endTime": "18:00",\n "startTime": "08:00"\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 \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/delivery/pools/:deliveryPoolId/hours")
.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/delivery/pools/:deliveryPoolId/hours',
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({
friday: {closed: false, poolTimes: [{endTime: '01:00', startTime: '12:00'}]},
monday: {closed: false, poolTimes: [{endTime: '21:00', startTime: '09:00'}]},
saturday: {closed: false, poolTimes: [{endTime: '23:00', startTime: '11:00'}]},
sunday: {closed: false, poolTimes: [{endTime: '19:00', startTime: '13:00'}]},
thursday: {closed: false, poolTimes: [{endTime: '03:00', startTime: '12:00'}]},
tuesday: {closed: true, poolTimes: [{endTime: '19:00', startTime: '10:00'}]},
wednesday: {closed: false, poolTimes: [{endTime: '18:00', startTime: '08:00'}]}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/delivery/pools/:deliveryPoolId/hours',
headers: {'content-type': 'application/json'},
body: {
friday: {closed: false, poolTimes: [{endTime: '01:00', startTime: '12:00'}]},
monday: {closed: false, poolTimes: [{endTime: '21:00', startTime: '09:00'}]},
saturday: {closed: false, poolTimes: [{endTime: '23:00', startTime: '11:00'}]},
sunday: {closed: false, poolTimes: [{endTime: '19:00', startTime: '13:00'}]},
thursday: {closed: false, poolTimes: [{endTime: '03:00', startTime: '12:00'}]},
tuesday: {closed: true, poolTimes: [{endTime: '19:00', startTime: '10:00'}]},
wednesday: {closed: false, poolTimes: [{endTime: '18:00', startTime: '08:00'}]}
},
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}}/delivery/pools/:deliveryPoolId/hours');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
friday: {
closed: false,
poolTimes: [
{
endTime: '01:00',
startTime: '12:00'
}
]
},
monday: {
closed: false,
poolTimes: [
{
endTime: '21:00',
startTime: '09:00'
}
]
},
saturday: {
closed: false,
poolTimes: [
{
endTime: '23:00',
startTime: '11:00'
}
]
},
sunday: {
closed: false,
poolTimes: [
{
endTime: '19:00',
startTime: '13:00'
}
]
},
thursday: {
closed: false,
poolTimes: [
{
endTime: '03:00',
startTime: '12:00'
}
]
},
tuesday: {
closed: true,
poolTimes: [
{
endTime: '19:00',
startTime: '10:00'
}
]
},
wednesday: {
closed: false,
poolTimes: [
{
endTime: '18:00',
startTime: '08:00'
}
]
}
});
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}}/delivery/pools/:deliveryPoolId/hours',
headers: {'content-type': 'application/json'},
data: {
friday: {closed: false, poolTimes: [{endTime: '01:00', startTime: '12:00'}]},
monday: {closed: false, poolTimes: [{endTime: '21:00', startTime: '09:00'}]},
saturday: {closed: false, poolTimes: [{endTime: '23:00', startTime: '11:00'}]},
sunday: {closed: false, poolTimes: [{endTime: '19:00', startTime: '13:00'}]},
thursday: {closed: false, poolTimes: [{endTime: '03:00', startTime: '12:00'}]},
tuesday: {closed: true, poolTimes: [{endTime: '19:00', startTime: '10:00'}]},
wednesday: {closed: false, poolTimes: [{endTime: '18:00', startTime: '08:00'}]}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery/pools/:deliveryPoolId/hours';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"friday":{"closed":false,"poolTimes":[{"endTime":"01:00","startTime":"12:00"}]},"monday":{"closed":false,"poolTimes":[{"endTime":"21:00","startTime":"09:00"}]},"saturday":{"closed":false,"poolTimes":[{"endTime":"23:00","startTime":"11:00"}]},"sunday":{"closed":false,"poolTimes":[{"endTime":"19:00","startTime":"13:00"}]},"thursday":{"closed":false,"poolTimes":[{"endTime":"03:00","startTime":"12:00"}]},"tuesday":{"closed":true,"poolTimes":[{"endTime":"19:00","startTime":"10:00"}]},"wednesday":{"closed":false,"poolTimes":[{"endTime":"18:00","startTime":"08:00"}]}}'
};
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 = @{ @"friday": @{ @"closed": @NO, @"poolTimes": @[ @{ @"endTime": @"01:00", @"startTime": @"12:00" } ] },
@"monday": @{ @"closed": @NO, @"poolTimes": @[ @{ @"endTime": @"21:00", @"startTime": @"09:00" } ] },
@"saturday": @{ @"closed": @NO, @"poolTimes": @[ @{ @"endTime": @"23:00", @"startTime": @"11:00" } ] },
@"sunday": @{ @"closed": @NO, @"poolTimes": @[ @{ @"endTime": @"19:00", @"startTime": @"13:00" } ] },
@"thursday": @{ @"closed": @NO, @"poolTimes": @[ @{ @"endTime": @"03:00", @"startTime": @"12:00" } ] },
@"tuesday": @{ @"closed": @YES, @"poolTimes": @[ @{ @"endTime": @"19:00", @"startTime": @"10:00" } ] },
@"wednesday": @{ @"closed": @NO, @"poolTimes": @[ @{ @"endTime": @"18:00", @"startTime": @"08:00" } ] } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/delivery/pools/:deliveryPoolId/hours"]
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}}/delivery/pools/:deliveryPoolId/hours" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery/pools/:deliveryPoolId/hours",
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([
'friday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '01:00',
'startTime' => '12:00'
]
]
],
'monday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '21:00',
'startTime' => '09:00'
]
]
],
'saturday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '23:00',
'startTime' => '11:00'
]
]
],
'sunday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '19:00',
'startTime' => '13:00'
]
]
],
'thursday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '03:00',
'startTime' => '12:00'
]
]
],
'tuesday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '19:00',
'startTime' => '10:00'
]
]
],
'wednesday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '18:00',
'startTime' => '08:00'
]
]
]
]),
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}}/delivery/pools/:deliveryPoolId/hours', [
'body' => '{
"friday": {
"closed": false,
"poolTimes": [
{
"endTime": "01:00",
"startTime": "12:00"
}
]
},
"monday": {
"closed": false,
"poolTimes": [
{
"endTime": "21:00",
"startTime": "09:00"
}
]
},
"saturday": {
"closed": false,
"poolTimes": [
{
"endTime": "23:00",
"startTime": "11:00"
}
]
},
"sunday": {
"closed": false,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "13:00"
}
]
},
"thursday": {
"closed": false,
"poolTimes": [
{
"endTime": "03:00",
"startTime": "12:00"
}
]
},
"tuesday": {
"closed": true,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "10:00"
}
]
},
"wednesday": {
"closed": false,
"poolTimes": [
{
"endTime": "18:00",
"startTime": "08:00"
}
]
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId/hours');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'friday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '01:00',
'startTime' => '12:00'
]
]
],
'monday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '21:00',
'startTime' => '09:00'
]
]
],
'saturday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '23:00',
'startTime' => '11:00'
]
]
],
'sunday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '19:00',
'startTime' => '13:00'
]
]
],
'thursday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '03:00',
'startTime' => '12:00'
]
]
],
'tuesday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '19:00',
'startTime' => '10:00'
]
]
],
'wednesday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '18:00',
'startTime' => '08:00'
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'friday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '01:00',
'startTime' => '12:00'
]
]
],
'monday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '21:00',
'startTime' => '09:00'
]
]
],
'saturday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '23:00',
'startTime' => '11:00'
]
]
],
'sunday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '19:00',
'startTime' => '13:00'
]
]
],
'thursday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '03:00',
'startTime' => '12:00'
]
]
],
'tuesday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '19:00',
'startTime' => '10:00'
]
]
],
'wednesday' => [
'closed' => null,
'poolTimes' => [
[
'endTime' => '18:00',
'startTime' => '08:00'
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/delivery/pools/:deliveryPoolId/hours');
$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}}/delivery/pools/:deliveryPoolId/hours' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"friday": {
"closed": false,
"poolTimes": [
{
"endTime": "01:00",
"startTime": "12:00"
}
]
},
"monday": {
"closed": false,
"poolTimes": [
{
"endTime": "21:00",
"startTime": "09:00"
}
]
},
"saturday": {
"closed": false,
"poolTimes": [
{
"endTime": "23:00",
"startTime": "11:00"
}
]
},
"sunday": {
"closed": false,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "13:00"
}
]
},
"thursday": {
"closed": false,
"poolTimes": [
{
"endTime": "03:00",
"startTime": "12:00"
}
]
},
"tuesday": {
"closed": true,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "10:00"
}
]
},
"wednesday": {
"closed": false,
"poolTimes": [
{
"endTime": "18:00",
"startTime": "08:00"
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery/pools/:deliveryPoolId/hours' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"friday": {
"closed": false,
"poolTimes": [
{
"endTime": "01:00",
"startTime": "12:00"
}
]
},
"monday": {
"closed": false,
"poolTimes": [
{
"endTime": "21:00",
"startTime": "09:00"
}
]
},
"saturday": {
"closed": false,
"poolTimes": [
{
"endTime": "23:00",
"startTime": "11:00"
}
]
},
"sunday": {
"closed": false,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "13:00"
}
]
},
"thursday": {
"closed": false,
"poolTimes": [
{
"endTime": "03:00",
"startTime": "12:00"
}
]
},
"tuesday": {
"closed": true,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "10:00"
}
]
},
"wednesday": {
"closed": false,
"poolTimes": [
{
"endTime": "18:00",
"startTime": "08:00"
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/delivery/pools/:deliveryPoolId/hours", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/hours"
payload = {
"friday": {
"closed": False,
"poolTimes": [
{
"endTime": "01:00",
"startTime": "12:00"
}
]
},
"monday": {
"closed": False,
"poolTimes": [
{
"endTime": "21:00",
"startTime": "09:00"
}
]
},
"saturday": {
"closed": False,
"poolTimes": [
{
"endTime": "23:00",
"startTime": "11:00"
}
]
},
"sunday": {
"closed": False,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "13:00"
}
]
},
"thursday": {
"closed": False,
"poolTimes": [
{
"endTime": "03:00",
"startTime": "12:00"
}
]
},
"tuesday": {
"closed": True,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "10:00"
}
]
},
"wednesday": {
"closed": False,
"poolTimes": [
{
"endTime": "18:00",
"startTime": "08:00"
}
]
}
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery/pools/:deliveryPoolId/hours"
payload <- "{\n \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/delivery/pools/:deliveryPoolId/hours")
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 \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/delivery/pools/:deliveryPoolId/hours') do |req|
req.body = "{\n \"friday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"01:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"monday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"21:00\",\n \"startTime\": \"09:00\"\n }\n ]\n },\n \"saturday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"23:00\",\n \"startTime\": \"11:00\"\n }\n ]\n },\n \"sunday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"13:00\"\n }\n ]\n },\n \"thursday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"03:00\",\n \"startTime\": \"12:00\"\n }\n ]\n },\n \"tuesday\": {\n \"closed\": true,\n \"poolTimes\": [\n {\n \"endTime\": \"19:00\",\n \"startTime\": \"10:00\"\n }\n ]\n },\n \"wednesday\": {\n \"closed\": false,\n \"poolTimes\": [\n {\n \"endTime\": \"18:00\",\n \"startTime\": \"08:00\"\n }\n ]\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/delivery/pools/:deliveryPoolId/hours";
let payload = json!({
"friday": json!({
"closed": false,
"poolTimes": (
json!({
"endTime": "01:00",
"startTime": "12:00"
})
)
}),
"monday": json!({
"closed": false,
"poolTimes": (
json!({
"endTime": "21:00",
"startTime": "09:00"
})
)
}),
"saturday": json!({
"closed": false,
"poolTimes": (
json!({
"endTime": "23:00",
"startTime": "11:00"
})
)
}),
"sunday": json!({
"closed": false,
"poolTimes": (
json!({
"endTime": "19:00",
"startTime": "13:00"
})
)
}),
"thursday": json!({
"closed": false,
"poolTimes": (
json!({
"endTime": "03:00",
"startTime": "12:00"
})
)
}),
"tuesday": json!({
"closed": true,
"poolTimes": (
json!({
"endTime": "19:00",
"startTime": "10:00"
})
)
}),
"wednesday": json!({
"closed": false,
"poolTimes": (
json!({
"endTime": "18:00",
"startTime": "08:00"
})
)
})
});
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}}/delivery/pools/:deliveryPoolId/hours \
--header 'content-type: application/json' \
--data '{
"friday": {
"closed": false,
"poolTimes": [
{
"endTime": "01:00",
"startTime": "12:00"
}
]
},
"monday": {
"closed": false,
"poolTimes": [
{
"endTime": "21:00",
"startTime": "09:00"
}
]
},
"saturday": {
"closed": false,
"poolTimes": [
{
"endTime": "23:00",
"startTime": "11:00"
}
]
},
"sunday": {
"closed": false,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "13:00"
}
]
},
"thursday": {
"closed": false,
"poolTimes": [
{
"endTime": "03:00",
"startTime": "12:00"
}
]
},
"tuesday": {
"closed": true,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "10:00"
}
]
},
"wednesday": {
"closed": false,
"poolTimes": [
{
"endTime": "18:00",
"startTime": "08:00"
}
]
}
}'
echo '{
"friday": {
"closed": false,
"poolTimes": [
{
"endTime": "01:00",
"startTime": "12:00"
}
]
},
"monday": {
"closed": false,
"poolTimes": [
{
"endTime": "21:00",
"startTime": "09:00"
}
]
},
"saturday": {
"closed": false,
"poolTimes": [
{
"endTime": "23:00",
"startTime": "11:00"
}
]
},
"sunday": {
"closed": false,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "13:00"
}
]
},
"thursday": {
"closed": false,
"poolTimes": [
{
"endTime": "03:00",
"startTime": "12:00"
}
]
},
"tuesday": {
"closed": true,
"poolTimes": [
{
"endTime": "19:00",
"startTime": "10:00"
}
]
},
"wednesday": {
"closed": false,
"poolTimes": [
{
"endTime": "18:00",
"startTime": "08:00"
}
]
}
}' | \
http PUT {{baseUrl}}/delivery/pools/:deliveryPoolId/hours \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "friday": {\n "closed": false,\n "poolTimes": [\n {\n "endTime": "01:00",\n "startTime": "12:00"\n }\n ]\n },\n "monday": {\n "closed": false,\n "poolTimes": [\n {\n "endTime": "21:00",\n "startTime": "09:00"\n }\n ]\n },\n "saturday": {\n "closed": false,\n "poolTimes": [\n {\n "endTime": "23:00",\n "startTime": "11:00"\n }\n ]\n },\n "sunday": {\n "closed": false,\n "poolTimes": [\n {\n "endTime": "19:00",\n "startTime": "13:00"\n }\n ]\n },\n "thursday": {\n "closed": false,\n "poolTimes": [\n {\n "endTime": "03:00",\n "startTime": "12:00"\n }\n ]\n },\n "tuesday": {\n "closed": true,\n "poolTimes": [\n {\n "endTime": "19:00",\n "startTime": "10:00"\n }\n ]\n },\n "wednesday": {\n "closed": false,\n "poolTimes": [\n {\n "endTime": "18:00",\n "startTime": "08:00"\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/delivery/pools/:deliveryPoolId/hours
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"friday": [
"closed": false,
"poolTimes": [
[
"endTime": "01:00",
"startTime": "12:00"
]
]
],
"monday": [
"closed": false,
"poolTimes": [
[
"endTime": "21:00",
"startTime": "09:00"
]
]
],
"saturday": [
"closed": false,
"poolTimes": [
[
"endTime": "23:00",
"startTime": "11:00"
]
]
],
"sunday": [
"closed": false,
"poolTimes": [
[
"endTime": "19:00",
"startTime": "13:00"
]
]
],
"thursday": [
"closed": false,
"poolTimes": [
[
"endTime": "03:00",
"startTime": "12:00"
]
]
],
"tuesday": [
"closed": true,
"poolTimes": [
[
"endTime": "19:00",
"startTime": "10:00"
]
]
],
"wednesday": [
"closed": false,
"poolTimes": [
[
"endTime": "18:00",
"startTime": "08:00"
]
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery/pools/:deliveryPoolId/hours")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get restaurant delivery fees
{{baseUrl}}/delivery-fees/:tenant
QUERY PARAMS
restaurantIds
deliveryTime
tenant
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/delivery-fees/:tenant" {:query-params {:restaurantIds ""
:deliveryTime ""}})
require "http/client"
url = "{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime="
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}}/delivery-fees/:tenant?restaurantIds=&deliveryTime="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime="
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/delivery-fees/:tenant?restaurantIds=&deliveryTime= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime="))
.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}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=")
.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}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/delivery-fees/:tenant',
params: {restaurantIds: '', deliveryTime: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=';
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}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/delivery-fees/:tenant?restaurantIds=&deliveryTime=',
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}}/delivery-fees/:tenant',
qs: {restaurantIds: '', deliveryTime: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/delivery-fees/:tenant');
req.query({
restaurantIds: '',
deliveryTime: ''
});
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}}/delivery-fees/:tenant',
params: {restaurantIds: '', deliveryTime: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=';
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}}/delivery-fees/:tenant?restaurantIds=&deliveryTime="]
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}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=",
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}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=');
echo $response->getBody();
setUrl('{{baseUrl}}/delivery-fees/:tenant');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'restaurantIds' => '',
'deliveryTime' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/delivery-fees/:tenant');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'restaurantIds' => '',
'deliveryTime' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/delivery-fees/:tenant?restaurantIds=&deliveryTime=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery-fees/:tenant"
querystring = {"restaurantIds":"","deliveryTime":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery-fees/:tenant"
queryString <- list(
restaurantIds = "",
deliveryTime = ""
)
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=")
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/delivery-fees/:tenant') do |req|
req.params['restaurantIds'] = ''
req.params['deliveryTime'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/delivery-fees/:tenant";
let querystring = [
("restaurantIds", ""),
("deliveryTime", ""),
];
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}}/delivery-fees/:tenant?restaurantIds=&deliveryTime='
http GET '{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery-fees/:tenant?restaurantIds=&deliveryTime=")! 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
{
"restaurants": [
{
"bands": [
{
"fee": 250,
"minimumAmount": 1000
}
],
"minimumOrderValue": 1000,
"restaurantId": "1234"
},
{
"bands": [
{
"fee": 100,
"minimumAmount": 0
}
],
"minimumOrderValue": 0,
"restaurantId": "5678"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"restaurants": [
{
"bands": [
{
"fee": 250,
"minimumAmount": 1000
},
{
"fee": 0,
"minimumAmount": 2000
}
],
"minimumOrderValue": 1000,
"restaurantId": "1234"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"restaurants": [
{
"bands": [
{
"fee": 250,
"minimumAmount": 0
},
{
"fee": 100,
"minimumAmount": 10
},
{
"fee": 0,
"minimumAmount": 2000
}
],
"minimumOrderValue": 0,
"restaurantId": "1234"
}
]
}
PUT
Accept order
{{baseUrl}}/orders/:orderId/accept
QUERY PARAMS
orderId
BODY json
{
"TimeAcceptedFor": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/accept");
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 \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/accept" {:content-type :json
:form-params {:TimeAcceptedFor "2018-03-10T14:45:28Z"}})
require "http/client"
url = "{{baseUrl}}/orders/:orderId/accept"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\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}}/orders/:orderId/accept"),
Content = new StringContent("{\n \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\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/:orderId/accept");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/accept"
payload := strings.NewReader("{\n \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\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/orders/:orderId/accept HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 47
{
"TimeAcceptedFor": "2018-03-10T14:45:28Z"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/accept")
.setHeader("content-type", "application/json")
.setBody("{\n \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/accept"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\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 \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/accept")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/accept")
.header("content-type", "application/json")
.body("{\n \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\n}")
.asString();
const data = JSON.stringify({
TimeAcceptedFor: '2018-03-10T14:45:28Z'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/accept');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/accept',
headers: {'content-type': 'application/json'},
data: {TimeAcceptedFor: '2018-03-10T14:45:28Z'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/accept';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"TimeAcceptedFor":"2018-03-10T14:45:28Z"}'
};
try {
const response = await 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/:orderId/accept',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "TimeAcceptedFor": "2018-03-10T14:45:28Z"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/accept")
.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/orders/:orderId/accept',
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({TimeAcceptedFor: '2018-03-10T14:45:28Z'}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/accept',
headers: {'content-type': 'application/json'},
body: {TimeAcceptedFor: '2018-03-10T14:45:28Z'},
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}}/orders/:orderId/accept');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
TimeAcceptedFor: '2018-03-10T14:45:28Z'
});
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}}/orders/:orderId/accept',
headers: {'content-type': 'application/json'},
data: {TimeAcceptedFor: '2018-03-10T14:45:28Z'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/accept';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"TimeAcceptedFor":"2018-03-10T14:45:28Z"}'
};
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 = @{ @"TimeAcceptedFor": @"2018-03-10T14:45:28Z" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/accept"]
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}}/orders/:orderId/accept" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/accept",
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([
'TimeAcceptedFor' => '2018-03-10T14:45:28Z'
]),
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}}/orders/:orderId/accept', [
'body' => '{
"TimeAcceptedFor": "2018-03-10T14:45:28Z"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/accept');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'TimeAcceptedFor' => '2018-03-10T14:45:28Z'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'TimeAcceptedFor' => '2018-03-10T14:45:28Z'
]));
$request->setRequestUrl('{{baseUrl}}/orders/:orderId/accept');
$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}}/orders/:orderId/accept' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"TimeAcceptedFor": "2018-03-10T14:45:28Z"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/accept' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"TimeAcceptedFor": "2018-03-10T14:45:28Z"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/:orderId/accept", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/accept"
payload = { "TimeAcceptedFor": "2018-03-10T14:45:28Z" }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/accept"
payload <- "{\n \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\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}}/orders/:orderId/accept")
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 \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\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/orders/:orderId/accept') do |req|
req.body = "{\n \"TimeAcceptedFor\": \"2018-03-10T14:45:28Z\"\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}}/orders/:orderId/accept";
let payload = json!({"TimeAcceptedFor": "2018-03-10T14:45:28Z"});
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}}/orders/:orderId/accept \
--header 'content-type: application/json' \
--data '{
"TimeAcceptedFor": "2018-03-10T14:45:28Z"
}'
echo '{
"TimeAcceptedFor": "2018-03-10T14:45:28Z"
}' | \
http PUT {{baseUrl}}/orders/:orderId/accept \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "TimeAcceptedFor": "2018-03-10T14:45:28Z"\n}' \
--output-document \
- {{baseUrl}}/orders/:orderId/accept
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["TimeAcceptedFor": "2018-03-10T14:45:28Z"] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/accept")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Cancel order
{{baseUrl}}/orders/:orderId/cancel
QUERY PARAMS
orderId
BODY json
{
"Message": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/cancel");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"Message\": \"Customer requested the order to be cancelled\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/cancel" {:content-type :json
:form-params {:Message "Customer requested the order to be cancelled"}})
require "http/client"
url = "{{baseUrl}}/orders/:orderId/cancel"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Message\": \"Customer requested the order to be cancelled\"\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}}/orders/:orderId/cancel"),
Content = new StringContent("{\n \"Message\": \"Customer requested the order to be cancelled\"\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/:orderId/cancel");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Message\": \"Customer requested the order to be cancelled\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/cancel"
payload := strings.NewReader("{\n \"Message\": \"Customer requested the order to be cancelled\"\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/orders/:orderId/cancel HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 63
{
"Message": "Customer requested the order to be cancelled"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/cancel")
.setHeader("content-type", "application/json")
.setBody("{\n \"Message\": \"Customer requested the order to be cancelled\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/cancel"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"Message\": \"Customer requested the order to be cancelled\"\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 \"Message\": \"Customer requested the order to be cancelled\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/cancel")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/cancel")
.header("content-type", "application/json")
.body("{\n \"Message\": \"Customer requested the order to be cancelled\"\n}")
.asString();
const data = JSON.stringify({
Message: 'Customer requested the order to be cancelled'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/cancel');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/cancel',
headers: {'content-type': 'application/json'},
data: {Message: 'Customer requested the order to be cancelled'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/cancel';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Message":"Customer requested the order to be cancelled"}'
};
try {
const response = await 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/:orderId/cancel',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Message": "Customer requested the order to be cancelled"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Message\": \"Customer requested the order to be cancelled\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/cancel")
.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/orders/:orderId/cancel',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({Message: 'Customer requested the order to be cancelled'}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/cancel',
headers: {'content-type': 'application/json'},
body: {Message: 'Customer requested the order to be cancelled'},
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}}/orders/:orderId/cancel');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Message: 'Customer requested the order to be cancelled'
});
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}}/orders/:orderId/cancel',
headers: {'content-type': 'application/json'},
data: {Message: 'Customer requested the order to be cancelled'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/cancel';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Message":"Customer requested the order to be cancelled"}'
};
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 = @{ @"Message": @"Customer requested the order to be cancelled" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/cancel"]
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}}/orders/:orderId/cancel" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Message\": \"Customer requested the order to be cancelled\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/cancel",
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([
'Message' => 'Customer requested the order to be cancelled'
]),
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}}/orders/:orderId/cancel', [
'body' => '{
"Message": "Customer requested the order to be cancelled"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/cancel');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Message' => 'Customer requested the order to be cancelled'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Message' => 'Customer requested the order to be cancelled'
]));
$request->setRequestUrl('{{baseUrl}}/orders/:orderId/cancel');
$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}}/orders/:orderId/cancel' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Message": "Customer requested the order to be cancelled"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/cancel' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Message": "Customer requested the order to be cancelled"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Message\": \"Customer requested the order to be cancelled\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/:orderId/cancel", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/cancel"
payload = { "Message": "Customer requested the order to be cancelled" }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/cancel"
payload <- "{\n \"Message\": \"Customer requested the order to be cancelled\"\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}}/orders/:orderId/cancel")
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 \"Message\": \"Customer requested the order to be cancelled\"\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/orders/:orderId/cancel') do |req|
req.body = "{\n \"Message\": \"Customer requested the order to be cancelled\"\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}}/orders/:orderId/cancel";
let payload = json!({"Message": "Customer requested the order to be cancelled"});
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}}/orders/:orderId/cancel \
--header 'content-type: application/json' \
--data '{
"Message": "Customer requested the order to be cancelled"
}'
echo '{
"Message": "Customer requested the order to be cancelled"
}' | \
http PUT {{baseUrl}}/orders/:orderId/cancel \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "Message": "Customer requested the order to be cancelled"\n}' \
--output-document \
- {{baseUrl}}/orders/:orderId/cancel
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["Message": "Customer requested the order to be cancelled"] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/cancel")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Complete order
{{baseUrl}}/orders/:orderId/complete
QUERY PARAMS
orderId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/complete");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/orders/:orderId/complete")
require "http/client"
url = "{{baseUrl}}/orders/:orderId/complete"
response = HTTP::Client.post url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/orders/:orderId/complete"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/orders/:orderId/complete");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/complete"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/orders/:orderId/complete HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/orders/:orderId/complete")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/complete"))
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/complete")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/orders/:orderId/complete")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/orders/:orderId/complete');
xhr.send(data);
import axios from 'axios';
const options = {method: 'POST', url: '{{baseUrl}}/orders/:orderId/complete'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/complete';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/orders/:orderId/complete',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/complete")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/orders/:orderId/complete',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'POST', url: '{{baseUrl}}/orders/:orderId/complete'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/orders/:orderId/complete');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {method: 'POST', url: '{{baseUrl}}/orders/:orderId/complete'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/complete';
const options = {method: 'POST'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/complete"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/orders/:orderId/complete" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/complete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/orders/:orderId/complete');
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/complete');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/orders/:orderId/complete');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders/:orderId/complete' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/complete' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/orders/:orderId/complete")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/complete"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/complete"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders/:orderId/complete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/orders/:orderId/complete') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders/:orderId/complete";
let client = reqwest::Client::new();
let response = client.post(url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/orders/:orderId/complete
http POST {{baseUrl}}/orders/:orderId/complete
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/orders/:orderId/complete
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/complete")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Order could not be found"
}
],
"faultId": "b6a1d658-dda4-41b6-a9a5-dbfb7ba7b2aa"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Order cannot be marked as complete because it is already marked as cancelled"
}
],
"faultId": "9c63827b-6fad-46bf-9e9a-9aafec941824"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
PUT
Ignore order
{{baseUrl}}/orders/:orderId/ignore
QUERY PARAMS
orderId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/ignore");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/ignore")
require "http/client"
url = "{{baseUrl}}/orders/:orderId/ignore"
response = HTTP::Client.put url
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/orders/:orderId/ignore"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/orders/:orderId/ignore");
var request = new RestRequest("", Method.Put);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/ignore"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/orders/:orderId/ignore HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/ignore")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/ignore"))
.method("PUT", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/ignore")
.put(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/ignore")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/ignore');
xhr.send(data);
import axios from 'axios';
const options = {method: 'PUT', url: '{{baseUrl}}/orders/:orderId/ignore'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/ignore';
const options = {method: 'PUT'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/orders/:orderId/ignore',
method: 'PUT',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/ignore")
.put(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/orders/:orderId/ignore',
headers: {}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {method: 'PUT', url: '{{baseUrl}}/orders/:orderId/ignore'};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/orders/:orderId/ignore');
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}}/orders/:orderId/ignore'};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/ignore';
const options = {method: 'PUT'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/ignore"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/orders/:orderId/ignore" in
Client.call `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/ignore",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/orders/:orderId/ignore');
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/ignore');
$request->setMethod(HTTP_METH_PUT);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/orders/:orderId/ignore');
$request->setRequestMethod('PUT');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders/:orderId/ignore' -Method PUT
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/ignore' -Method PUT
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("PUT", "/baseUrl/orders/:orderId/ignore")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/ignore"
response = requests.put(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/ignore"
response <- VERB("PUT", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders/:orderId/ignore")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.put('/baseUrl/orders/:orderId/ignore') do |req|
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders/:orderId/ignore";
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/orders/:orderId/ignore
http PUT {{baseUrl}}/orders/:orderId/ignore
wget --quiet \
--method PUT \
--output-document \
- {{baseUrl}}/orders/:orderId/ignore
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/ignore")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Mark order as ready for collection
{{baseUrl}}/orders/:orderId/readyforcollection
QUERY PARAMS
orderId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/readyforcollection");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/orders/:orderId/readyforcollection")
require "http/client"
url = "{{baseUrl}}/orders/:orderId/readyforcollection"
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}}/orders/:orderId/readyforcollection"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/orders/:orderId/readyforcollection");
var request = new RestRequest("", Method.Post);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/readyforcollection"
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/orders/:orderId/readyforcollection HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/orders/:orderId/readyforcollection")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/readyforcollection"))
.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}}/orders/:orderId/readyforcollection")
.post(null)
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/orders/:orderId/readyforcollection")
.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}}/orders/:orderId/readyforcollection');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/orders/:orderId/readyforcollection'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/readyforcollection';
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}}/orders/:orderId/readyforcollection',
method: 'POST',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/readyforcollection")
.post(null)
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/orders/:orderId/readyforcollection',
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}}/orders/:orderId/readyforcollection'
};
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/:orderId/readyforcollection');
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/:orderId/readyforcollection'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/readyforcollection';
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}}/orders/:orderId/readyforcollection"]
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}}/orders/:orderId/readyforcollection" in
Client.call `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/readyforcollection",
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}}/orders/:orderId/readyforcollection');
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/readyforcollection');
$request->setMethod(HTTP_METH_POST);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/orders/:orderId/readyforcollection');
$request->setRequestMethod('POST');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders/:orderId/readyforcollection' -Method POST
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/readyforcollection' -Method POST
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("POST", "/baseUrl/orders/:orderId/readyforcollection")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/readyforcollection"
response = requests.post(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/readyforcollection"
response <- VERB("POST", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders/:orderId/readyforcollection")
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/orders/:orderId/readyforcollection') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders/:orderId/readyforcollection";
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}}/orders/:orderId/readyforcollection
http POST {{baseUrl}}/orders/:orderId/readyforcollection
wget --quiet \
--method POST \
--output-document \
- {{baseUrl}}/orders/:orderId/readyforcollection
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/readyforcollection")! 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
{
"errors": [
{
"description": "Order cannot be marked as ready for collection because it is not a collection order"
}
],
"faultId": "aa5d282c-498e-47dd-acca-d4bb811a8f9d"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Order could not be found"
}
],
"faultId": "15c27f5b-5121-4c1f-bea3-34378dff2a79"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Order cannot be marked as ready for collection because it is already marked as complete"
}
],
"faultId": "9c63827b-6fad-46bf-9e9a-9aafec941824"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
PUT
Reject order
{{baseUrl}}/orders/:orderId/reject
QUERY PARAMS
orderId
BODY json
{
"Message": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/reject");
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 \"Message\": \"Kitchen overloaded\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/reject" {:content-type :json
:form-params {:Message "Kitchen overloaded"}})
require "http/client"
url = "{{baseUrl}}/orders/:orderId/reject"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Message\": \"Kitchen overloaded\"\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}}/orders/:orderId/reject"),
Content = new StringContent("{\n \"Message\": \"Kitchen overloaded\"\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/:orderId/reject");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Message\": \"Kitchen overloaded\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/reject"
payload := strings.NewReader("{\n \"Message\": \"Kitchen overloaded\"\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/orders/:orderId/reject HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 37
{
"Message": "Kitchen overloaded"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/reject")
.setHeader("content-type", "application/json")
.setBody("{\n \"Message\": \"Kitchen overloaded\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/reject"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"Message\": \"Kitchen overloaded\"\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 \"Message\": \"Kitchen overloaded\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/reject")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/reject")
.header("content-type", "application/json")
.body("{\n \"Message\": \"Kitchen overloaded\"\n}")
.asString();
const data = JSON.stringify({
Message: 'Kitchen overloaded'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/reject');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/reject',
headers: {'content-type': 'application/json'},
data: {Message: 'Kitchen overloaded'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/reject';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Message":"Kitchen overloaded"}'
};
try {
const response = await 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/:orderId/reject',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Message": "Kitchen overloaded"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Message\": \"Kitchen overloaded\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/reject")
.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/orders/:orderId/reject',
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({Message: 'Kitchen overloaded'}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/reject',
headers: {'content-type': 'application/json'},
body: {Message: 'Kitchen overloaded'},
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}}/orders/:orderId/reject');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Message: 'Kitchen overloaded'
});
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}}/orders/:orderId/reject',
headers: {'content-type': 'application/json'},
data: {Message: 'Kitchen overloaded'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/reject';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Message":"Kitchen overloaded"}'
};
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 = @{ @"Message": @"Kitchen overloaded" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/reject"]
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}}/orders/:orderId/reject" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Message\": \"Kitchen overloaded\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/reject",
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([
'Message' => 'Kitchen overloaded'
]),
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}}/orders/:orderId/reject', [
'body' => '{
"Message": "Kitchen overloaded"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/reject');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Message' => 'Kitchen overloaded'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Message' => 'Kitchen overloaded'
]));
$request->setRequestUrl('{{baseUrl}}/orders/:orderId/reject');
$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}}/orders/:orderId/reject' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Message": "Kitchen overloaded"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/reject' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Message": "Kitchen overloaded"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Message\": \"Kitchen overloaded\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/:orderId/reject", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/reject"
payload = { "Message": "Kitchen overloaded" }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/reject"
payload <- "{\n \"Message\": \"Kitchen overloaded\"\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}}/orders/:orderId/reject")
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 \"Message\": \"Kitchen overloaded\"\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/orders/:orderId/reject') do |req|
req.body = "{\n \"Message\": \"Kitchen overloaded\"\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}}/orders/:orderId/reject";
let payload = json!({"Message": "Kitchen overloaded"});
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}}/orders/:orderId/reject \
--header 'content-type: application/json' \
--data '{
"Message": "Kitchen overloaded"
}'
echo '{
"Message": "Kitchen overloaded"
}' | \
http PUT {{baseUrl}}/orders/:orderId/reject \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "Message": "Kitchen overloaded"\n}' \
--output-document \
- {{baseUrl}}/orders/:orderId/reject
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["Message": "Kitchen overloaded"] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/reject")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Update order ETA
{{baseUrl}}/orders/:orderId/duedate
QUERY PARAMS
orderId
BODY json
{
"DueDate": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/duedate");
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 \"DueDate\": \"2019-12-25T14:45:28Z\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/duedate" {:content-type :json
:form-params {:DueDate "2019-12-25T14:45:28Z"}})
require "http/client"
url = "{{baseUrl}}/orders/:orderId/duedate"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"DueDate\": \"2019-12-25T14:45:28Z\"\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}}/orders/:orderId/duedate"),
Content = new StringContent("{\n \"DueDate\": \"2019-12-25T14:45:28Z\"\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/:orderId/duedate");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"DueDate\": \"2019-12-25T14:45:28Z\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/duedate"
payload := strings.NewReader("{\n \"DueDate\": \"2019-12-25T14:45:28Z\"\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/orders/:orderId/duedate HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 39
{
"DueDate": "2019-12-25T14:45:28Z"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/duedate")
.setHeader("content-type", "application/json")
.setBody("{\n \"DueDate\": \"2019-12-25T14:45:28Z\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/duedate"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"DueDate\": \"2019-12-25T14:45:28Z\"\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 \"DueDate\": \"2019-12-25T14:45:28Z\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/duedate")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/duedate")
.header("content-type", "application/json")
.body("{\n \"DueDate\": \"2019-12-25T14:45:28Z\"\n}")
.asString();
const data = JSON.stringify({
DueDate: '2019-12-25T14:45:28Z'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/duedate');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/duedate',
headers: {'content-type': 'application/json'},
data: {DueDate: '2019-12-25T14:45:28Z'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/duedate';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DueDate":"2019-12-25T14:45:28Z"}'
};
try {
const response = await 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/:orderId/duedate',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "DueDate": "2019-12-25T14:45:28Z"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"DueDate\": \"2019-12-25T14:45:28Z\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/duedate")
.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/orders/:orderId/duedate',
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({DueDate: '2019-12-25T14:45:28Z'}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/duedate',
headers: {'content-type': 'application/json'},
body: {DueDate: '2019-12-25T14:45:28Z'},
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}}/orders/:orderId/duedate');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
DueDate: '2019-12-25T14:45:28Z'
});
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}}/orders/:orderId/duedate',
headers: {'content-type': 'application/json'},
data: {DueDate: '2019-12-25T14:45:28Z'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/duedate';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DueDate":"2019-12-25T14:45:28Z"}'
};
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 = @{ @"DueDate": @"2019-12-25T14:45:28Z" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/duedate"]
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}}/orders/:orderId/duedate" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"DueDate\": \"2019-12-25T14:45:28Z\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/duedate",
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([
'DueDate' => '2019-12-25T14:45:28Z'
]),
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}}/orders/:orderId/duedate', [
'body' => '{
"DueDate": "2019-12-25T14:45:28Z"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/duedate');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'DueDate' => '2019-12-25T14:45:28Z'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'DueDate' => '2019-12-25T14:45:28Z'
]));
$request->setRequestUrl('{{baseUrl}}/orders/:orderId/duedate');
$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}}/orders/:orderId/duedate' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DueDate": "2019-12-25T14:45:28Z"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/duedate' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DueDate": "2019-12-25T14:45:28Z"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"DueDate\": \"2019-12-25T14:45:28Z\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/:orderId/duedate", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/duedate"
payload = { "DueDate": "2019-12-25T14:45:28Z" }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/duedate"
payload <- "{\n \"DueDate\": \"2019-12-25T14:45:28Z\"\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}}/orders/:orderId/duedate")
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 \"DueDate\": \"2019-12-25T14:45:28Z\"\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/orders/:orderId/duedate') do |req|
req.body = "{\n \"DueDate\": \"2019-12-25T14:45:28Z\"\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}}/orders/:orderId/duedate";
let payload = json!({"DueDate": "2019-12-25T14:45:28Z"});
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}}/orders/:orderId/duedate \
--header 'content-type: application/json' \
--data '{
"DueDate": "2019-12-25T14:45:28Z"
}'
echo '{
"DueDate": "2019-12-25T14:45:28Z"
}' | \
http PUT {{baseUrl}}/orders/:orderId/duedate \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "DueDate": "2019-12-25T14:45:28Z"\n}' \
--output-document \
- {{baseUrl}}/orders/:orderId/duedate
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["DueDate": "2019-12-25T14:45:28Z"] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/duedate")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Acceptance requested
{{baseUrl}}/acceptance-requested
BODY json
{
"Currency": "",
"Customer": {
"Id": "",
"Name": "",
"PreviousRestaurantOrderCount": "",
"PreviousTotalOrderCount": ""
},
"CustomerNotes": {},
"FriendlyOrderReference": "",
"Fulfilment": {
"Address": {
"City": "",
"Geolocation": {
"Latitude": "",
"Longitude": ""
},
"Lines": [],
"PostalCode": ""
},
"CustomerDueAsap": false,
"CustomerDueDate": "",
"Method": "",
"PhoneMaskingCode": "",
"PhoneNumber": "",
"PreparationTime": ""
},
"IsTest": false,
"Items": [
{
"Items": "",
"Name": "",
"Quantity": "",
"Reference": "",
"TotalPrice": "",
"UnitPrice": ""
}
],
"OrderId": "",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "",
"Value": ""
}
]
},
"PlacedDate": "",
"PriceBreakdown": {
"Discount": "",
"Fees": {
"Delivery": "",
"Other": "",
"ServiceCharge": ""
},
"Items": "",
"Taxes": "",
"Tips": ""
},
"Restaurant": {
"Address": {},
"Id": "",
"Name": "",
"PhoneNumber": "",
"Reference": "",
"TimeZone": ""
},
"Restrictions": [
{
"Type": ""
}
],
"TotalPrice": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/acceptance-requested");
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 \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/acceptance-requested" {:content-type :json
:form-params {:Currency "GBP"
:Customer {:Id 12345
:Name "Bruce Wayne"
:PreviousRestaurantOrderCount 5
:PreviousTotalOrderCount 83}
:CustomerNotes {:noteForDelivery "delivery note"
:noteForRestaurant "restaurant note"}
:FriendlyOrderReference "REF0001"
:Fulfilment {:Address {:City "London"
:Geolocation {:Latitude 51.51641
:Longitude -0.103198}
:Lines ["Fleet Place House" "Fleet Pl"]
:PostalCode "EC4M 7RD"}
:CustomerDueAsap false
:CustomerDueDate "2018-03-10T14:45:28Z"
:Method "Delivery"
:PhoneMaskingCode "9999999"
:PhoneNumber "+441234567890"
:PreparationTime "0:23:32"}
:IsTest true
:Items [{:Items [{:Items []
:Name "Fries"
:Quantity 1
:Reference "9876"
:Synonym "Regular"
:UnitPrice 0} {:Items []
:Name "Pepsi"
:Quantity 2
:Reference "6789"
:Synonym "330ml"
:UnitPrice 0}]
:Name "Chicken Box Meal"
:Quantity 2
:Reference "1234"
:Synonym ""
:TotalPrice 10
:UnitPrice 5} {:Items []
:Name "Milkshake"
:Quantity 1
:Reference "4321"
:Synonym ""
:TotalPrice 7.25
:UnitPrice 7.25}]
:OrderId "ABCD654321"
:Payment {:Lines [{:Paid false
:Type "AccountCredit"
:Value 19.25} {:Paid true
:Type "CreditCard"
:Value 19.25}]}
:PlacedDate "2018-03-10T14:45:28Z"
:PriceBreakdown {:Discount 0
:Fees {:Delivery 1
:Other 0
:ServiceCharge 0.5}
:Items 17.25
:Taxes 3.85
:Tips 0.5}
:Restaurant {:Address {:City "London"
:Geolocation {:Latitude 51.4484
:Longitude -0.1504}
:Lines ["Oldridge Road"]
:PostalCode "SW12 8PW"}
:Id "I12345"
:Name "Just Eat Test Restaurant"
:PhoneNumber "+441200000000"
:Refererence "R99999"
:TimeZone "Australia/Sydney (IANA format)"}
:Restrictions [{:Type "Alcohol"}]
:TotalPrice 19.25}})
require "http/client"
url = "{{baseUrl}}/acceptance-requested"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\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}}/acceptance-requested"),
Content = new StringContent("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\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}}/acceptance-requested");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/acceptance-requested"
payload := strings.NewReader("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\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/acceptance-requested HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2533
{
"Currency": "GBP",
"Customer": {
"Id": 12345,
"Name": "Bruce Wayne",
"PreviousRestaurantOrderCount": 5,
"PreviousTotalOrderCount": 83
},
"CustomerNotes": {
"noteForDelivery": "delivery note",
"noteForRestaurant": "restaurant note"
},
"FriendlyOrderReference": "REF0001",
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneMaskingCode": "9999999",
"PhoneNumber": "+441234567890",
"PreparationTime": "0:23:32"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "ABCD654321",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "AccountCredit",
"Value": 19.25
},
{
"Paid": true,
"Type": "CreditCard",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "I12345",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999",
"TimeZone": "Australia/Sydney (IANA format)"
},
"Restrictions": [
{
"Type": "Alcohol"
}
],
"TotalPrice": 19.25
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/acceptance-requested")
.setHeader("content-type", "application/json")
.setBody("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/acceptance-requested"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\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 \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/acceptance-requested")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/acceptance-requested")
.header("content-type", "application/json")
.body("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\n}")
.asString();
const data = JSON.stringify({
Currency: 'GBP',
Customer: {
Id: 12345,
Name: 'Bruce Wayne',
PreviousRestaurantOrderCount: 5,
PreviousTotalOrderCount: 83
},
CustomerNotes: {
noteForDelivery: 'delivery note',
noteForRestaurant: 'restaurant note'
},
FriendlyOrderReference: 'REF0001',
Fulfilment: {
Address: {
City: 'London',
Geolocation: {
Latitude: 51.51641,
Longitude: -0.103198
},
Lines: [
'Fleet Place House',
'Fleet Pl'
],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneMaskingCode: '9999999',
PhoneNumber: '+441234567890',
PreparationTime: '0:23:32'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'ABCD654321',
Payment: {
Lines: [
{
Paid: false,
Type: 'AccountCredit',
Value: 19.25
},
{
Paid: true,
Type: 'CreditCard',
Value: 19.25
}
]
},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {
Delivery: 1,
Other: 0,
ServiceCharge: 0.5
},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {
Latitude: 51.4484,
Longitude: -0.1504
},
Lines: [
'Oldridge Road'
],
PostalCode: 'SW12 8PW'
},
Id: 'I12345',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999',
TimeZone: 'Australia/Sydney (IANA format)'
},
Restrictions: [
{
Type: 'Alcohol'
}
],
TotalPrice: 19.25
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/acceptance-requested');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/acceptance-requested',
headers: {'content-type': 'application/json'},
data: {
Currency: 'GBP',
Customer: {
Id: 12345,
Name: 'Bruce Wayne',
PreviousRestaurantOrderCount: 5,
PreviousTotalOrderCount: 83
},
CustomerNotes: {noteForDelivery: 'delivery note', noteForRestaurant: 'restaurant note'},
FriendlyOrderReference: 'REF0001',
Fulfilment: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.51641, Longitude: -0.103198},
Lines: ['Fleet Place House', 'Fleet Pl'],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneMaskingCode: '9999999',
PhoneNumber: '+441234567890',
PreparationTime: '0:23:32'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'ABCD654321',
Payment: {
Lines: [
{Paid: false, Type: 'AccountCredit', Value: 19.25},
{Paid: true, Type: 'CreditCard', Value: 19.25}
]
},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {Delivery: 1, Other: 0, ServiceCharge: 0.5},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.4484, Longitude: -0.1504},
Lines: ['Oldridge Road'],
PostalCode: 'SW12 8PW'
},
Id: 'I12345',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999',
TimeZone: 'Australia/Sydney (IANA format)'
},
Restrictions: [{Type: 'Alcohol'}],
TotalPrice: 19.25
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/acceptance-requested';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"Currency":"GBP","Customer":{"Id":12345,"Name":"Bruce Wayne","PreviousRestaurantOrderCount":5,"PreviousTotalOrderCount":83},"CustomerNotes":{"noteForDelivery":"delivery note","noteForRestaurant":"restaurant note"},"FriendlyOrderReference":"REF0001","Fulfilment":{"Address":{"City":"London","Geolocation":{"Latitude":51.51641,"Longitude":-0.103198},"Lines":["Fleet Place House","Fleet Pl"],"PostalCode":"EC4M 7RD"},"CustomerDueAsap":false,"CustomerDueDate":"2018-03-10T14:45:28Z","Method":"Delivery","PhoneMaskingCode":"9999999","PhoneNumber":"+441234567890","PreparationTime":"0:23:32"},"IsTest":true,"Items":[{"Items":[{"Items":[],"Name":"Fries","Quantity":1,"Reference":"9876","Synonym":"Regular","UnitPrice":0},{"Items":[],"Name":"Pepsi","Quantity":2,"Reference":"6789","Synonym":"330ml","UnitPrice":0}],"Name":"Chicken Box Meal","Quantity":2,"Reference":"1234","Synonym":"","TotalPrice":10,"UnitPrice":5},{"Items":[],"Name":"Milkshake","Quantity":1,"Reference":"4321","Synonym":"","TotalPrice":7.25,"UnitPrice":7.25}],"OrderId":"ABCD654321","Payment":{"Lines":[{"Paid":false,"Type":"AccountCredit","Value":19.25},{"Paid":true,"Type":"CreditCard","Value":19.25}]},"PlacedDate":"2018-03-10T14:45:28Z","PriceBreakdown":{"Discount":0,"Fees":{"Delivery":1,"Other":0,"ServiceCharge":0.5},"Items":17.25,"Taxes":3.85,"Tips":0.5},"Restaurant":{"Address":{"City":"London","Geolocation":{"Latitude":51.4484,"Longitude":-0.1504},"Lines":["Oldridge Road"],"PostalCode":"SW12 8PW"},"Id":"I12345","Name":"Just Eat Test Restaurant","PhoneNumber":"+441200000000","Refererence":"R99999","TimeZone":"Australia/Sydney (IANA format)"},"Restrictions":[{"Type":"Alcohol"}],"TotalPrice":19.25}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/acceptance-requested',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Currency": "GBP",\n "Customer": {\n "Id": 12345,\n "Name": "Bruce Wayne",\n "PreviousRestaurantOrderCount": 5,\n "PreviousTotalOrderCount": 83\n },\n "CustomerNotes": {\n "noteForDelivery": "delivery note",\n "noteForRestaurant": "restaurant note"\n },\n "FriendlyOrderReference": "REF0001",\n "Fulfilment": {\n "Address": {\n "City": "London",\n "Geolocation": {\n "Latitude": 51.51641,\n "Longitude": -0.103198\n },\n "Lines": [\n "Fleet Place House",\n "Fleet Pl"\n ],\n "PostalCode": "EC4M 7RD"\n },\n "CustomerDueAsap": false,\n "CustomerDueDate": "2018-03-10T14:45:28Z",\n "Method": "Delivery",\n "PhoneMaskingCode": "9999999",\n "PhoneNumber": "+441234567890",\n "PreparationTime": "0:23:32"\n },\n "IsTest": true,\n "Items": [\n {\n "Items": [\n {\n "Items": [],\n "Name": "Fries",\n "Quantity": 1,\n "Reference": "9876",\n "Synonym": "Regular",\n "UnitPrice": 0\n },\n {\n "Items": [],\n "Name": "Pepsi",\n "Quantity": 2,\n "Reference": "6789",\n "Synonym": "330ml",\n "UnitPrice": 0\n }\n ],\n "Name": "Chicken Box Meal",\n "Quantity": 2,\n "Reference": "1234",\n "Synonym": "",\n "TotalPrice": 10,\n "UnitPrice": 5\n },\n {\n "Items": [],\n "Name": "Milkshake",\n "Quantity": 1,\n "Reference": "4321",\n "Synonym": "",\n "TotalPrice": 7.25,\n "UnitPrice": 7.25\n }\n ],\n "OrderId": "ABCD654321",\n "Payment": {\n "Lines": [\n {\n "Paid": false,\n "Type": "AccountCredit",\n "Value": 19.25\n },\n {\n "Paid": true,\n "Type": "CreditCard",\n "Value": 19.25\n }\n ]\n },\n "PlacedDate": "2018-03-10T14:45:28Z",\n "PriceBreakdown": {\n "Discount": 0,\n "Fees": {\n "Delivery": 1,\n "Other": 0,\n "ServiceCharge": 0.5\n },\n "Items": 17.25,\n "Taxes": 3.85,\n "Tips": 0.5\n },\n "Restaurant": {\n "Address": {\n "City": "London",\n "Geolocation": {\n "Latitude": 51.4484,\n "Longitude": -0.1504\n },\n "Lines": [\n "Oldridge Road"\n ],\n "PostalCode": "SW12 8PW"\n },\n "Id": "I12345",\n "Name": "Just Eat Test Restaurant",\n "PhoneNumber": "+441200000000",\n "Refererence": "R99999",\n "TimeZone": "Australia/Sydney (IANA format)"\n },\n "Restrictions": [\n {\n "Type": "Alcohol"\n }\n ],\n "TotalPrice": 19.25\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\n}")
val request = Request.Builder()
.url("{{baseUrl}}/acceptance-requested")
.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/acceptance-requested',
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({
Currency: 'GBP',
Customer: {
Id: 12345,
Name: 'Bruce Wayne',
PreviousRestaurantOrderCount: 5,
PreviousTotalOrderCount: 83
},
CustomerNotes: {noteForDelivery: 'delivery note', noteForRestaurant: 'restaurant note'},
FriendlyOrderReference: 'REF0001',
Fulfilment: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.51641, Longitude: -0.103198},
Lines: ['Fleet Place House', 'Fleet Pl'],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneMaskingCode: '9999999',
PhoneNumber: '+441234567890',
PreparationTime: '0:23:32'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'ABCD654321',
Payment: {
Lines: [
{Paid: false, Type: 'AccountCredit', Value: 19.25},
{Paid: true, Type: 'CreditCard', Value: 19.25}
]
},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {Delivery: 1, Other: 0, ServiceCharge: 0.5},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.4484, Longitude: -0.1504},
Lines: ['Oldridge Road'],
PostalCode: 'SW12 8PW'
},
Id: 'I12345',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999',
TimeZone: 'Australia/Sydney (IANA format)'
},
Restrictions: [{Type: 'Alcohol'}],
TotalPrice: 19.25
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/acceptance-requested',
headers: {'content-type': 'application/json'},
body: {
Currency: 'GBP',
Customer: {
Id: 12345,
Name: 'Bruce Wayne',
PreviousRestaurantOrderCount: 5,
PreviousTotalOrderCount: 83
},
CustomerNotes: {noteForDelivery: 'delivery note', noteForRestaurant: 'restaurant note'},
FriendlyOrderReference: 'REF0001',
Fulfilment: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.51641, Longitude: -0.103198},
Lines: ['Fleet Place House', 'Fleet Pl'],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneMaskingCode: '9999999',
PhoneNumber: '+441234567890',
PreparationTime: '0:23:32'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'ABCD654321',
Payment: {
Lines: [
{Paid: false, Type: 'AccountCredit', Value: 19.25},
{Paid: true, Type: 'CreditCard', Value: 19.25}
]
},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {Delivery: 1, Other: 0, ServiceCharge: 0.5},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.4484, Longitude: -0.1504},
Lines: ['Oldridge Road'],
PostalCode: 'SW12 8PW'
},
Id: 'I12345',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999',
TimeZone: 'Australia/Sydney (IANA format)'
},
Restrictions: [{Type: 'Alcohol'}],
TotalPrice: 19.25
},
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}}/acceptance-requested');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Currency: 'GBP',
Customer: {
Id: 12345,
Name: 'Bruce Wayne',
PreviousRestaurantOrderCount: 5,
PreviousTotalOrderCount: 83
},
CustomerNotes: {
noteForDelivery: 'delivery note',
noteForRestaurant: 'restaurant note'
},
FriendlyOrderReference: 'REF0001',
Fulfilment: {
Address: {
City: 'London',
Geolocation: {
Latitude: 51.51641,
Longitude: -0.103198
},
Lines: [
'Fleet Place House',
'Fleet Pl'
],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneMaskingCode: '9999999',
PhoneNumber: '+441234567890',
PreparationTime: '0:23:32'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'ABCD654321',
Payment: {
Lines: [
{
Paid: false,
Type: 'AccountCredit',
Value: 19.25
},
{
Paid: true,
Type: 'CreditCard',
Value: 19.25
}
]
},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {
Delivery: 1,
Other: 0,
ServiceCharge: 0.5
},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {
Latitude: 51.4484,
Longitude: -0.1504
},
Lines: [
'Oldridge Road'
],
PostalCode: 'SW12 8PW'
},
Id: 'I12345',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999',
TimeZone: 'Australia/Sydney (IANA format)'
},
Restrictions: [
{
Type: 'Alcohol'
}
],
TotalPrice: 19.25
});
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}}/acceptance-requested',
headers: {'content-type': 'application/json'},
data: {
Currency: 'GBP',
Customer: {
Id: 12345,
Name: 'Bruce Wayne',
PreviousRestaurantOrderCount: 5,
PreviousTotalOrderCount: 83
},
CustomerNotes: {noteForDelivery: 'delivery note', noteForRestaurant: 'restaurant note'},
FriendlyOrderReference: 'REF0001',
Fulfilment: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.51641, Longitude: -0.103198},
Lines: ['Fleet Place House', 'Fleet Pl'],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneMaskingCode: '9999999',
PhoneNumber: '+441234567890',
PreparationTime: '0:23:32'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'ABCD654321',
Payment: {
Lines: [
{Paid: false, Type: 'AccountCredit', Value: 19.25},
{Paid: true, Type: 'CreditCard', Value: 19.25}
]
},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {Delivery: 1, Other: 0, ServiceCharge: 0.5},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.4484, Longitude: -0.1504},
Lines: ['Oldridge Road'],
PostalCode: 'SW12 8PW'
},
Id: 'I12345',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999',
TimeZone: 'Australia/Sydney (IANA format)'
},
Restrictions: [{Type: 'Alcohol'}],
TotalPrice: 19.25
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/acceptance-requested';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"Currency":"GBP","Customer":{"Id":12345,"Name":"Bruce Wayne","PreviousRestaurantOrderCount":5,"PreviousTotalOrderCount":83},"CustomerNotes":{"noteForDelivery":"delivery note","noteForRestaurant":"restaurant note"},"FriendlyOrderReference":"REF0001","Fulfilment":{"Address":{"City":"London","Geolocation":{"Latitude":51.51641,"Longitude":-0.103198},"Lines":["Fleet Place House","Fleet Pl"],"PostalCode":"EC4M 7RD"},"CustomerDueAsap":false,"CustomerDueDate":"2018-03-10T14:45:28Z","Method":"Delivery","PhoneMaskingCode":"9999999","PhoneNumber":"+441234567890","PreparationTime":"0:23:32"},"IsTest":true,"Items":[{"Items":[{"Items":[],"Name":"Fries","Quantity":1,"Reference":"9876","Synonym":"Regular","UnitPrice":0},{"Items":[],"Name":"Pepsi","Quantity":2,"Reference":"6789","Synonym":"330ml","UnitPrice":0}],"Name":"Chicken Box Meal","Quantity":2,"Reference":"1234","Synonym":"","TotalPrice":10,"UnitPrice":5},{"Items":[],"Name":"Milkshake","Quantity":1,"Reference":"4321","Synonym":"","TotalPrice":7.25,"UnitPrice":7.25}],"OrderId":"ABCD654321","Payment":{"Lines":[{"Paid":false,"Type":"AccountCredit","Value":19.25},{"Paid":true,"Type":"CreditCard","Value":19.25}]},"PlacedDate":"2018-03-10T14:45:28Z","PriceBreakdown":{"Discount":0,"Fees":{"Delivery":1,"Other":0,"ServiceCharge":0.5},"Items":17.25,"Taxes":3.85,"Tips":0.5},"Restaurant":{"Address":{"City":"London","Geolocation":{"Latitude":51.4484,"Longitude":-0.1504},"Lines":["Oldridge Road"],"PostalCode":"SW12 8PW"},"Id":"I12345","Name":"Just Eat Test Restaurant","PhoneNumber":"+441200000000","Refererence":"R99999","TimeZone":"Australia/Sydney (IANA format)"},"Restrictions":[{"Type":"Alcohol"}],"TotalPrice":19.25}'
};
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 = @{ @"Currency": @"GBP",
@"Customer": @{ @"Id": @12345, @"Name": @"Bruce Wayne", @"PreviousRestaurantOrderCount": @5, @"PreviousTotalOrderCount": @83 },
@"CustomerNotes": @{ @"noteForDelivery": @"delivery note", @"noteForRestaurant": @"restaurant note" },
@"FriendlyOrderReference": @"REF0001",
@"Fulfilment": @{ @"Address": @{ @"City": @"London", @"Geolocation": @{ @"Latitude": @51.51641, @"Longitude": @-0.103198 }, @"Lines": @[ @"Fleet Place House", @"Fleet Pl" ], @"PostalCode": @"EC4M 7RD" }, @"CustomerDueAsap": @NO, @"CustomerDueDate": @"2018-03-10T14:45:28Z", @"Method": @"Delivery", @"PhoneMaskingCode": @"9999999", @"PhoneNumber": @"+441234567890", @"PreparationTime": @"0:23:32" },
@"IsTest": @YES,
@"Items": @[ @{ @"Items": @[ @{ @"Items": @[ ], @"Name": @"Fries", @"Quantity": @1, @"Reference": @"9876", @"Synonym": @"Regular", @"UnitPrice": @0 }, @{ @"Items": @[ ], @"Name": @"Pepsi", @"Quantity": @2, @"Reference": @"6789", @"Synonym": @"330ml", @"UnitPrice": @0 } ], @"Name": @"Chicken Box Meal", @"Quantity": @2, @"Reference": @"1234", @"Synonym": @"", @"TotalPrice": @10, @"UnitPrice": @5 }, @{ @"Items": @[ ], @"Name": @"Milkshake", @"Quantity": @1, @"Reference": @"4321", @"Synonym": @"", @"TotalPrice": @7.25, @"UnitPrice": @7.25 } ],
@"OrderId": @"ABCD654321",
@"Payment": @{ @"Lines": @[ @{ @"Paid": @NO, @"Type": @"AccountCredit", @"Value": @19.25 }, @{ @"Paid": @YES, @"Type": @"CreditCard", @"Value": @19.25 } ] },
@"PlacedDate": @"2018-03-10T14:45:28Z",
@"PriceBreakdown": @{ @"Discount": @0, @"Fees": @{ @"Delivery": @1, @"Other": @0, @"ServiceCharge": @0.5 }, @"Items": @17.25, @"Taxes": @3.85, @"Tips": @0.5 },
@"Restaurant": @{ @"Address": @{ @"City": @"London", @"Geolocation": @{ @"Latitude": @51.4484, @"Longitude": @-0.1504 }, @"Lines": @[ @"Oldridge Road" ], @"PostalCode": @"SW12 8PW" }, @"Id": @"I12345", @"Name": @"Just Eat Test Restaurant", @"PhoneNumber": @"+441200000000", @"Refererence": @"R99999", @"TimeZone": @"Australia/Sydney (IANA format)" },
@"Restrictions": @[ @{ @"Type": @"Alcohol" } ],
@"TotalPrice": @19.25 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/acceptance-requested"]
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}}/acceptance-requested" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/acceptance-requested",
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([
'Currency' => 'GBP',
'Customer' => [
'Id' => 12345,
'Name' => 'Bruce Wayne',
'PreviousRestaurantOrderCount' => 5,
'PreviousTotalOrderCount' => 83
],
'CustomerNotes' => [
'noteForDelivery' => 'delivery note',
'noteForRestaurant' => 'restaurant note'
],
'FriendlyOrderReference' => 'REF0001',
'Fulfilment' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.51641,
'Longitude' => -0.103198
],
'Lines' => [
'Fleet Place House',
'Fleet Pl'
],
'PostalCode' => 'EC4M 7RD'
],
'CustomerDueAsap' => null,
'CustomerDueDate' => '2018-03-10T14:45:28Z',
'Method' => 'Delivery',
'PhoneMaskingCode' => '9999999',
'PhoneNumber' => '+441234567890',
'PreparationTime' => '0:23:32'
],
'IsTest' => null,
'Items' => [
[
'Items' => [
[
'Items' => [
],
'Name' => 'Fries',
'Quantity' => 1,
'Reference' => '9876',
'Synonym' => 'Regular',
'UnitPrice' => 0
],
[
'Items' => [
],
'Name' => 'Pepsi',
'Quantity' => 2,
'Reference' => '6789',
'Synonym' => '330ml',
'UnitPrice' => 0
]
],
'Name' => 'Chicken Box Meal',
'Quantity' => 2,
'Reference' => '1234',
'Synonym' => '',
'TotalPrice' => 10,
'UnitPrice' => 5
],
[
'Items' => [
],
'Name' => 'Milkshake',
'Quantity' => 1,
'Reference' => '4321',
'Synonym' => '',
'TotalPrice' => 7.25,
'UnitPrice' => 7.25
]
],
'OrderId' => 'ABCD654321',
'Payment' => [
'Lines' => [
[
'Paid' => null,
'Type' => 'AccountCredit',
'Value' => 19.25
],
[
'Paid' => null,
'Type' => 'CreditCard',
'Value' => 19.25
]
]
],
'PlacedDate' => '2018-03-10T14:45:28Z',
'PriceBreakdown' => [
'Discount' => 0,
'Fees' => [
'Delivery' => 1,
'Other' => 0,
'ServiceCharge' => 0.5
],
'Items' => 17.25,
'Taxes' => 3.85,
'Tips' => 0.5
],
'Restaurant' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.4484,
'Longitude' => -0.1504
],
'Lines' => [
'Oldridge Road'
],
'PostalCode' => 'SW12 8PW'
],
'Id' => 'I12345',
'Name' => 'Just Eat Test Restaurant',
'PhoneNumber' => '+441200000000',
'Refererence' => 'R99999',
'TimeZone' => 'Australia/Sydney (IANA format)'
],
'Restrictions' => [
[
'Type' => 'Alcohol'
]
],
'TotalPrice' => 19.25
]),
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}}/acceptance-requested', [
'body' => '{
"Currency": "GBP",
"Customer": {
"Id": 12345,
"Name": "Bruce Wayne",
"PreviousRestaurantOrderCount": 5,
"PreviousTotalOrderCount": 83
},
"CustomerNotes": {
"noteForDelivery": "delivery note",
"noteForRestaurant": "restaurant note"
},
"FriendlyOrderReference": "REF0001",
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneMaskingCode": "9999999",
"PhoneNumber": "+441234567890",
"PreparationTime": "0:23:32"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "ABCD654321",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "AccountCredit",
"Value": 19.25
},
{
"Paid": true,
"Type": "CreditCard",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "I12345",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999",
"TimeZone": "Australia/Sydney (IANA format)"
},
"Restrictions": [
{
"Type": "Alcohol"
}
],
"TotalPrice": 19.25
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/acceptance-requested');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Currency' => 'GBP',
'Customer' => [
'Id' => 12345,
'Name' => 'Bruce Wayne',
'PreviousRestaurantOrderCount' => 5,
'PreviousTotalOrderCount' => 83
],
'CustomerNotes' => [
'noteForDelivery' => 'delivery note',
'noteForRestaurant' => 'restaurant note'
],
'FriendlyOrderReference' => 'REF0001',
'Fulfilment' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.51641,
'Longitude' => -0.103198
],
'Lines' => [
'Fleet Place House',
'Fleet Pl'
],
'PostalCode' => 'EC4M 7RD'
],
'CustomerDueAsap' => null,
'CustomerDueDate' => '2018-03-10T14:45:28Z',
'Method' => 'Delivery',
'PhoneMaskingCode' => '9999999',
'PhoneNumber' => '+441234567890',
'PreparationTime' => '0:23:32'
],
'IsTest' => null,
'Items' => [
[
'Items' => [
[
'Items' => [
],
'Name' => 'Fries',
'Quantity' => 1,
'Reference' => '9876',
'Synonym' => 'Regular',
'UnitPrice' => 0
],
[
'Items' => [
],
'Name' => 'Pepsi',
'Quantity' => 2,
'Reference' => '6789',
'Synonym' => '330ml',
'UnitPrice' => 0
]
],
'Name' => 'Chicken Box Meal',
'Quantity' => 2,
'Reference' => '1234',
'Synonym' => '',
'TotalPrice' => 10,
'UnitPrice' => 5
],
[
'Items' => [
],
'Name' => 'Milkshake',
'Quantity' => 1,
'Reference' => '4321',
'Synonym' => '',
'TotalPrice' => 7.25,
'UnitPrice' => 7.25
]
],
'OrderId' => 'ABCD654321',
'Payment' => [
'Lines' => [
[
'Paid' => null,
'Type' => 'AccountCredit',
'Value' => 19.25
],
[
'Paid' => null,
'Type' => 'CreditCard',
'Value' => 19.25
]
]
],
'PlacedDate' => '2018-03-10T14:45:28Z',
'PriceBreakdown' => [
'Discount' => 0,
'Fees' => [
'Delivery' => 1,
'Other' => 0,
'ServiceCharge' => 0.5
],
'Items' => 17.25,
'Taxes' => 3.85,
'Tips' => 0.5
],
'Restaurant' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.4484,
'Longitude' => -0.1504
],
'Lines' => [
'Oldridge Road'
],
'PostalCode' => 'SW12 8PW'
],
'Id' => 'I12345',
'Name' => 'Just Eat Test Restaurant',
'PhoneNumber' => '+441200000000',
'Refererence' => 'R99999',
'TimeZone' => 'Australia/Sydney (IANA format)'
],
'Restrictions' => [
[
'Type' => 'Alcohol'
]
],
'TotalPrice' => 19.25
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Currency' => 'GBP',
'Customer' => [
'Id' => 12345,
'Name' => 'Bruce Wayne',
'PreviousRestaurantOrderCount' => 5,
'PreviousTotalOrderCount' => 83
],
'CustomerNotes' => [
'noteForDelivery' => 'delivery note',
'noteForRestaurant' => 'restaurant note'
],
'FriendlyOrderReference' => 'REF0001',
'Fulfilment' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.51641,
'Longitude' => -0.103198
],
'Lines' => [
'Fleet Place House',
'Fleet Pl'
],
'PostalCode' => 'EC4M 7RD'
],
'CustomerDueAsap' => null,
'CustomerDueDate' => '2018-03-10T14:45:28Z',
'Method' => 'Delivery',
'PhoneMaskingCode' => '9999999',
'PhoneNumber' => '+441234567890',
'PreparationTime' => '0:23:32'
],
'IsTest' => null,
'Items' => [
[
'Items' => [
[
'Items' => [
],
'Name' => 'Fries',
'Quantity' => 1,
'Reference' => '9876',
'Synonym' => 'Regular',
'UnitPrice' => 0
],
[
'Items' => [
],
'Name' => 'Pepsi',
'Quantity' => 2,
'Reference' => '6789',
'Synonym' => '330ml',
'UnitPrice' => 0
]
],
'Name' => 'Chicken Box Meal',
'Quantity' => 2,
'Reference' => '1234',
'Synonym' => '',
'TotalPrice' => 10,
'UnitPrice' => 5
],
[
'Items' => [
],
'Name' => 'Milkshake',
'Quantity' => 1,
'Reference' => '4321',
'Synonym' => '',
'TotalPrice' => 7.25,
'UnitPrice' => 7.25
]
],
'OrderId' => 'ABCD654321',
'Payment' => [
'Lines' => [
[
'Paid' => null,
'Type' => 'AccountCredit',
'Value' => 19.25
],
[
'Paid' => null,
'Type' => 'CreditCard',
'Value' => 19.25
]
]
],
'PlacedDate' => '2018-03-10T14:45:28Z',
'PriceBreakdown' => [
'Discount' => 0,
'Fees' => [
'Delivery' => 1,
'Other' => 0,
'ServiceCharge' => 0.5
],
'Items' => 17.25,
'Taxes' => 3.85,
'Tips' => 0.5
],
'Restaurant' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.4484,
'Longitude' => -0.1504
],
'Lines' => [
'Oldridge Road'
],
'PostalCode' => 'SW12 8PW'
],
'Id' => 'I12345',
'Name' => 'Just Eat Test Restaurant',
'PhoneNumber' => '+441200000000',
'Refererence' => 'R99999',
'TimeZone' => 'Australia/Sydney (IANA format)'
],
'Restrictions' => [
[
'Type' => 'Alcohol'
]
],
'TotalPrice' => 19.25
]));
$request->setRequestUrl('{{baseUrl}}/acceptance-requested');
$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}}/acceptance-requested' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Currency": "GBP",
"Customer": {
"Id": 12345,
"Name": "Bruce Wayne",
"PreviousRestaurantOrderCount": 5,
"PreviousTotalOrderCount": 83
},
"CustomerNotes": {
"noteForDelivery": "delivery note",
"noteForRestaurant": "restaurant note"
},
"FriendlyOrderReference": "REF0001",
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneMaskingCode": "9999999",
"PhoneNumber": "+441234567890",
"PreparationTime": "0:23:32"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "ABCD654321",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "AccountCredit",
"Value": 19.25
},
{
"Paid": true,
"Type": "CreditCard",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "I12345",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999",
"TimeZone": "Australia/Sydney (IANA format)"
},
"Restrictions": [
{
"Type": "Alcohol"
}
],
"TotalPrice": 19.25
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/acceptance-requested' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Currency": "GBP",
"Customer": {
"Id": 12345,
"Name": "Bruce Wayne",
"PreviousRestaurantOrderCount": 5,
"PreviousTotalOrderCount": 83
},
"CustomerNotes": {
"noteForDelivery": "delivery note",
"noteForRestaurant": "restaurant note"
},
"FriendlyOrderReference": "REF0001",
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneMaskingCode": "9999999",
"PhoneNumber": "+441234567890",
"PreparationTime": "0:23:32"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "ABCD654321",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "AccountCredit",
"Value": 19.25
},
{
"Paid": true,
"Type": "CreditCard",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "I12345",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999",
"TimeZone": "Australia/Sydney (IANA format)"
},
"Restrictions": [
{
"Type": "Alcohol"
}
],
"TotalPrice": 19.25
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/acceptance-requested", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/acceptance-requested"
payload = {
"Currency": "GBP",
"Customer": {
"Id": 12345,
"Name": "Bruce Wayne",
"PreviousRestaurantOrderCount": 5,
"PreviousTotalOrderCount": 83
},
"CustomerNotes": {
"noteForDelivery": "delivery note",
"noteForRestaurant": "restaurant note"
},
"FriendlyOrderReference": "REF0001",
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": ["Fleet Place House", "Fleet Pl"],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": False,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneMaskingCode": "9999999",
"PhoneNumber": "+441234567890",
"PreparationTime": "0:23:32"
},
"IsTest": True,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "ABCD654321",
"Payment": { "Lines": [
{
"Paid": False,
"Type": "AccountCredit",
"Value": 19.25
},
{
"Paid": True,
"Type": "CreditCard",
"Value": 19.25
}
] },
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": ["Oldridge Road"],
"PostalCode": "SW12 8PW"
},
"Id": "I12345",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999",
"TimeZone": "Australia/Sydney (IANA format)"
},
"Restrictions": [{ "Type": "Alcohol" }],
"TotalPrice": 19.25
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/acceptance-requested"
payload <- "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\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}}/acceptance-requested")
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 \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\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/acceptance-requested') do |req|
req.body = "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": 12345,\n \"Name\": \"Bruce Wayne\",\n \"PreviousRestaurantOrderCount\": 5,\n \"PreviousTotalOrderCount\": 83\n },\n \"CustomerNotes\": {\n \"noteForDelivery\": \"delivery note\",\n \"noteForRestaurant\": \"restaurant note\"\n },\n \"FriendlyOrderReference\": \"REF0001\",\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneMaskingCode\": \"9999999\",\n \"PhoneNumber\": \"+441234567890\",\n \"PreparationTime\": \"0:23:32\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"ABCD654321\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"AccountCredit\",\n \"Value\": 19.25\n },\n {\n \"Paid\": true,\n \"Type\": \"CreditCard\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"I12345\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\",\n \"TimeZone\": \"Australia/Sydney (IANA format)\"\n },\n \"Restrictions\": [\n {\n \"Type\": \"Alcohol\"\n }\n ],\n \"TotalPrice\": 19.25\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/acceptance-requested";
let payload = json!({
"Currency": "GBP",
"Customer": json!({
"Id": 12345,
"Name": "Bruce Wayne",
"PreviousRestaurantOrderCount": 5,
"PreviousTotalOrderCount": 83
}),
"CustomerNotes": json!({
"noteForDelivery": "delivery note",
"noteForRestaurant": "restaurant note"
}),
"FriendlyOrderReference": "REF0001",
"Fulfilment": json!({
"Address": json!({
"City": "London",
"Geolocation": json!({
"Latitude": 51.51641,
"Longitude": -0.103198
}),
"Lines": ("Fleet Place House", "Fleet Pl"),
"PostalCode": "EC4M 7RD"
}),
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneMaskingCode": "9999999",
"PhoneNumber": "+441234567890",
"PreparationTime": "0:23:32"
}),
"IsTest": true,
"Items": (
json!({
"Items": (
json!({
"Items": (),
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
}),
json!({
"Items": (),
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
})
),
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
}),
json!({
"Items": (),
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
})
),
"OrderId": "ABCD654321",
"Payment": json!({"Lines": (
json!({
"Paid": false,
"Type": "AccountCredit",
"Value": 19.25
}),
json!({
"Paid": true,
"Type": "CreditCard",
"Value": 19.25
})
)}),
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": json!({
"Discount": 0,
"Fees": json!({
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
}),
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
}),
"Restaurant": json!({
"Address": json!({
"City": "London",
"Geolocation": json!({
"Latitude": 51.4484,
"Longitude": -0.1504
}),
"Lines": ("Oldridge Road"),
"PostalCode": "SW12 8PW"
}),
"Id": "I12345",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999",
"TimeZone": "Australia/Sydney (IANA format)"
}),
"Restrictions": (json!({"Type": "Alcohol"})),
"TotalPrice": 19.25
});
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}}/acceptance-requested \
--header 'content-type: application/json' \
--data '{
"Currency": "GBP",
"Customer": {
"Id": 12345,
"Name": "Bruce Wayne",
"PreviousRestaurantOrderCount": 5,
"PreviousTotalOrderCount": 83
},
"CustomerNotes": {
"noteForDelivery": "delivery note",
"noteForRestaurant": "restaurant note"
},
"FriendlyOrderReference": "REF0001",
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneMaskingCode": "9999999",
"PhoneNumber": "+441234567890",
"PreparationTime": "0:23:32"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "ABCD654321",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "AccountCredit",
"Value": 19.25
},
{
"Paid": true,
"Type": "CreditCard",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "I12345",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999",
"TimeZone": "Australia/Sydney (IANA format)"
},
"Restrictions": [
{
"Type": "Alcohol"
}
],
"TotalPrice": 19.25
}'
echo '{
"Currency": "GBP",
"Customer": {
"Id": 12345,
"Name": "Bruce Wayne",
"PreviousRestaurantOrderCount": 5,
"PreviousTotalOrderCount": 83
},
"CustomerNotes": {
"noteForDelivery": "delivery note",
"noteForRestaurant": "restaurant note"
},
"FriendlyOrderReference": "REF0001",
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneMaskingCode": "9999999",
"PhoneNumber": "+441234567890",
"PreparationTime": "0:23:32"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "ABCD654321",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "AccountCredit",
"Value": 19.25
},
{
"Paid": true,
"Type": "CreditCard",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "I12345",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999",
"TimeZone": "Australia/Sydney (IANA format)"
},
"Restrictions": [
{
"Type": "Alcohol"
}
],
"TotalPrice": 19.25
}' | \
http POST {{baseUrl}}/acceptance-requested \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "Currency": "GBP",\n "Customer": {\n "Id": 12345,\n "Name": "Bruce Wayne",\n "PreviousRestaurantOrderCount": 5,\n "PreviousTotalOrderCount": 83\n },\n "CustomerNotes": {\n "noteForDelivery": "delivery note",\n "noteForRestaurant": "restaurant note"\n },\n "FriendlyOrderReference": "REF0001",\n "Fulfilment": {\n "Address": {\n "City": "London",\n "Geolocation": {\n "Latitude": 51.51641,\n "Longitude": -0.103198\n },\n "Lines": [\n "Fleet Place House",\n "Fleet Pl"\n ],\n "PostalCode": "EC4M 7RD"\n },\n "CustomerDueAsap": false,\n "CustomerDueDate": "2018-03-10T14:45:28Z",\n "Method": "Delivery",\n "PhoneMaskingCode": "9999999",\n "PhoneNumber": "+441234567890",\n "PreparationTime": "0:23:32"\n },\n "IsTest": true,\n "Items": [\n {\n "Items": [\n {\n "Items": [],\n "Name": "Fries",\n "Quantity": 1,\n "Reference": "9876",\n "Synonym": "Regular",\n "UnitPrice": 0\n },\n {\n "Items": [],\n "Name": "Pepsi",\n "Quantity": 2,\n "Reference": "6789",\n "Synonym": "330ml",\n "UnitPrice": 0\n }\n ],\n "Name": "Chicken Box Meal",\n "Quantity": 2,\n "Reference": "1234",\n "Synonym": "",\n "TotalPrice": 10,\n "UnitPrice": 5\n },\n {\n "Items": [],\n "Name": "Milkshake",\n "Quantity": 1,\n "Reference": "4321",\n "Synonym": "",\n "TotalPrice": 7.25,\n "UnitPrice": 7.25\n }\n ],\n "OrderId": "ABCD654321",\n "Payment": {\n "Lines": [\n {\n "Paid": false,\n "Type": "AccountCredit",\n "Value": 19.25\n },\n {\n "Paid": true,\n "Type": "CreditCard",\n "Value": 19.25\n }\n ]\n },\n "PlacedDate": "2018-03-10T14:45:28Z",\n "PriceBreakdown": {\n "Discount": 0,\n "Fees": {\n "Delivery": 1,\n "Other": 0,\n "ServiceCharge": 0.5\n },\n "Items": 17.25,\n "Taxes": 3.85,\n "Tips": 0.5\n },\n "Restaurant": {\n "Address": {\n "City": "London",\n "Geolocation": {\n "Latitude": 51.4484,\n "Longitude": -0.1504\n },\n "Lines": [\n "Oldridge Road"\n ],\n "PostalCode": "SW12 8PW"\n },\n "Id": "I12345",\n "Name": "Just Eat Test Restaurant",\n "PhoneNumber": "+441200000000",\n "Refererence": "R99999",\n "TimeZone": "Australia/Sydney (IANA format)"\n },\n "Restrictions": [\n {\n "Type": "Alcohol"\n }\n ],\n "TotalPrice": 19.25\n}' \
--output-document \
- {{baseUrl}}/acceptance-requested
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"Currency": "GBP",
"Customer": [
"Id": 12345,
"Name": "Bruce Wayne",
"PreviousRestaurantOrderCount": 5,
"PreviousTotalOrderCount": 83
],
"CustomerNotes": [
"noteForDelivery": "delivery note",
"noteForRestaurant": "restaurant note"
],
"FriendlyOrderReference": "REF0001",
"Fulfilment": [
"Address": [
"City": "London",
"Geolocation": [
"Latitude": 51.51641,
"Longitude": -0.103198
],
"Lines": ["Fleet Place House", "Fleet Pl"],
"PostalCode": "EC4M 7RD"
],
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneMaskingCode": "9999999",
"PhoneNumber": "+441234567890",
"PreparationTime": "0:23:32"
],
"IsTest": true,
"Items": [
[
"Items": [
[
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
],
[
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
]
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
],
[
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
]
],
"OrderId": "ABCD654321",
"Payment": ["Lines": [
[
"Paid": false,
"Type": "AccountCredit",
"Value": 19.25
],
[
"Paid": true,
"Type": "CreditCard",
"Value": 19.25
]
]],
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": [
"Discount": 0,
"Fees": [
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
],
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
],
"Restaurant": [
"Address": [
"City": "London",
"Geolocation": [
"Latitude": 51.4484,
"Longitude": -0.1504
],
"Lines": ["Oldridge Road"],
"PostalCode": "SW12 8PW"
],
"Id": "I12345",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999",
"TimeZone": "Australia/Sydney (IANA format)"
],
"Restrictions": [["Type": "Alcohol"]],
"TotalPrice": 19.25
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/acceptance-requested")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Customer Requested Redelivery
{{baseUrl}}/redelivery-requested
BODY json
{
"Notes": "",
"OrderId": "",
"Tenant": "",
"Update": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/redelivery-requested");
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 \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/redelivery-requested" {:content-type :json
:form-params {:Notes "Please press 123 on the door"
:OrderId "wiej234idf09i29jijgf4"
:Tenant "uk"
:Update "Please redeliver"}})
require "http/client"
url = "{{baseUrl}}/redelivery-requested"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\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}}/redelivery-requested"),
Content = new StringContent("{\n \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\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}}/redelivery-requested");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/redelivery-requested"
payload := strings.NewReader("{\n \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\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/redelivery-requested HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 133
{
"Notes": "Please press 123 on the door",
"OrderId": "wiej234idf09i29jijgf4",
"Tenant": "uk",
"Update": "Please redeliver"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/redelivery-requested")
.setHeader("content-type", "application/json")
.setBody("{\n \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/redelivery-requested"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\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 \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/redelivery-requested")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/redelivery-requested")
.header("content-type", "application/json")
.body("{\n \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\n}")
.asString();
const data = JSON.stringify({
Notes: 'Please press 123 on the door',
OrderId: 'wiej234idf09i29jijgf4',
Tenant: 'uk',
Update: 'Please redeliver'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/redelivery-requested');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/redelivery-requested',
headers: {'content-type': 'application/json'},
data: {
Notes: 'Please press 123 on the door',
OrderId: 'wiej234idf09i29jijgf4',
Tenant: 'uk',
Update: 'Please redeliver'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/redelivery-requested';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Notes":"Please press 123 on the door","OrderId":"wiej234idf09i29jijgf4","Tenant":"uk","Update":"Please redeliver"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/redelivery-requested',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Notes": "Please press 123 on the door",\n "OrderId": "wiej234idf09i29jijgf4",\n "Tenant": "uk",\n "Update": "Please redeliver"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/redelivery-requested")
.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/redelivery-requested',
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({
Notes: 'Please press 123 on the door',
OrderId: 'wiej234idf09i29jijgf4',
Tenant: 'uk',
Update: 'Please redeliver'
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/redelivery-requested',
headers: {'content-type': 'application/json'},
body: {
Notes: 'Please press 123 on the door',
OrderId: 'wiej234idf09i29jijgf4',
Tenant: 'uk',
Update: 'Please redeliver'
},
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}}/redelivery-requested');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Notes: 'Please press 123 on the door',
OrderId: 'wiej234idf09i29jijgf4',
Tenant: 'uk',
Update: 'Please redeliver'
});
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}}/redelivery-requested',
headers: {'content-type': 'application/json'},
data: {
Notes: 'Please press 123 on the door',
OrderId: 'wiej234idf09i29jijgf4',
Tenant: 'uk',
Update: 'Please redeliver'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/redelivery-requested';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Notes":"Please press 123 on the door","OrderId":"wiej234idf09i29jijgf4","Tenant":"uk","Update":"Please redeliver"}'
};
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 = @{ @"Notes": @"Please press 123 on the door",
@"OrderId": @"wiej234idf09i29jijgf4",
@"Tenant": @"uk",
@"Update": @"Please redeliver" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/redelivery-requested"]
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}}/redelivery-requested" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/redelivery-requested",
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([
'Notes' => 'Please press 123 on the door',
'OrderId' => 'wiej234idf09i29jijgf4',
'Tenant' => 'uk',
'Update' => 'Please redeliver'
]),
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}}/redelivery-requested', [
'body' => '{
"Notes": "Please press 123 on the door",
"OrderId": "wiej234idf09i29jijgf4",
"Tenant": "uk",
"Update": "Please redeliver"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/redelivery-requested');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Notes' => 'Please press 123 on the door',
'OrderId' => 'wiej234idf09i29jijgf4',
'Tenant' => 'uk',
'Update' => 'Please redeliver'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Notes' => 'Please press 123 on the door',
'OrderId' => 'wiej234idf09i29jijgf4',
'Tenant' => 'uk',
'Update' => 'Please redeliver'
]));
$request->setRequestUrl('{{baseUrl}}/redelivery-requested');
$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}}/redelivery-requested' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Notes": "Please press 123 on the door",
"OrderId": "wiej234idf09i29jijgf4",
"Tenant": "uk",
"Update": "Please redeliver"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/redelivery-requested' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Notes": "Please press 123 on the door",
"OrderId": "wiej234idf09i29jijgf4",
"Tenant": "uk",
"Update": "Please redeliver"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/redelivery-requested", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/redelivery-requested"
payload = {
"Notes": "Please press 123 on the door",
"OrderId": "wiej234idf09i29jijgf4",
"Tenant": "uk",
"Update": "Please redeliver"
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/redelivery-requested"
payload <- "{\n \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\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}}/redelivery-requested")
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 \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\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/redelivery-requested') do |req|
req.body = "{\n \"Notes\": \"Please press 123 on the door\",\n \"OrderId\": \"wiej234idf09i29jijgf4\",\n \"Tenant\": \"uk\",\n \"Update\": \"Please redeliver\"\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}}/redelivery-requested";
let payload = json!({
"Notes": "Please press 123 on the door",
"OrderId": "wiej234idf09i29jijgf4",
"Tenant": "uk",
"Update": "Please redeliver"
});
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}}/redelivery-requested \
--header 'content-type: application/json' \
--data '{
"Notes": "Please press 123 on the door",
"OrderId": "wiej234idf09i29jijgf4",
"Tenant": "uk",
"Update": "Please redeliver"
}'
echo '{
"Notes": "Please press 123 on the door",
"OrderId": "wiej234idf09i29jijgf4",
"Tenant": "uk",
"Update": "Please redeliver"
}' | \
http PUT {{baseUrl}}/redelivery-requested \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "Notes": "Please press 123 on the door",\n "OrderId": "wiej234idf09i29jijgf4",\n "Tenant": "uk",\n "Update": "Please redeliver"\n}' \
--output-document \
- {{baseUrl}}/redelivery-requested
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"Notes": "Please press 123 on the door",
"OrderId": "wiej234idf09i29jijgf4",
"Tenant": "uk",
"Update": "Please redeliver"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/redelivery-requested")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Order accepted
{{baseUrl}}/order-accepted
BODY json
{
"AcceptedFor": "",
"Event": "",
"OrderId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/order-accepted");
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 \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/order-accepted" {:content-type :json
:form-params {:AcceptedFor "2018-03-10T14:45:28Z"
:Event "OrderAccepted"
:OrderId "123456"}})
require "http/client"
url = "{{baseUrl}}/order-accepted"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\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}}/order-accepted"),
Content = new StringContent("{\n \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\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}}/order-accepted");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/order-accepted"
payload := strings.NewReader("{\n \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\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/order-accepted HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 94
{
"AcceptedFor": "2018-03-10T14:45:28Z",
"Event": "OrderAccepted",
"OrderId": "123456"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/order-accepted")
.setHeader("content-type", "application/json")
.setBody("{\n \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/order-accepted"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\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 \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/order-accepted")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/order-accepted")
.header("content-type", "application/json")
.body("{\n \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\n}")
.asString();
const data = JSON.stringify({
AcceptedFor: '2018-03-10T14:45:28Z',
Event: 'OrderAccepted',
OrderId: '123456'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/order-accepted');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/order-accepted',
headers: {'content-type': 'application/json'},
data: {AcceptedFor: '2018-03-10T14:45:28Z', Event: 'OrderAccepted', OrderId: '123456'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/order-accepted';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"AcceptedFor":"2018-03-10T14:45:28Z","Event":"OrderAccepted","OrderId":"123456"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/order-accepted',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "AcceptedFor": "2018-03-10T14:45:28Z",\n "Event": "OrderAccepted",\n "OrderId": "123456"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/order-accepted")
.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/order-accepted',
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({AcceptedFor: '2018-03-10T14:45:28Z', Event: 'OrderAccepted', OrderId: '123456'}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/order-accepted',
headers: {'content-type': 'application/json'},
body: {AcceptedFor: '2018-03-10T14:45:28Z', Event: 'OrderAccepted', OrderId: '123456'},
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}}/order-accepted');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
AcceptedFor: '2018-03-10T14:45:28Z',
Event: 'OrderAccepted',
OrderId: '123456'
});
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}}/order-accepted',
headers: {'content-type': 'application/json'},
data: {AcceptedFor: '2018-03-10T14:45:28Z', Event: 'OrderAccepted', OrderId: '123456'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/order-accepted';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"AcceptedFor":"2018-03-10T14:45:28Z","Event":"OrderAccepted","OrderId":"123456"}'
};
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 = @{ @"AcceptedFor": @"2018-03-10T14:45:28Z",
@"Event": @"OrderAccepted",
@"OrderId": @"123456" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/order-accepted"]
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}}/order-accepted" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/order-accepted",
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([
'AcceptedFor' => '2018-03-10T14:45:28Z',
'Event' => 'OrderAccepted',
'OrderId' => '123456'
]),
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}}/order-accepted', [
'body' => '{
"AcceptedFor": "2018-03-10T14:45:28Z",
"Event": "OrderAccepted",
"OrderId": "123456"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/order-accepted');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'AcceptedFor' => '2018-03-10T14:45:28Z',
'Event' => 'OrderAccepted',
'OrderId' => '123456'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'AcceptedFor' => '2018-03-10T14:45:28Z',
'Event' => 'OrderAccepted',
'OrderId' => '123456'
]));
$request->setRequestUrl('{{baseUrl}}/order-accepted');
$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}}/order-accepted' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"AcceptedFor": "2018-03-10T14:45:28Z",
"Event": "OrderAccepted",
"OrderId": "123456"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/order-accepted' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"AcceptedFor": "2018-03-10T14:45:28Z",
"Event": "OrderAccepted",
"OrderId": "123456"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/order-accepted", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/order-accepted"
payload = {
"AcceptedFor": "2018-03-10T14:45:28Z",
"Event": "OrderAccepted",
"OrderId": "123456"
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/order-accepted"
payload <- "{\n \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\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}}/order-accepted")
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 \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\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/order-accepted') do |req|
req.body = "{\n \"AcceptedFor\": \"2018-03-10T14:45:28Z\",\n \"Event\": \"OrderAccepted\",\n \"OrderId\": \"123456\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/order-accepted";
let payload = json!({
"AcceptedFor": "2018-03-10T14:45:28Z",
"Event": "OrderAccepted",
"OrderId": "123456"
});
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}}/order-accepted \
--header 'content-type: application/json' \
--data '{
"AcceptedFor": "2018-03-10T14:45:28Z",
"Event": "OrderAccepted",
"OrderId": "123456"
}'
echo '{
"AcceptedFor": "2018-03-10T14:45:28Z",
"Event": "OrderAccepted",
"OrderId": "123456"
}' | \
http POST {{baseUrl}}/order-accepted \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "AcceptedFor": "2018-03-10T14:45:28Z",\n "Event": "OrderAccepted",\n "OrderId": "123456"\n}' \
--output-document \
- {{baseUrl}}/order-accepted
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"AcceptedFor": "2018-03-10T14:45:28Z",
"Event": "OrderAccepted",
"OrderId": "123456"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/order-accepted")! 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
Order cancelled
{{baseUrl}}/order-cancelled
BODY json
{
"Event": "",
"OrderId": "",
"Reason": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/order-cancelled");
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 \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/order-cancelled" {:content-type :json
:form-params {:Event "OrderCancelled"
:OrderId "ijdhpy7bdusgtc28bapspa"
:Reason "system_cancelled_other"}})
require "http/client"
url = "{{baseUrl}}/order-cancelled"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\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}}/order-cancelled"),
Content = new StringContent("{\n \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\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}}/order-cancelled");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/order-cancelled"
payload := strings.NewReader("{\n \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\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/order-cancelled HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 108
{
"Event": "OrderCancelled",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"Reason": "system_cancelled_other"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/order-cancelled")
.setHeader("content-type", "application/json")
.setBody("{\n \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/order-cancelled"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\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 \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/order-cancelled")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/order-cancelled")
.header("content-type", "application/json")
.body("{\n \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\n}")
.asString();
const data = JSON.stringify({
Event: 'OrderCancelled',
OrderId: 'ijdhpy7bdusgtc28bapspa',
Reason: 'system_cancelled_other'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/order-cancelled');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/order-cancelled',
headers: {'content-type': 'application/json'},
data: {
Event: 'OrderCancelled',
OrderId: 'ijdhpy7bdusgtc28bapspa',
Reason: 'system_cancelled_other'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/order-cancelled';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"Event":"OrderCancelled","OrderId":"ijdhpy7bdusgtc28bapspa","Reason":"system_cancelled_other"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/order-cancelled',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Event": "OrderCancelled",\n "OrderId": "ijdhpy7bdusgtc28bapspa",\n "Reason": "system_cancelled_other"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/order-cancelled")
.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/order-cancelled',
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({
Event: 'OrderCancelled',
OrderId: 'ijdhpy7bdusgtc28bapspa',
Reason: 'system_cancelled_other'
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/order-cancelled',
headers: {'content-type': 'application/json'},
body: {
Event: 'OrderCancelled',
OrderId: 'ijdhpy7bdusgtc28bapspa',
Reason: 'system_cancelled_other'
},
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}}/order-cancelled');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Event: 'OrderCancelled',
OrderId: 'ijdhpy7bdusgtc28bapspa',
Reason: 'system_cancelled_other'
});
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}}/order-cancelled',
headers: {'content-type': 'application/json'},
data: {
Event: 'OrderCancelled',
OrderId: 'ijdhpy7bdusgtc28bapspa',
Reason: 'system_cancelled_other'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/order-cancelled';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"Event":"OrderCancelled","OrderId":"ijdhpy7bdusgtc28bapspa","Reason":"system_cancelled_other"}'
};
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 = @{ @"Event": @"OrderCancelled",
@"OrderId": @"ijdhpy7bdusgtc28bapspa",
@"Reason": @"system_cancelled_other" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/order-cancelled"]
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}}/order-cancelled" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/order-cancelled",
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([
'Event' => 'OrderCancelled',
'OrderId' => 'ijdhpy7bdusgtc28bapspa',
'Reason' => 'system_cancelled_other'
]),
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}}/order-cancelled', [
'body' => '{
"Event": "OrderCancelled",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"Reason": "system_cancelled_other"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/order-cancelled');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Event' => 'OrderCancelled',
'OrderId' => 'ijdhpy7bdusgtc28bapspa',
'Reason' => 'system_cancelled_other'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Event' => 'OrderCancelled',
'OrderId' => 'ijdhpy7bdusgtc28bapspa',
'Reason' => 'system_cancelled_other'
]));
$request->setRequestUrl('{{baseUrl}}/order-cancelled');
$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}}/order-cancelled' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Event": "OrderCancelled",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"Reason": "system_cancelled_other"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/order-cancelled' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Event": "OrderCancelled",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"Reason": "system_cancelled_other"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/order-cancelled", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/order-cancelled"
payload = {
"Event": "OrderCancelled",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"Reason": "system_cancelled_other"
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/order-cancelled"
payload <- "{\n \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\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}}/order-cancelled")
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 \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\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/order-cancelled') do |req|
req.body = "{\n \"Event\": \"OrderCancelled\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"Reason\": \"system_cancelled_other\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/order-cancelled";
let payload = json!({
"Event": "OrderCancelled",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"Reason": "system_cancelled_other"
});
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}}/order-cancelled \
--header 'content-type: application/json' \
--data '{
"Event": "OrderCancelled",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"Reason": "system_cancelled_other"
}'
echo '{
"Event": "OrderCancelled",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"Reason": "system_cancelled_other"
}' | \
http POST {{baseUrl}}/order-cancelled \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "Event": "OrderCancelled",\n "OrderId": "ijdhpy7bdusgtc28bapspa",\n "Reason": "system_cancelled_other"\n}' \
--output-document \
- {{baseUrl}}/order-cancelled
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"Event": "OrderCancelled",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"Reason": "system_cancelled_other"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/order-cancelled")! 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
Order rejected
{{baseUrl}}/order-rejected
BODY json
{
"Event": "",
"RejectedAt": "",
"RejectedBy": "",
"RejectedReason": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/order-rejected");
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 \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/order-rejected" {:content-type :json
:form-params {:Event "OrderRejected"
:RejectedAt "2018-03-10T14:45:28Z"
:RejectedBy "123456"
:RejectedReason "Kitchen overloaded"}})
require "http/client"
url = "{{baseUrl}}/order-rejected"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\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}}/order-rejected"),
Content = new StringContent("{\n \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\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}}/order-rejected");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/order-rejected"
payload := strings.NewReader("{\n \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\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/order-rejected HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 138
{
"Event": "OrderRejected",
"RejectedAt": "2018-03-10T14:45:28Z",
"RejectedBy": "123456",
"RejectedReason": "Kitchen overloaded"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/order-rejected")
.setHeader("content-type", "application/json")
.setBody("{\n \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/order-rejected"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\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 \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/order-rejected")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/order-rejected")
.header("content-type", "application/json")
.body("{\n \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\n}")
.asString();
const data = JSON.stringify({
Event: 'OrderRejected',
RejectedAt: '2018-03-10T14:45:28Z',
RejectedBy: '123456',
RejectedReason: 'Kitchen overloaded'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/order-rejected');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/order-rejected',
headers: {'content-type': 'application/json'},
data: {
Event: 'OrderRejected',
RejectedAt: '2018-03-10T14:45:28Z',
RejectedBy: '123456',
RejectedReason: 'Kitchen overloaded'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/order-rejected';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"Event":"OrderRejected","RejectedAt":"2018-03-10T14:45:28Z","RejectedBy":"123456","RejectedReason":"Kitchen overloaded"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/order-rejected',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Event": "OrderRejected",\n "RejectedAt": "2018-03-10T14:45:28Z",\n "RejectedBy": "123456",\n "RejectedReason": "Kitchen overloaded"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/order-rejected")
.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/order-rejected',
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({
Event: 'OrderRejected',
RejectedAt: '2018-03-10T14:45:28Z',
RejectedBy: '123456',
RejectedReason: 'Kitchen overloaded'
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/order-rejected',
headers: {'content-type': 'application/json'},
body: {
Event: 'OrderRejected',
RejectedAt: '2018-03-10T14:45:28Z',
RejectedBy: '123456',
RejectedReason: 'Kitchen overloaded'
},
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}}/order-rejected');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Event: 'OrderRejected',
RejectedAt: '2018-03-10T14:45:28Z',
RejectedBy: '123456',
RejectedReason: 'Kitchen overloaded'
});
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}}/order-rejected',
headers: {'content-type': 'application/json'},
data: {
Event: 'OrderRejected',
RejectedAt: '2018-03-10T14:45:28Z',
RejectedBy: '123456',
RejectedReason: 'Kitchen overloaded'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/order-rejected';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"Event":"OrderRejected","RejectedAt":"2018-03-10T14:45:28Z","RejectedBy":"123456","RejectedReason":"Kitchen overloaded"}'
};
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 = @{ @"Event": @"OrderRejected",
@"RejectedAt": @"2018-03-10T14:45:28Z",
@"RejectedBy": @"123456",
@"RejectedReason": @"Kitchen overloaded" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/order-rejected"]
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}}/order-rejected" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/order-rejected",
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([
'Event' => 'OrderRejected',
'RejectedAt' => '2018-03-10T14:45:28Z',
'RejectedBy' => '123456',
'RejectedReason' => 'Kitchen overloaded'
]),
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}}/order-rejected', [
'body' => '{
"Event": "OrderRejected",
"RejectedAt": "2018-03-10T14:45:28Z",
"RejectedBy": "123456",
"RejectedReason": "Kitchen overloaded"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/order-rejected');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Event' => 'OrderRejected',
'RejectedAt' => '2018-03-10T14:45:28Z',
'RejectedBy' => '123456',
'RejectedReason' => 'Kitchen overloaded'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Event' => 'OrderRejected',
'RejectedAt' => '2018-03-10T14:45:28Z',
'RejectedBy' => '123456',
'RejectedReason' => 'Kitchen overloaded'
]));
$request->setRequestUrl('{{baseUrl}}/order-rejected');
$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}}/order-rejected' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Event": "OrderRejected",
"RejectedAt": "2018-03-10T14:45:28Z",
"RejectedBy": "123456",
"RejectedReason": "Kitchen overloaded"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/order-rejected' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Event": "OrderRejected",
"RejectedAt": "2018-03-10T14:45:28Z",
"RejectedBy": "123456",
"RejectedReason": "Kitchen overloaded"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/order-rejected", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/order-rejected"
payload = {
"Event": "OrderRejected",
"RejectedAt": "2018-03-10T14:45:28Z",
"RejectedBy": "123456",
"RejectedReason": "Kitchen overloaded"
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/order-rejected"
payload <- "{\n \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\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}}/order-rejected")
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 \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\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/order-rejected') do |req|
req.body = "{\n \"Event\": \"OrderRejected\",\n \"RejectedAt\": \"2018-03-10T14:45:28Z\",\n \"RejectedBy\": \"123456\",\n \"RejectedReason\": \"Kitchen overloaded\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/order-rejected";
let payload = json!({
"Event": "OrderRejected",
"RejectedAt": "2018-03-10T14:45:28Z",
"RejectedBy": "123456",
"RejectedReason": "Kitchen overloaded"
});
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}}/order-rejected \
--header 'content-type: application/json' \
--data '{
"Event": "OrderRejected",
"RejectedAt": "2018-03-10T14:45:28Z",
"RejectedBy": "123456",
"RejectedReason": "Kitchen overloaded"
}'
echo '{
"Event": "OrderRejected",
"RejectedAt": "2018-03-10T14:45:28Z",
"RejectedBy": "123456",
"RejectedReason": "Kitchen overloaded"
}' | \
http POST {{baseUrl}}/order-rejected \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "Event": "OrderRejected",\n "RejectedAt": "2018-03-10T14:45:28Z",\n "RejectedBy": "123456",\n "RejectedReason": "Kitchen overloaded"\n}' \
--output-document \
- {{baseUrl}}/order-rejected
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"Event": "OrderRejected",
"RejectedAt": "2018-03-10T14:45:28Z",
"RejectedBy": "123456",
"RejectedReason": "Kitchen overloaded"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/order-rejected")! 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 order
{{baseUrl}}/orders
BODY json
{
"Customer": {
"Address": {
"City": "",
"GeoLocation": {
"Latitude": "",
"Longitude": ""
},
"Lines": [],
"PostalCode": ""
},
"DisplayPhoneNumber": "",
"Email": "",
"Name": "",
"PhoneNumber": ""
},
"CustomerNotes": {
"NoteForDelivery": "",
"NoteForRestaurant": ""
},
"FriendlyOrderReference": "",
"Fulfilment": {
"DueAsap": false,
"DueDate": "",
"Method": ""
},
"IsTest": false,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "",
"Quantity": 0,
"Reference": "",
"UnitPrice": 0
}
],
"Name": "",
"Quantity": 0,
"Reference": "",
"TotalPrice": "",
"UnitPrice": 0
}
],
"OrderReference": "",
"Payment": {
"Fees": [
{
"Type": "",
"Value": ""
}
],
"Lines": [
{
"LastCardDigits": "",
"Paid": false,
"ServiceFee": "",
"Type": "",
"Value": ""
}
],
"PaidDate": "",
"Taxes": [
{
"Percentage": "",
"Type": "",
"Value": ""
}
],
"Tips": [
{}
]
},
"Restaurant": "",
"TotalPrice": ""
}
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 \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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 {:CustomerNotes {:NoteForDelivery "Red door"
:NoteForRestaurant "Make it spicy"}
:Fulfilment {:DueAsap false
:DueDate "2020-01-01T09:00:00.000Z"
:Method "Delivery"}
:Payment {:Fees [{:Type "card"
:Value 0.25} {:Type "delivery"
:Value 3.5}]
:Lines [{:LastCardDigits "1234"
:Paid true
:ServiceFee 0
:Type "Card"
:Value 19.95}]
:Tips [{:Type "driver"
:Value 2.5}]}}})
require "http/client"
url = "{{baseUrl}}/orders"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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 \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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 \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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 \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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: 635
{
"CustomerNotes": {
"NoteForDelivery": "Red door",
"NoteForRestaurant": "Make it spicy"
},
"Fulfilment": {
"DueAsap": false,
"DueDate": "2020-01-01T09:00:00.000Z",
"Method": "Delivery"
},
"Payment": {
"Fees": [
{
"Type": "card",
"Value": 0.25
},
{
"Type": "delivery",
"Value": 3.5
}
],
"Lines": [
{
"LastCardDigits": "1234",
"Paid": true,
"ServiceFee": 0,
"Type": "Card",
"Value": 19.95
}
],
"Tips": [
{
"Type": "driver",
"Value": 2.5
}
]
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/orders")
.setHeader("content-type", "application/json")
.setBody("{\n \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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 \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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 \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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 \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\n }\n ]\n }\n}")
.asString();
const data = JSON.stringify({
CustomerNotes: {
NoteForDelivery: 'Red door',
NoteForRestaurant: 'Make it spicy'
},
Fulfilment: {
DueAsap: false,
DueDate: '2020-01-01T09:00:00.000Z',
Method: 'Delivery'
},
Payment: {
Fees: [
{
Type: 'card',
Value: 0.25
},
{
Type: 'delivery',
Value: 3.5
}
],
Lines: [
{
LastCardDigits: '1234',
Paid: true,
ServiceFee: 0,
Type: 'Card',
Value: 19.95
}
],
Tips: [
{
Type: 'driver',
Value: 2.5
}
]
}
});
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: {
CustomerNotes: {NoteForDelivery: 'Red door', NoteForRestaurant: 'Make it spicy'},
Fulfilment: {DueAsap: false, DueDate: '2020-01-01T09:00:00.000Z', Method: 'Delivery'},
Payment: {
Fees: [{Type: 'card', Value: 0.25}, {Type: 'delivery', Value: 3.5}],
Lines: [
{LastCardDigits: '1234', Paid: true, ServiceFee: 0, Type: 'Card', Value: 19.95}
],
Tips: [{Type: 'driver', Value: 2.5}]
}
}
};
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: '{"CustomerNotes":{"NoteForDelivery":"Red door","NoteForRestaurant":"Make it spicy"},"Fulfilment":{"DueAsap":false,"DueDate":"2020-01-01T09:00:00.000Z","Method":"Delivery"},"Payment":{"Fees":[{"Type":"card","Value":0.25},{"Type":"delivery","Value":3.5}],"Lines":[{"LastCardDigits":"1234","Paid":true,"ServiceFee":0,"Type":"Card","Value":19.95}],"Tips":[{"Type":"driver","Value":2.5}]}}'
};
try {
const response = await 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 "CustomerNotes": {\n "NoteForDelivery": "Red door",\n "NoteForRestaurant": "Make it spicy"\n },\n "Fulfilment": {\n "DueAsap": false,\n "DueDate": "2020-01-01T09:00:00.000Z",\n "Method": "Delivery"\n },\n "Payment": {\n "Fees": [\n {\n "Type": "card",\n "Value": 0.25\n },\n {\n "Type": "delivery",\n "Value": 3.5\n }\n ],\n "Lines": [\n {\n "LastCardDigits": "1234",\n "Paid": true,\n "ServiceFee": 0,\n "Type": "Card",\n "Value": 19.95\n }\n ],\n "Tips": [\n {\n "Type": "driver",\n "Value": 2.5\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 \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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({
CustomerNotes: {NoteForDelivery: 'Red door', NoteForRestaurant: 'Make it spicy'},
Fulfilment: {DueAsap: false, DueDate: '2020-01-01T09:00:00.000Z', Method: 'Delivery'},
Payment: {
Fees: [{Type: 'card', Value: 0.25}, {Type: 'delivery', Value: 3.5}],
Lines: [
{LastCardDigits: '1234', Paid: true, ServiceFee: 0, Type: 'Card', Value: 19.95}
],
Tips: [{Type: 'driver', Value: 2.5}]
}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/orders',
headers: {'content-type': 'application/json'},
body: {
CustomerNotes: {NoteForDelivery: 'Red door', NoteForRestaurant: 'Make it spicy'},
Fulfilment: {DueAsap: false, DueDate: '2020-01-01T09:00:00.000Z', Method: 'Delivery'},
Payment: {
Fees: [{Type: 'card', Value: 0.25}, {Type: 'delivery', Value: 3.5}],
Lines: [
{LastCardDigits: '1234', Paid: true, ServiceFee: 0, Type: 'Card', Value: 19.95}
],
Tips: [{Type: 'driver', Value: 2.5}]
}
},
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({
CustomerNotes: {
NoteForDelivery: 'Red door',
NoteForRestaurant: 'Make it spicy'
},
Fulfilment: {
DueAsap: false,
DueDate: '2020-01-01T09:00:00.000Z',
Method: 'Delivery'
},
Payment: {
Fees: [
{
Type: 'card',
Value: 0.25
},
{
Type: 'delivery',
Value: 3.5
}
],
Lines: [
{
LastCardDigits: '1234',
Paid: true,
ServiceFee: 0,
Type: 'Card',
Value: 19.95
}
],
Tips: [
{
Type: 'driver',
Value: 2.5
}
]
}
});
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: {
CustomerNotes: {NoteForDelivery: 'Red door', NoteForRestaurant: 'Make it spicy'},
Fulfilment: {DueAsap: false, DueDate: '2020-01-01T09:00:00.000Z', Method: 'Delivery'},
Payment: {
Fees: [{Type: 'card', Value: 0.25}, {Type: 'delivery', Value: 3.5}],
Lines: [
{LastCardDigits: '1234', Paid: true, ServiceFee: 0, Type: 'Card', Value: 19.95}
],
Tips: [{Type: 'driver', Value: 2.5}]
}
}
};
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: '{"CustomerNotes":{"NoteForDelivery":"Red door","NoteForRestaurant":"Make it spicy"},"Fulfilment":{"DueAsap":false,"DueDate":"2020-01-01T09:00:00.000Z","Method":"Delivery"},"Payment":{"Fees":[{"Type":"card","Value":0.25},{"Type":"delivery","Value":3.5}],"Lines":[{"LastCardDigits":"1234","Paid":true,"ServiceFee":0,"Type":"Card","Value":19.95}],"Tips":[{"Type":"driver","Value":2.5}]}}'
};
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 = @{ @"CustomerNotes": @{ @"NoteForDelivery": @"Red door", @"NoteForRestaurant": @"Make it spicy" },
@"Fulfilment": @{ @"DueAsap": @NO, @"DueDate": @"2020-01-01T09:00:00.000Z", @"Method": @"Delivery" },
@"Payment": @{ @"Fees": @[ @{ @"Type": @"card", @"Value": @0.25 }, @{ @"Type": @"delivery", @"Value": @3.5 } ], @"Lines": @[ @{ @"LastCardDigits": @"1234", @"Paid": @YES, @"ServiceFee": @0, @"Type": @"Card", @"Value": @19.95 } ], @"Tips": @[ @{ @"Type": @"driver", @"Value": @2.5 } ] } };
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 \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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([
'CustomerNotes' => [
'NoteForDelivery' => 'Red door',
'NoteForRestaurant' => 'Make it spicy'
],
'Fulfilment' => [
'DueAsap' => null,
'DueDate' => '2020-01-01T09:00:00.000Z',
'Method' => 'Delivery'
],
'Payment' => [
'Fees' => [
[
'Type' => 'card',
'Value' => 0.25
],
[
'Type' => 'delivery',
'Value' => 3.5
]
],
'Lines' => [
[
'LastCardDigits' => '1234',
'Paid' => null,
'ServiceFee' => 0,
'Type' => 'Card',
'Value' => 19.95
]
],
'Tips' => [
[
'Type' => 'driver',
'Value' => 2.5
]
]
]
]),
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' => '{
"CustomerNotes": {
"NoteForDelivery": "Red door",
"NoteForRestaurant": "Make it spicy"
},
"Fulfilment": {
"DueAsap": false,
"DueDate": "2020-01-01T09:00:00.000Z",
"Method": "Delivery"
},
"Payment": {
"Fees": [
{
"Type": "card",
"Value": 0.25
},
{
"Type": "delivery",
"Value": 3.5
}
],
"Lines": [
{
"LastCardDigits": "1234",
"Paid": true,
"ServiceFee": 0,
"Type": "Card",
"Value": 19.95
}
],
"Tips": [
{
"Type": "driver",
"Value": 2.5
}
]
}
}',
'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([
'CustomerNotes' => [
'NoteForDelivery' => 'Red door',
'NoteForRestaurant' => 'Make it spicy'
],
'Fulfilment' => [
'DueAsap' => null,
'DueDate' => '2020-01-01T09:00:00.000Z',
'Method' => 'Delivery'
],
'Payment' => [
'Fees' => [
[
'Type' => 'card',
'Value' => 0.25
],
[
'Type' => 'delivery',
'Value' => 3.5
]
],
'Lines' => [
[
'LastCardDigits' => '1234',
'Paid' => null,
'ServiceFee' => 0,
'Type' => 'Card',
'Value' => 19.95
]
],
'Tips' => [
[
'Type' => 'driver',
'Value' => 2.5
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'CustomerNotes' => [
'NoteForDelivery' => 'Red door',
'NoteForRestaurant' => 'Make it spicy'
],
'Fulfilment' => [
'DueAsap' => null,
'DueDate' => '2020-01-01T09:00:00.000Z',
'Method' => 'Delivery'
],
'Payment' => [
'Fees' => [
[
'Type' => 'card',
'Value' => 0.25
],
[
'Type' => 'delivery',
'Value' => 3.5
]
],
'Lines' => [
[
'LastCardDigits' => '1234',
'Paid' => null,
'ServiceFee' => 0,
'Type' => 'Card',
'Value' => 19.95
]
],
'Tips' => [
[
'Type' => 'driver',
'Value' => 2.5
]
]
]
]));
$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 '{
"CustomerNotes": {
"NoteForDelivery": "Red door",
"NoteForRestaurant": "Make it spicy"
},
"Fulfilment": {
"DueAsap": false,
"DueDate": "2020-01-01T09:00:00.000Z",
"Method": "Delivery"
},
"Payment": {
"Fees": [
{
"Type": "card",
"Value": 0.25
},
{
"Type": "delivery",
"Value": 3.5
}
],
"Lines": [
{
"LastCardDigits": "1234",
"Paid": true,
"ServiceFee": 0,
"Type": "Card",
"Value": 19.95
}
],
"Tips": [
{
"Type": "driver",
"Value": 2.5
}
]
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"CustomerNotes": {
"NoteForDelivery": "Red door",
"NoteForRestaurant": "Make it spicy"
},
"Fulfilment": {
"DueAsap": false,
"DueDate": "2020-01-01T09:00:00.000Z",
"Method": "Delivery"
},
"Payment": {
"Fees": [
{
"Type": "card",
"Value": 0.25
},
{
"Type": "delivery",
"Value": 3.5
}
],
"Lines": [
{
"LastCardDigits": "1234",
"Paid": true,
"ServiceFee": 0,
"Type": "Card",
"Value": 19.95
}
],
"Tips": [
{
"Type": "driver",
"Value": 2.5
}
]
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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 = {
"CustomerNotes": {
"NoteForDelivery": "Red door",
"NoteForRestaurant": "Make it spicy"
},
"Fulfilment": {
"DueAsap": False,
"DueDate": "2020-01-01T09:00:00.000Z",
"Method": "Delivery"
},
"Payment": {
"Fees": [
{
"Type": "card",
"Value": 0.25
},
{
"Type": "delivery",
"Value": 3.5
}
],
"Lines": [
{
"LastCardDigits": "1234",
"Paid": True,
"ServiceFee": 0,
"Type": "Card",
"Value": 19.95
}
],
"Tips": [
{
"Type": "driver",
"Value": 2.5
}
]
}
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders"
payload <- "{\n \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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 \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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 \"CustomerNotes\": {\n \"NoteForDelivery\": \"Red door\",\n \"NoteForRestaurant\": \"Make it spicy\"\n },\n \"Fulfilment\": {\n \"DueAsap\": false,\n \"DueDate\": \"2020-01-01T09:00:00.000Z\",\n \"Method\": \"Delivery\"\n },\n \"Payment\": {\n \"Fees\": [\n {\n \"Type\": \"card\",\n \"Value\": 0.25\n },\n {\n \"Type\": \"delivery\",\n \"Value\": 3.5\n }\n ],\n \"Lines\": [\n {\n \"LastCardDigits\": \"1234\",\n \"Paid\": true,\n \"ServiceFee\": 0,\n \"Type\": \"Card\",\n \"Value\": 19.95\n }\n ],\n \"Tips\": [\n {\n \"Type\": \"driver\",\n \"Value\": 2.5\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!({
"CustomerNotes": json!({
"NoteForDelivery": "Red door",
"NoteForRestaurant": "Make it spicy"
}),
"Fulfilment": json!({
"DueAsap": false,
"DueDate": "2020-01-01T09:00:00.000Z",
"Method": "Delivery"
}),
"Payment": json!({
"Fees": (
json!({
"Type": "card",
"Value": 0.25
}),
json!({
"Type": "delivery",
"Value": 3.5
})
),
"Lines": (
json!({
"LastCardDigits": "1234",
"Paid": true,
"ServiceFee": 0,
"Type": "Card",
"Value": 19.95
})
),
"Tips": (
json!({
"Type": "driver",
"Value": 2.5
})
)
})
});
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 '{
"CustomerNotes": {
"NoteForDelivery": "Red door",
"NoteForRestaurant": "Make it spicy"
},
"Fulfilment": {
"DueAsap": false,
"DueDate": "2020-01-01T09:00:00.000Z",
"Method": "Delivery"
},
"Payment": {
"Fees": [
{
"Type": "card",
"Value": 0.25
},
{
"Type": "delivery",
"Value": 3.5
}
],
"Lines": [
{
"LastCardDigits": "1234",
"Paid": true,
"ServiceFee": 0,
"Type": "Card",
"Value": 19.95
}
],
"Tips": [
{
"Type": "driver",
"Value": 2.5
}
]
}
}'
echo '{
"CustomerNotes": {
"NoteForDelivery": "Red door",
"NoteForRestaurant": "Make it spicy"
},
"Fulfilment": {
"DueAsap": false,
"DueDate": "2020-01-01T09:00:00.000Z",
"Method": "Delivery"
},
"Payment": {
"Fees": [
{
"Type": "card",
"Value": 0.25
},
{
"Type": "delivery",
"Value": 3.5
}
],
"Lines": [
{
"LastCardDigits": "1234",
"Paid": true,
"ServiceFee": 0,
"Type": "Card",
"Value": 19.95
}
],
"Tips": [
{
"Type": "driver",
"Value": 2.5
}
]
}
}' | \
http POST {{baseUrl}}/orders \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "CustomerNotes": {\n "NoteForDelivery": "Red door",\n "NoteForRestaurant": "Make it spicy"\n },\n "Fulfilment": {\n "DueAsap": false,\n "DueDate": "2020-01-01T09:00:00.000Z",\n "Method": "Delivery"\n },\n "Payment": {\n "Fees": [\n {\n "Type": "card",\n "Value": 0.25\n },\n {\n "Type": "delivery",\n "Value": 3.5\n }\n ],\n "Lines": [\n {\n "LastCardDigits": "1234",\n "Paid": true,\n "ServiceFee": 0,\n "Type": "Card",\n "Value": 19.95\n }\n ],\n "Tips": [\n {\n "Type": "driver",\n "Value": 2.5\n }\n ]\n }\n}' \
--output-document \
- {{baseUrl}}/orders
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"CustomerNotes": [
"NoteForDelivery": "Red door",
"NoteForRestaurant": "Make it spicy"
],
"Fulfilment": [
"DueAsap": false,
"DueDate": "2020-01-01T09:00:00.000Z",
"Method": "Delivery"
],
"Payment": [
"Fees": [
[
"Type": "card",
"Value": 0.25
],
[
"Type": "delivery",
"Value": 3.5
]
],
"Lines": [
[
"LastCardDigits": "1234",
"Paid": true,
"ServiceFee": 0,
"Type": "Card",
"Value": 19.95
]
],
"Tips": [
[
"Type": "driver",
"Value": 2.5
]
]
]
] 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()
GET
Get delivery estimate
{{baseUrl}}/delivery/estimate
QUERY PARAMS
restaurantReference
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/delivery/estimate?restaurantReference=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/delivery/estimate" {:query-params {:restaurantReference ""}})
require "http/client"
url = "{{baseUrl}}/delivery/estimate?restaurantReference="
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}}/delivery/estimate?restaurantReference="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/delivery/estimate?restaurantReference=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/delivery/estimate?restaurantReference="
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/delivery/estimate?restaurantReference= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/delivery/estimate?restaurantReference=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/delivery/estimate?restaurantReference="))
.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}}/delivery/estimate?restaurantReference=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/delivery/estimate?restaurantReference=")
.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}}/delivery/estimate?restaurantReference=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/delivery/estimate',
params: {restaurantReference: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/delivery/estimate?restaurantReference=';
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}}/delivery/estimate?restaurantReference=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/delivery/estimate?restaurantReference=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/delivery/estimate?restaurantReference=',
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}}/delivery/estimate',
qs: {restaurantReference: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/delivery/estimate');
req.query({
restaurantReference: ''
});
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}}/delivery/estimate',
params: {restaurantReference: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/delivery/estimate?restaurantReference=';
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}}/delivery/estimate?restaurantReference="]
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}}/delivery/estimate?restaurantReference=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/delivery/estimate?restaurantReference=",
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}}/delivery/estimate?restaurantReference=');
echo $response->getBody();
setUrl('{{baseUrl}}/delivery/estimate');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'restaurantReference' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/delivery/estimate');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'restaurantReference' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/delivery/estimate?restaurantReference=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/delivery/estimate?restaurantReference=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/delivery/estimate?restaurantReference=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/delivery/estimate"
querystring = {"restaurantReference":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/delivery/estimate"
queryString <- list(restaurantReference = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/delivery/estimate?restaurantReference=")
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/delivery/estimate') do |req|
req.params['restaurantReference'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/delivery/estimate";
let querystring = [
("restaurantReference", ""),
];
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}}/delivery/estimate?restaurantReference='
http GET '{{baseUrl}}/delivery/estimate?restaurantReference='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/delivery/estimate?restaurantReference='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/delivery/estimate?restaurantReference=")! 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 current driver locations (bulk upload)
{{baseUrl}}/orders/deliverystate/driverlocation
BODY json
[
{
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"OrderId": "",
"TimeStampWithUtcOffset": ""
}
]
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/deliverystate/driverlocation");
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 {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/deliverystate/driverlocation" {:content-type :json
:form-params [{:EtaAtDeliveryAddress "2020-12-25T16:45:28.7537228+00:00"
:EtaAtRestaurant "2020-12-25T16:30:28.7537228+00:00"
:Location {:Accuracy 12.814
:Heading 357.10382
:Latitude 51.51641
:Longitude -0.103198
:Speed 8.68}}]})
require "http/client"
url = "{{baseUrl}}/orders/deliverystate/driverlocation"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "[\n {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/orders/deliverystate/driverlocation"),
Content = new StringContent("[\n {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\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/deliverystate/driverlocation");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "[\n {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/deliverystate/driverlocation"
payload := strings.NewReader("[\n {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/orders/deliverystate/driverlocation HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 292
[
{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
}
}
]
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/deliverystate/driverlocation")
.setHeader("content-type", "application/json")
.setBody("[\n {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/deliverystate/driverlocation"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("[\n {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\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 {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/deliverystate/driverlocation")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/deliverystate/driverlocation")
.header("content-type", "application/json")
.body("[\n {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]")
.asString();
const data = JSON.stringify([
{
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T16:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
}
}
]);
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/deliverystate/driverlocation');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/deliverystate/driverlocation',
headers: {'content-type': 'application/json'},
data: [
{
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T16:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
}
}
]
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/deliverystate/driverlocation';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '[{"EtaAtDeliveryAddress":"2020-12-25T16:45:28.7537228+00:00","EtaAtRestaurant":"2020-12-25T16:30:28.7537228+00:00","Location":{"Accuracy":12.814,"Heading":357.10382,"Latitude":51.51641,"Longitude":-0.103198,"Speed":8.68}}]'
};
try {
const response = await 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/deliverystate/driverlocation',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '[\n {\n "EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",\n "EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",\n "Location": {\n "Accuracy": 12.814,\n "Heading": 357.10382,\n "Latitude": 51.51641,\n "Longitude": -0.103198,\n "Speed": 8.68\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 {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]")
val request = Request.Builder()
.url("{{baseUrl}}/orders/deliverystate/driverlocation")
.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/orders/deliverystate/driverlocation',
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([
{
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T16:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
}
}
]));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/deliverystate/driverlocation',
headers: {'content-type': 'application/json'},
body: [
{
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T16:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
}
}
],
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}}/orders/deliverystate/driverlocation');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send([
{
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T16:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
}
}
]);
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}}/orders/deliverystate/driverlocation',
headers: {'content-type': 'application/json'},
data: [
{
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T16:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
}
}
]
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/deliverystate/driverlocation';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '[{"EtaAtDeliveryAddress":"2020-12-25T16:45:28.7537228+00:00","EtaAtRestaurant":"2020-12-25T16:30:28.7537228+00:00","Location":{"Accuracy":12.814,"Heading":357.10382,"Latitude":51.51641,"Longitude":-0.103198,"Speed":8.68}}]'
};
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 = @[ @{ @"EtaAtDeliveryAddress": @"2020-12-25T16:45:28.7537228+00:00", @"EtaAtRestaurant": @"2020-12-25T16:30:28.7537228+00:00", @"Location": @{ @"Accuracy": @12.814, @"Heading": @357.10382, @"Latitude": @51.51641, @"Longitude": @-0.103198, @"Speed": @8.68 } } ];
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/deliverystate/driverlocation"]
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}}/orders/deliverystate/driverlocation" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "[\n {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/deliverystate/driverlocation",
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([
[
'EtaAtDeliveryAddress' => '2020-12-25T16:45:28.7537228+00:00',
'EtaAtRestaurant' => '2020-12-25T16:30:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
]
]
]),
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}}/orders/deliverystate/driverlocation', [
'body' => '[
{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
}
}
]',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/deliverystate/driverlocation');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
[
'EtaAtDeliveryAddress' => '2020-12-25T16:45:28.7537228+00:00',
'EtaAtRestaurant' => '2020-12-25T16:30:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
[
'EtaAtDeliveryAddress' => '2020-12-25T16:45:28.7537228+00:00',
'EtaAtRestaurant' => '2020-12-25T16:30:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
]
]
]));
$request->setRequestUrl('{{baseUrl}}/orders/deliverystate/driverlocation');
$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}}/orders/deliverystate/driverlocation' -Method PUT -Headers $headers -ContentType 'application/json' -Body '[
{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
}
}
]'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/deliverystate/driverlocation' -Method PUT -Headers $headers -ContentType 'application/json' -Body '[
{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
}
}
]'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "[\n {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/deliverystate/driverlocation", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/deliverystate/driverlocation"
payload = [
{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
}
}
]
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/deliverystate/driverlocation"
payload <- "[\n {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders/deliverystate/driverlocation")
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 {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/orders/deliverystate/driverlocation') do |req|
req.body = "[\n {\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n }\n }\n]"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders/deliverystate/driverlocation";
let payload = (
json!({
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": json!({
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
})
})
);
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}}/orders/deliverystate/driverlocation \
--header 'content-type: application/json' \
--data '[
{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
}
}
]'
echo '[
{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
}
}
]' | \
http PUT {{baseUrl}}/orders/deliverystate/driverlocation \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '[\n {\n "EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",\n "EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",\n "Location": {\n "Accuracy": 12.814,\n "Heading": 357.10382,\n "Latitude": 51.51641,\n "Longitude": -0.103198,\n "Speed": 8.68\n }\n }\n]' \
--output-document \
- {{baseUrl}}/orders/deliverystate/driverlocation
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
[
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": [
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
]
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/deliverystate/driverlocation")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Update order with delivered details
{{baseUrl}}/orders/:orderId/deliverystate/delivered
QUERY PARAMS
orderId
BODY json
{
"Location": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"TimeStampWithUtcOffset": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/deliverystate/delivered");
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 \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/deliverystate/delivered" {:content-type :json
:form-params {:TimeStampWithUtcOffset "2018-03-10T14:45:28.7537228+00:00"}})
require "http/client"
url = "{{baseUrl}}/orders/:orderId/deliverystate/delivered"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/delivered"),
Content = new StringContent("{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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/:orderId/deliverystate/delivered");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/deliverystate/delivered"
payload := strings.NewReader("{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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/orders/:orderId/deliverystate/delivered HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 67
{
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/deliverystate/delivered")
.setHeader("content-type", "application/json")
.setBody("{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/deliverystate/delivered"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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 \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/delivered")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/deliverystate/delivered")
.header("content-type", "application/json")
.body("{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}")
.asString();
const data = JSON.stringify({
TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/deliverystate/delivered');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/delivered',
headers: {'content-type': 'application/json'},
data: {TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/deliverystate/delivered';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"TimeStampWithUtcOffset":"2018-03-10T14:45:28.7537228+00:00"}'
};
try {
const response = await 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/:orderId/deliverystate/delivered',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/delivered")
.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/orders/:orderId/deliverystate/delivered',
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({TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/delivered',
headers: {'content-type': 'application/json'},
body: {TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'},
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}}/orders/:orderId/deliverystate/delivered');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'
});
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}}/orders/:orderId/deliverystate/delivered',
headers: {'content-type': 'application/json'},
data: {TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/deliverystate/delivered';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"TimeStampWithUtcOffset":"2018-03-10T14:45:28.7537228+00:00"}'
};
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 = @{ @"TimeStampWithUtcOffset": @"2018-03-10T14:45:28.7537228+00:00" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/deliverystate/delivered"]
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}}/orders/:orderId/deliverystate/delivered" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/deliverystate/delivered",
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([
'TimeStampWithUtcOffset' => '2018-03-10T14:45:28.7537228+00:00'
]),
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}}/orders/:orderId/deliverystate/delivered', [
'body' => '{
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/deliverystate/delivered');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'TimeStampWithUtcOffset' => '2018-03-10T14:45:28.7537228+00:00'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'TimeStampWithUtcOffset' => '2018-03-10T14:45:28.7537228+00:00'
]));
$request->setRequestUrl('{{baseUrl}}/orders/:orderId/deliverystate/delivered');
$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}}/orders/:orderId/deliverystate/delivered' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/deliverystate/delivered' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/:orderId/deliverystate/delivered", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/deliverystate/delivered"
payload = { "TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00" }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/deliverystate/delivered"
payload <- "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/delivered")
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 \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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/orders/:orderId/deliverystate/delivered') do |req|
req.body = "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/delivered";
let payload = json!({"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"});
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}}/orders/:orderId/deliverystate/delivered \
--header 'content-type: application/json' \
--data '{
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}'
echo '{
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}' | \
http PUT {{baseUrl}}/orders/:orderId/deliverystate/delivered \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"\n}' \
--output-document \
- {{baseUrl}}/orders/:orderId/deliverystate/delivered
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/deliverystate/delivered")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Update order with driver assigned details
{{baseUrl}}/orders/:orderId/deliverystate/driverassigned
QUERY PARAMS
orderId
BODY json
{
"DriverContactNumber": "",
"DriverName": "",
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"TimeStampWithUtcOffset": "",
"VehicleDetails": {
"Vehicle": "",
"VehicleRegistration": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/deliverystate/driverassigned");
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 \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/deliverystate/driverassigned" {:content-type :json
:form-params {:DriverContactNumber "07123456789"
:DriverName "David"
:EtaAtDeliveryAddress "2020-12-25T16:45:28.7537228+00:00"
:EtaAtRestaurant "2020-12-25T15:30:28.7537228+00:00"
:Location {:Accuracy 12.814
:Heading 357.10382
:Latitude 51.51641
:Longitude -0.103198
:Speed 8.68}
:TimeStampWithUtcOffset "2020-12-25T15:45:28.7537228+00:00"
:VehicleDetails {:Vehicle "Motorbike"
:VehicleRegistration "JU51 SAY"}}})
require "http/client"
url = "{{baseUrl}}/orders/:orderId/deliverystate/driverassigned"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\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}}/orders/:orderId/deliverystate/driverassigned"),
Content = new StringContent("{\n \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\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/:orderId/deliverystate/driverassigned");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/deliverystate/driverassigned"
payload := strings.NewReader("{\n \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\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/orders/:orderId/deliverystate/driverassigned HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 489
{
"DriverContactNumber": "07123456789",
"DriverName": "David",
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T15:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00",
"VehicleDetails": {
"Vehicle": "Motorbike",
"VehicleRegistration": "JU51 SAY"
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/deliverystate/driverassigned")
.setHeader("content-type", "application/json")
.setBody("{\n \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/deliverystate/driverassigned"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\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 \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/driverassigned")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/deliverystate/driverassigned")
.header("content-type", "application/json")
.body("{\n \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\n }\n}")
.asString();
const data = JSON.stringify({
DriverContactNumber: '07123456789',
DriverName: 'David',
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T15:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:45:28.7537228+00:00',
VehicleDetails: {
Vehicle: 'Motorbike',
VehicleRegistration: 'JU51 SAY'
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/deliverystate/driverassigned');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/driverassigned',
headers: {'content-type': 'application/json'},
data: {
DriverContactNumber: '07123456789',
DriverName: 'David',
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T15:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:45:28.7537228+00:00',
VehicleDetails: {Vehicle: 'Motorbike', VehicleRegistration: 'JU51 SAY'}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/deliverystate/driverassigned';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DriverContactNumber":"07123456789","DriverName":"David","EtaAtDeliveryAddress":"2020-12-25T16:45:28.7537228+00:00","EtaAtRestaurant":"2020-12-25T15:30:28.7537228+00:00","Location":{"Accuracy":12.814,"Heading":357.10382,"Latitude":51.51641,"Longitude":-0.103198,"Speed":8.68},"TimeStampWithUtcOffset":"2020-12-25T15:45:28.7537228+00:00","VehicleDetails":{"Vehicle":"Motorbike","VehicleRegistration":"JU51 SAY"}}'
};
try {
const response = await 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/:orderId/deliverystate/driverassigned',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "DriverContactNumber": "07123456789",\n "DriverName": "David",\n "EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",\n "EtaAtRestaurant": "2020-12-25T15:30:28.7537228+00:00",\n "Location": {\n "Accuracy": 12.814,\n "Heading": 357.10382,\n "Latitude": 51.51641,\n "Longitude": -0.103198,\n "Speed": 8.68\n },\n "TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00",\n "VehicleDetails": {\n "Vehicle": "Motorbike",\n "VehicleRegistration": "JU51 SAY"\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 \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/driverassigned")
.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/orders/:orderId/deliverystate/driverassigned',
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({
DriverContactNumber: '07123456789',
DriverName: 'David',
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T15:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:45:28.7537228+00:00',
VehicleDetails: {Vehicle: 'Motorbike', VehicleRegistration: 'JU51 SAY'}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/driverassigned',
headers: {'content-type': 'application/json'},
body: {
DriverContactNumber: '07123456789',
DriverName: 'David',
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T15:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:45:28.7537228+00:00',
VehicleDetails: {Vehicle: 'Motorbike', VehicleRegistration: 'JU51 SAY'}
},
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}}/orders/:orderId/deliverystate/driverassigned');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
DriverContactNumber: '07123456789',
DriverName: 'David',
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T15:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:45:28.7537228+00:00',
VehicleDetails: {
Vehicle: 'Motorbike',
VehicleRegistration: 'JU51 SAY'
}
});
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}}/orders/:orderId/deliverystate/driverassigned',
headers: {'content-type': 'application/json'},
data: {
DriverContactNumber: '07123456789',
DriverName: 'David',
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T15:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:45:28.7537228+00:00',
VehicleDetails: {Vehicle: 'Motorbike', VehicleRegistration: 'JU51 SAY'}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/deliverystate/driverassigned';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DriverContactNumber":"07123456789","DriverName":"David","EtaAtDeliveryAddress":"2020-12-25T16:45:28.7537228+00:00","EtaAtRestaurant":"2020-12-25T15:30:28.7537228+00:00","Location":{"Accuracy":12.814,"Heading":357.10382,"Latitude":51.51641,"Longitude":-0.103198,"Speed":8.68},"TimeStampWithUtcOffset":"2020-12-25T15:45:28.7537228+00:00","VehicleDetails":{"Vehicle":"Motorbike","VehicleRegistration":"JU51 SAY"}}'
};
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 = @{ @"DriverContactNumber": @"07123456789",
@"DriverName": @"David",
@"EtaAtDeliveryAddress": @"2020-12-25T16:45:28.7537228+00:00",
@"EtaAtRestaurant": @"2020-12-25T15:30:28.7537228+00:00",
@"Location": @{ @"Accuracy": @12.814, @"Heading": @357.10382, @"Latitude": @51.51641, @"Longitude": @-0.103198, @"Speed": @8.68 },
@"TimeStampWithUtcOffset": @"2020-12-25T15:45:28.7537228+00:00",
@"VehicleDetails": @{ @"Vehicle": @"Motorbike", @"VehicleRegistration": @"JU51 SAY" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/deliverystate/driverassigned"]
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}}/orders/:orderId/deliverystate/driverassigned" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/deliverystate/driverassigned",
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([
'DriverContactNumber' => '07123456789',
'DriverName' => 'David',
'EtaAtDeliveryAddress' => '2020-12-25T16:45:28.7537228+00:00',
'EtaAtRestaurant' => '2020-12-25T15:30:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
],
'TimeStampWithUtcOffset' => '2020-12-25T15:45:28.7537228+00:00',
'VehicleDetails' => [
'Vehicle' => 'Motorbike',
'VehicleRegistration' => 'JU51 SAY'
]
]),
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}}/orders/:orderId/deliverystate/driverassigned', [
'body' => '{
"DriverContactNumber": "07123456789",
"DriverName": "David",
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T15:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00",
"VehicleDetails": {
"Vehicle": "Motorbike",
"VehicleRegistration": "JU51 SAY"
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/deliverystate/driverassigned');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'DriverContactNumber' => '07123456789',
'DriverName' => 'David',
'EtaAtDeliveryAddress' => '2020-12-25T16:45:28.7537228+00:00',
'EtaAtRestaurant' => '2020-12-25T15:30:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
],
'TimeStampWithUtcOffset' => '2020-12-25T15:45:28.7537228+00:00',
'VehicleDetails' => [
'Vehicle' => 'Motorbike',
'VehicleRegistration' => 'JU51 SAY'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'DriverContactNumber' => '07123456789',
'DriverName' => 'David',
'EtaAtDeliveryAddress' => '2020-12-25T16:45:28.7537228+00:00',
'EtaAtRestaurant' => '2020-12-25T15:30:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
],
'TimeStampWithUtcOffset' => '2020-12-25T15:45:28.7537228+00:00',
'VehicleDetails' => [
'Vehicle' => 'Motorbike',
'VehicleRegistration' => 'JU51 SAY'
]
]));
$request->setRequestUrl('{{baseUrl}}/orders/:orderId/deliverystate/driverassigned');
$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}}/orders/:orderId/deliverystate/driverassigned' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DriverContactNumber": "07123456789",
"DriverName": "David",
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T15:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00",
"VehicleDetails": {
"Vehicle": "Motorbike",
"VehicleRegistration": "JU51 SAY"
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/deliverystate/driverassigned' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DriverContactNumber": "07123456789",
"DriverName": "David",
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T15:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00",
"VehicleDetails": {
"Vehicle": "Motorbike",
"VehicleRegistration": "JU51 SAY"
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/:orderId/deliverystate/driverassigned", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/deliverystate/driverassigned"
payload = {
"DriverContactNumber": "07123456789",
"DriverName": "David",
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T15:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00",
"VehicleDetails": {
"Vehicle": "Motorbike",
"VehicleRegistration": "JU51 SAY"
}
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/deliverystate/driverassigned"
payload <- "{\n \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\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}}/orders/:orderId/deliverystate/driverassigned")
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 \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\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/orders/:orderId/deliverystate/driverassigned') do |req|
req.body = "{\n \"DriverContactNumber\": \"07123456789\",\n \"DriverName\": \"David\",\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T15:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\",\n \"VehicleDetails\": {\n \"Vehicle\": \"Motorbike\",\n \"VehicleRegistration\": \"JU51 SAY\"\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}}/orders/:orderId/deliverystate/driverassigned";
let payload = json!({
"DriverContactNumber": "07123456789",
"DriverName": "David",
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T15:30:28.7537228+00:00",
"Location": json!({
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
}),
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00",
"VehicleDetails": json!({
"Vehicle": "Motorbike",
"VehicleRegistration": "JU51 SAY"
})
});
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}}/orders/:orderId/deliverystate/driverassigned \
--header 'content-type: application/json' \
--data '{
"DriverContactNumber": "07123456789",
"DriverName": "David",
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T15:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00",
"VehicleDetails": {
"Vehicle": "Motorbike",
"VehicleRegistration": "JU51 SAY"
}
}'
echo '{
"DriverContactNumber": "07123456789",
"DriverName": "David",
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T15:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00",
"VehicleDetails": {
"Vehicle": "Motorbike",
"VehicleRegistration": "JU51 SAY"
}
}' | \
http PUT {{baseUrl}}/orders/:orderId/deliverystate/driverassigned \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "DriverContactNumber": "07123456789",\n "DriverName": "David",\n "EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",\n "EtaAtRestaurant": "2020-12-25T15:30:28.7537228+00:00",\n "Location": {\n "Accuracy": 12.814,\n "Heading": 357.10382,\n "Latitude": 51.51641,\n "Longitude": -0.103198,\n "Speed": 8.68\n },\n "TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00",\n "VehicleDetails": {\n "Vehicle": "Motorbike",\n "VehicleRegistration": "JU51 SAY"\n }\n}' \
--output-document \
- {{baseUrl}}/orders/:orderId/deliverystate/driverassigned
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"DriverContactNumber": "07123456789",
"DriverName": "David",
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T15:30:28.7537228+00:00",
"Location": [
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
],
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00",
"VehicleDetails": [
"Vehicle": "Motorbike",
"VehicleRegistration": "JU51 SAY"
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/deliverystate/driverassigned")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Update order with driver at delivery address details
{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress
QUERY PARAMS
orderId
BODY json
{
"Location": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"TimeStampWithUtcOffset": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress");
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 \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress" {:content-type :json
:form-params {:TimeStampWithUtcOffset "2018-03-10T14:45:28.7537228+00:00"}})
require "http/client"
url = "{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/atdeliveryaddress"),
Content = new StringContent("{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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/:orderId/deliverystate/atdeliveryaddress");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress"
payload := strings.NewReader("{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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/orders/:orderId/deliverystate/atdeliveryaddress HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 67
{
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress")
.setHeader("content-type", "application/json")
.setBody("{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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 \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress")
.header("content-type", "application/json")
.body("{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}")
.asString();
const data = JSON.stringify({
TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress',
headers: {'content-type': 'application/json'},
data: {TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"TimeStampWithUtcOffset":"2018-03-10T14:45:28.7537228+00:00"}'
};
try {
const response = await 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/:orderId/deliverystate/atdeliveryaddress',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress")
.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/orders/:orderId/deliverystate/atdeliveryaddress',
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({TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress',
headers: {'content-type': 'application/json'},
body: {TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'},
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}}/orders/:orderId/deliverystate/atdeliveryaddress');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'
});
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}}/orders/:orderId/deliverystate/atdeliveryaddress',
headers: {'content-type': 'application/json'},
data: {TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"TimeStampWithUtcOffset":"2018-03-10T14:45:28.7537228+00:00"}'
};
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 = @{ @"TimeStampWithUtcOffset": @"2018-03-10T14:45:28.7537228+00:00" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress"]
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}}/orders/:orderId/deliverystate/atdeliveryaddress" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress",
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([
'TimeStampWithUtcOffset' => '2018-03-10T14:45:28.7537228+00:00'
]),
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}}/orders/:orderId/deliverystate/atdeliveryaddress', [
'body' => '{
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'TimeStampWithUtcOffset' => '2018-03-10T14:45:28.7537228+00:00'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'TimeStampWithUtcOffset' => '2018-03-10T14:45:28.7537228+00:00'
]));
$request->setRequestUrl('{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress');
$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}}/orders/:orderId/deliverystate/atdeliveryaddress' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/:orderId/deliverystate/atdeliveryaddress", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress"
payload = { "TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00" }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress"
payload <- "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/atdeliveryaddress")
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 \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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/orders/:orderId/deliverystate/atdeliveryaddress') do |req|
req.body = "{\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/atdeliveryaddress";
let payload = json!({"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"});
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}}/orders/:orderId/deliverystate/atdeliveryaddress \
--header 'content-type: application/json' \
--data '{
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}'
echo '{
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}' | \
http PUT {{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"\n}' \
--output-document \
- {{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/deliverystate/atdeliveryaddress")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Update order with driver at restaurant details
{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant
QUERY PARAMS
orderId
BODY json
{
"EtaAtDeliveryAddress": "",
"Location": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"TimeStampWithUtcOffset": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant");
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 \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant" {:content-type :json
:form-params {:EtaAtDeliveryAddress "2018-03-10T15:45:28.7537228+00:00"
:Location {:Accuracy 12.814
:Heading 357.10382
:Latitude 51.51641
:Longitude -0.103198
:Speed 8.68}
:TimeStampWithUtcOffset "2018-03-10T14:45:28.7537228+00:00"}})
require "http/client"
url = "{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/atrestaurant"),
Content = new StringContent("{\n \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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/:orderId/deliverystate/atrestaurant");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant"
payload := strings.NewReader("{\n \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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/orders/:orderId/deliverystate/atrestaurant HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 273
{
"EtaAtDeliveryAddress": "2018-03-10T15:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant")
.setHeader("content-type", "application/json")
.setBody("{\n \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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 \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant")
.header("content-type", "application/json")
.body("{\n \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}")
.asString();
const data = JSON.stringify({
EtaAtDeliveryAddress: '2018-03-10T15:45:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant',
headers: {'content-type': 'application/json'},
data: {
EtaAtDeliveryAddress: '2018-03-10T15:45:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"EtaAtDeliveryAddress":"2018-03-10T15:45:28.7537228+00:00","Location":{"Accuracy":12.814,"Heading":357.10382,"Latitude":51.51641,"Longitude":-0.103198,"Speed":8.68},"TimeStampWithUtcOffset":"2018-03-10T14:45:28.7537228+00:00"}'
};
try {
const response = await 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/:orderId/deliverystate/atrestaurant',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "EtaAtDeliveryAddress": "2018-03-10T15:45:28.7537228+00:00",\n "Location": {\n "Accuracy": 12.814,\n "Heading": 357.10382,\n "Latitude": 51.51641,\n "Longitude": -0.103198,\n "Speed": 8.68\n },\n "TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant")
.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/orders/:orderId/deliverystate/atrestaurant',
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({
EtaAtDeliveryAddress: '2018-03-10T15:45:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant',
headers: {'content-type': 'application/json'},
body: {
EtaAtDeliveryAddress: '2018-03-10T15:45:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'
},
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}}/orders/:orderId/deliverystate/atrestaurant');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
EtaAtDeliveryAddress: '2018-03-10T15:45:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'
});
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}}/orders/:orderId/deliverystate/atrestaurant',
headers: {'content-type': 'application/json'},
data: {
EtaAtDeliveryAddress: '2018-03-10T15:45:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2018-03-10T14:45:28.7537228+00:00'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"EtaAtDeliveryAddress":"2018-03-10T15:45:28.7537228+00:00","Location":{"Accuracy":12.814,"Heading":357.10382,"Latitude":51.51641,"Longitude":-0.103198,"Speed":8.68},"TimeStampWithUtcOffset":"2018-03-10T14:45:28.7537228+00:00"}'
};
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 = @{ @"EtaAtDeliveryAddress": @"2018-03-10T15:45:28.7537228+00:00",
@"Location": @{ @"Accuracy": @12.814, @"Heading": @357.10382, @"Latitude": @51.51641, @"Longitude": @-0.103198, @"Speed": @8.68 },
@"TimeStampWithUtcOffset": @"2018-03-10T14:45:28.7537228+00:00" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant"]
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}}/orders/:orderId/deliverystate/atrestaurant" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant",
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([
'EtaAtDeliveryAddress' => '2018-03-10T15:45:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
],
'TimeStampWithUtcOffset' => '2018-03-10T14:45:28.7537228+00:00'
]),
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}}/orders/:orderId/deliverystate/atrestaurant', [
'body' => '{
"EtaAtDeliveryAddress": "2018-03-10T15:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'EtaAtDeliveryAddress' => '2018-03-10T15:45:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
],
'TimeStampWithUtcOffset' => '2018-03-10T14:45:28.7537228+00:00'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'EtaAtDeliveryAddress' => '2018-03-10T15:45:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
],
'TimeStampWithUtcOffset' => '2018-03-10T14:45:28.7537228+00:00'
]));
$request->setRequestUrl('{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant');
$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}}/orders/:orderId/deliverystate/atrestaurant' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"EtaAtDeliveryAddress": "2018-03-10T15:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"EtaAtDeliveryAddress": "2018-03-10T15:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/:orderId/deliverystate/atrestaurant", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant"
payload = {
"EtaAtDeliveryAddress": "2018-03-10T15:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant"
payload <- "{\n \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/atrestaurant")
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 \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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/orders/:orderId/deliverystate/atrestaurant') do |req|
req.body = "{\n \"EtaAtDeliveryAddress\": \"2018-03-10T15:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2018-03-10T14:45:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/atrestaurant";
let payload = json!({
"EtaAtDeliveryAddress": "2018-03-10T15:45:28.7537228+00:00",
"Location": json!({
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
}),
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
});
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}}/orders/:orderId/deliverystate/atrestaurant \
--header 'content-type: application/json' \
--data '{
"EtaAtDeliveryAddress": "2018-03-10T15:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}'
echo '{
"EtaAtDeliveryAddress": "2018-03-10T15:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
}' | \
http PUT {{baseUrl}}/orders/:orderId/deliverystate/atrestaurant \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "EtaAtDeliveryAddress": "2018-03-10T15:45:28.7537228+00:00",\n "Location": {\n "Accuracy": 12.814,\n "Heading": 357.10382,\n "Latitude": 51.51641,\n "Longitude": -0.103198,\n "Speed": 8.68\n },\n "TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"\n}' \
--output-document \
- {{baseUrl}}/orders/:orderId/deliverystate/atrestaurant
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"EtaAtDeliveryAddress": "2018-03-10T15:45:28.7537228+00:00",
"Location": [
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
],
"TimeStampWithUtcOffset": "2018-03-10T14:45:28.7537228+00:00"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/deliverystate/atrestaurant")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Update order with driver on its way details
{{baseUrl}}/orders/:orderId/deliverystate/onitsway
QUERY PARAMS
orderId
BODY json
{
"EstimatedArrivalTime": "",
"Location": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"TimeStampWithUtcOffset": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/deliverystate/onitsway");
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 \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/deliverystate/onitsway" {:content-type :json
:form-params {:EstimatedArrivalTime "2020-12-25T16:45:28.7537228+00:00"
:Location {:Accuracy 12.814
:Heading 357.10382
:Latitude 51.51641
:Longitude -0.103198
:Speed 8.68}
:TimeStampWithUtcOffset "2020-12-25T15:30:28.7537228+00:00"}})
require "http/client"
url = "{{baseUrl}}/orders/:orderId/deliverystate/onitsway"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/onitsway"),
Content = new StringContent("{\n \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\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/:orderId/deliverystate/onitsway");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/deliverystate/onitsway"
payload := strings.NewReader("{\n \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\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/orders/:orderId/deliverystate/onitsway HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 273
{
"EstimatedArrivalTime": "2020-12-25T16:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:30:28.7537228+00:00"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/deliverystate/onitsway")
.setHeader("content-type", "application/json")
.setBody("{\n \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/deliverystate/onitsway"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\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 \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/onitsway")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/deliverystate/onitsway")
.header("content-type", "application/json")
.body("{\n \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\n}")
.asString();
const data = JSON.stringify({
EstimatedArrivalTime: '2020-12-25T16:45:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:30:28.7537228+00:00'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/deliverystate/onitsway');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/onitsway',
headers: {'content-type': 'application/json'},
data: {
EstimatedArrivalTime: '2020-12-25T16:45:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:30:28.7537228+00:00'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/deliverystate/onitsway';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"EstimatedArrivalTime":"2020-12-25T16:45:28.7537228+00:00","Location":{"Accuracy":12.814,"Heading":357.10382,"Latitude":51.51641,"Longitude":-0.103198,"Speed":8.68},"TimeStampWithUtcOffset":"2020-12-25T15:30:28.7537228+00:00"}'
};
try {
const response = await 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/:orderId/deliverystate/onitsway',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "EstimatedArrivalTime": "2020-12-25T16:45:28.7537228+00:00",\n "Location": {\n "Accuracy": 12.814,\n "Heading": 357.10382,\n "Latitude": 51.51641,\n "Longitude": -0.103198,\n "Speed": 8.68\n },\n "TimeStampWithUtcOffset": "2020-12-25T15:30:28.7537228+00:00"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/onitsway")
.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/orders/:orderId/deliverystate/onitsway',
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({
EstimatedArrivalTime: '2020-12-25T16:45:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:30:28.7537228+00:00'
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/onitsway',
headers: {'content-type': 'application/json'},
body: {
EstimatedArrivalTime: '2020-12-25T16:45:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:30:28.7537228+00:00'
},
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}}/orders/:orderId/deliverystate/onitsway');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
EstimatedArrivalTime: '2020-12-25T16:45:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:30:28.7537228+00:00'
});
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}}/orders/:orderId/deliverystate/onitsway',
headers: {'content-type': 'application/json'},
data: {
EstimatedArrivalTime: '2020-12-25T16:45:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:30:28.7537228+00:00'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/deliverystate/onitsway';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"EstimatedArrivalTime":"2020-12-25T16:45:28.7537228+00:00","Location":{"Accuracy":12.814,"Heading":357.10382,"Latitude":51.51641,"Longitude":-0.103198,"Speed":8.68},"TimeStampWithUtcOffset":"2020-12-25T15:30:28.7537228+00:00"}'
};
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 = @{ @"EstimatedArrivalTime": @"2020-12-25T16:45:28.7537228+00:00",
@"Location": @{ @"Accuracy": @12.814, @"Heading": @357.10382, @"Latitude": @51.51641, @"Longitude": @-0.103198, @"Speed": @8.68 },
@"TimeStampWithUtcOffset": @"2020-12-25T15:30:28.7537228+00:00" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/deliverystate/onitsway"]
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}}/orders/:orderId/deliverystate/onitsway" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/deliverystate/onitsway",
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([
'EstimatedArrivalTime' => '2020-12-25T16:45:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
],
'TimeStampWithUtcOffset' => '2020-12-25T15:30:28.7537228+00:00'
]),
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}}/orders/:orderId/deliverystate/onitsway', [
'body' => '{
"EstimatedArrivalTime": "2020-12-25T16:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:30:28.7537228+00:00"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/deliverystate/onitsway');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'EstimatedArrivalTime' => '2020-12-25T16:45:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
],
'TimeStampWithUtcOffset' => '2020-12-25T15:30:28.7537228+00:00'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'EstimatedArrivalTime' => '2020-12-25T16:45:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
],
'TimeStampWithUtcOffset' => '2020-12-25T15:30:28.7537228+00:00'
]));
$request->setRequestUrl('{{baseUrl}}/orders/:orderId/deliverystate/onitsway');
$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}}/orders/:orderId/deliverystate/onitsway' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"EstimatedArrivalTime": "2020-12-25T16:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:30:28.7537228+00:00"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/deliverystate/onitsway' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"EstimatedArrivalTime": "2020-12-25T16:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:30:28.7537228+00:00"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/:orderId/deliverystate/onitsway", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/deliverystate/onitsway"
payload = {
"EstimatedArrivalTime": "2020-12-25T16:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:30:28.7537228+00:00"
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/deliverystate/onitsway"
payload <- "{\n \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/onitsway")
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 \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\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/orders/:orderId/deliverystate/onitsway') do |req|
req.body = "{\n \"EstimatedArrivalTime\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:30:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/onitsway";
let payload = json!({
"EstimatedArrivalTime": "2020-12-25T16:45:28.7537228+00:00",
"Location": json!({
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
}),
"TimeStampWithUtcOffset": "2020-12-25T15:30:28.7537228+00:00"
});
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}}/orders/:orderId/deliverystate/onitsway \
--header 'content-type: application/json' \
--data '{
"EstimatedArrivalTime": "2020-12-25T16:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:30:28.7537228+00:00"
}'
echo '{
"EstimatedArrivalTime": "2020-12-25T16:45:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:30:28.7537228+00:00"
}' | \
http PUT {{baseUrl}}/orders/:orderId/deliverystate/onitsway \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "EstimatedArrivalTime": "2020-12-25T16:45:28.7537228+00:00",\n "Location": {\n "Accuracy": 12.814,\n "Heading": 357.10382,\n "Latitude": 51.51641,\n "Longitude": -0.103198,\n "Speed": 8.68\n },\n "TimeStampWithUtcOffset": "2020-12-25T15:30:28.7537228+00:00"\n}' \
--output-document \
- {{baseUrl}}/orders/:orderId/deliverystate/onitsway
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"EstimatedArrivalTime": "2020-12-25T16:45:28.7537228+00:00",
"Location": [
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
],
"TimeStampWithUtcOffset": "2020-12-25T15:30:28.7537228+00:00"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/deliverystate/onitsway")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Update order with driver unassigned details
{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned
QUERY PARAMS
orderId
BODY json
{
"Comment": "",
"DriverContactNumber": "",
"DriverName": "",
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location:": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"Reason": "",
"TimeStampWithUtcOffset": "",
"UnassignedBy": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned");
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 \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned" {:content-type :json
:form-params {:Comment ""
:DriverContactNumber ""
:DriverName ""
:EtaAtDeliveryAddress ""
:EtaAtRestaurant ""
:Location: {:Accuracy ""
:Heading ""
:Latitude ""
:Longitude ""
:Speed ""}
:Reason ""
:TimeStampWithUtcOffset ""
:UnassignedBy ""}})
require "http/client"
url = "{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\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}}/orders/:orderId/deliverystate/driverunassigned"),
Content = new StringContent("{\n \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\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/:orderId/deliverystate/driverunassigned");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned"
payload := strings.NewReader("{\n \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\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/orders/:orderId/deliverystate/driverunassigned HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 311
{
"Comment": "",
"DriverContactNumber": "",
"DriverName": "",
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location:": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"Reason": "",
"TimeStampWithUtcOffset": "",
"UnassignedBy": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned")
.setHeader("content-type", "application/json")
.setBody("{\n \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\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 \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned")
.header("content-type", "application/json")
.body("{\n \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\n}")
.asString();
const data = JSON.stringify({
Comment: '',
DriverContactNumber: '',
DriverName: '',
EtaAtDeliveryAddress: '',
EtaAtRestaurant: '',
'Location:': {
Accuracy: '',
Heading: '',
Latitude: '',
Longitude: '',
Speed: ''
},
Reason: '',
TimeStampWithUtcOffset: '',
UnassignedBy: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned',
headers: {'content-type': 'application/json'},
data: {
Comment: '',
DriverContactNumber: '',
DriverName: '',
EtaAtDeliveryAddress: '',
EtaAtRestaurant: '',
'Location:': {Accuracy: '', Heading: '', Latitude: '', Longitude: '', Speed: ''},
Reason: '',
TimeStampWithUtcOffset: '',
UnassignedBy: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Comment":"","DriverContactNumber":"","DriverName":"","EtaAtDeliveryAddress":"","EtaAtRestaurant":"","Location:":{"Accuracy":"","Heading":"","Latitude":"","Longitude":"","Speed":""},"Reason":"","TimeStampWithUtcOffset":"","UnassignedBy":""}'
};
try {
const response = await 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/:orderId/deliverystate/driverunassigned',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Comment": "",\n "DriverContactNumber": "",\n "DriverName": "",\n "EtaAtDeliveryAddress": "",\n "EtaAtRestaurant": "",\n "Location:": {\n "Accuracy": "",\n "Heading": "",\n "Latitude": "",\n "Longitude": "",\n "Speed": ""\n },\n "Reason": "",\n "TimeStampWithUtcOffset": "",\n "UnassignedBy": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned")
.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/orders/:orderId/deliverystate/driverunassigned',
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({
Comment: '',
DriverContactNumber: '',
DriverName: '',
EtaAtDeliveryAddress: '',
EtaAtRestaurant: '',
'Location:': {Accuracy: '', Heading: '', Latitude: '', Longitude: '', Speed: ''},
Reason: '',
TimeStampWithUtcOffset: '',
UnassignedBy: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned',
headers: {'content-type': 'application/json'},
body: {
Comment: '',
DriverContactNumber: '',
DriverName: '',
EtaAtDeliveryAddress: '',
EtaAtRestaurant: '',
'Location:': {Accuracy: '', Heading: '', Latitude: '', Longitude: '', Speed: ''},
Reason: '',
TimeStampWithUtcOffset: '',
UnassignedBy: ''
},
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}}/orders/:orderId/deliverystate/driverunassigned');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Comment: '',
DriverContactNumber: '',
DriverName: '',
EtaAtDeliveryAddress: '',
EtaAtRestaurant: '',
'Location:': {
Accuracy: '',
Heading: '',
Latitude: '',
Longitude: '',
Speed: ''
},
Reason: '',
TimeStampWithUtcOffset: '',
UnassignedBy: ''
});
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}}/orders/:orderId/deliverystate/driverunassigned',
headers: {'content-type': 'application/json'},
data: {
Comment: '',
DriverContactNumber: '',
DriverName: '',
EtaAtDeliveryAddress: '',
EtaAtRestaurant: '',
'Location:': {Accuracy: '', Heading: '', Latitude: '', Longitude: '', Speed: ''},
Reason: '',
TimeStampWithUtcOffset: '',
UnassignedBy: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Comment":"","DriverContactNumber":"","DriverName":"","EtaAtDeliveryAddress":"","EtaAtRestaurant":"","Location:":{"Accuracy":"","Heading":"","Latitude":"","Longitude":"","Speed":""},"Reason":"","TimeStampWithUtcOffset":"","UnassignedBy":""}'
};
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 = @{ @"Comment": @"",
@"DriverContactNumber": @"",
@"DriverName": @"",
@"EtaAtDeliveryAddress": @"",
@"EtaAtRestaurant": @"",
@"Location:": @{ @"Accuracy": @"", @"Heading": @"", @"Latitude": @"", @"Longitude": @"", @"Speed": @"" },
@"Reason": @"",
@"TimeStampWithUtcOffset": @"",
@"UnassignedBy": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned"]
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}}/orders/:orderId/deliverystate/driverunassigned" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned",
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([
'Comment' => '',
'DriverContactNumber' => '',
'DriverName' => '',
'EtaAtDeliveryAddress' => '',
'EtaAtRestaurant' => '',
'Location:' => [
'Accuracy' => '',
'Heading' => '',
'Latitude' => '',
'Longitude' => '',
'Speed' => ''
],
'Reason' => '',
'TimeStampWithUtcOffset' => '',
'UnassignedBy' => ''
]),
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}}/orders/:orderId/deliverystate/driverunassigned', [
'body' => '{
"Comment": "",
"DriverContactNumber": "",
"DriverName": "",
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location:": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"Reason": "",
"TimeStampWithUtcOffset": "",
"UnassignedBy": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Comment' => '',
'DriverContactNumber' => '',
'DriverName' => '',
'EtaAtDeliveryAddress' => '',
'EtaAtRestaurant' => '',
'Location:' => [
'Accuracy' => '',
'Heading' => '',
'Latitude' => '',
'Longitude' => '',
'Speed' => ''
],
'Reason' => '',
'TimeStampWithUtcOffset' => '',
'UnassignedBy' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Comment' => '',
'DriverContactNumber' => '',
'DriverName' => '',
'EtaAtDeliveryAddress' => '',
'EtaAtRestaurant' => '',
'Location:' => [
'Accuracy' => '',
'Heading' => '',
'Latitude' => '',
'Longitude' => '',
'Speed' => ''
],
'Reason' => '',
'TimeStampWithUtcOffset' => '',
'UnassignedBy' => ''
]));
$request->setRequestUrl('{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned');
$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}}/orders/:orderId/deliverystate/driverunassigned' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Comment": "",
"DriverContactNumber": "",
"DriverName": "",
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location:": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"Reason": "",
"TimeStampWithUtcOffset": "",
"UnassignedBy": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Comment": "",
"DriverContactNumber": "",
"DriverName": "",
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location:": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"Reason": "",
"TimeStampWithUtcOffset": "",
"UnassignedBy": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/:orderId/deliverystate/driverunassigned", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned"
payload = {
"Comment": "",
"DriverContactNumber": "",
"DriverName": "",
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location:": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"Reason": "",
"TimeStampWithUtcOffset": "",
"UnassignedBy": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned"
payload <- "{\n \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\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}}/orders/:orderId/deliverystate/driverunassigned")
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 \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\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/orders/:orderId/deliverystate/driverunassigned') do |req|
req.body = "{\n \"Comment\": \"\",\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EtaAtDeliveryAddress\": \"\",\n \"EtaAtRestaurant\": \"\",\n \"Location:\": {\n \"Accuracy\": \"\",\n \"Heading\": \"\",\n \"Latitude\": \"\",\n \"Longitude\": \"\",\n \"Speed\": \"\"\n },\n \"Reason\": \"\",\n \"TimeStampWithUtcOffset\": \"\",\n \"UnassignedBy\": \"\"\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}}/orders/:orderId/deliverystate/driverunassigned";
let payload = json!({
"Comment": "",
"DriverContactNumber": "",
"DriverName": "",
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location:": json!({
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
}),
"Reason": "",
"TimeStampWithUtcOffset": "",
"UnassignedBy": ""
});
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}}/orders/:orderId/deliverystate/driverunassigned \
--header 'content-type: application/json' \
--data '{
"Comment": "",
"DriverContactNumber": "",
"DriverName": "",
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location:": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"Reason": "",
"TimeStampWithUtcOffset": "",
"UnassignedBy": ""
}'
echo '{
"Comment": "",
"DriverContactNumber": "",
"DriverName": "",
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location:": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"Reason": "",
"TimeStampWithUtcOffset": "",
"UnassignedBy": ""
}' | \
http PUT {{baseUrl}}/orders/:orderId/deliverystate/driverunassigned \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "Comment": "",\n "DriverContactNumber": "",\n "DriverName": "",\n "EtaAtDeliveryAddress": "",\n "EtaAtRestaurant": "",\n "Location:": {\n "Accuracy": "",\n "Heading": "",\n "Latitude": "",\n "Longitude": "",\n "Speed": ""\n },\n "Reason": "",\n "TimeStampWithUtcOffset": "",\n "UnassignedBy": ""\n}' \
--output-document \
- {{baseUrl}}/orders/:orderId/deliverystate/driverunassigned
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"Comment": "",
"DriverContactNumber": "",
"DriverName": "",
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location:": [
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
],
"Reason": "",
"TimeStampWithUtcOffset": "",
"UnassignedBy": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/deliverystate/driverunassigned")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"partnerId": [
"Partner id was not found or could not be parsed"
]
}
PUT
Update the driver's current location
{{baseUrl}}/orders/:orderId/deliverystate/driverlocation
QUERY PARAMS
orderId
BODY json
{
"EtaAtDeliveryAddress": "",
"EtaAtRestaurant": "",
"Location": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"TimeStampWithUtcOffset": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/deliverystate/driverlocation");
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 \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/deliverystate/driverlocation" {:content-type :json
:form-params {:EtaAtDeliveryAddress "2020-12-25T16:45:28.7537228+00:00"
:EtaAtRestaurant "2020-12-25T16:30:28.7537228+00:00"
:Location {:Accuracy 12.814
:Heading 357.10382
:Latitude 51.51641
:Longitude -0.103198
:Speed 8.68}
:TimeStampWithUtcOffset "2020-12-25T15:45:28.7537228+00:00"}})
require "http/client"
url = "{{baseUrl}}/orders/:orderId/deliverystate/driverlocation"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/driverlocation"),
Content = new StringContent("{\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\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/:orderId/deliverystate/driverlocation");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/deliverystate/driverlocation"
payload := strings.NewReader("{\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\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/orders/:orderId/deliverystate/driverlocation HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 331
{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/deliverystate/driverlocation")
.setHeader("content-type", "application/json")
.setBody("{\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/deliverystate/driverlocation"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\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 \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/driverlocation")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/deliverystate/driverlocation")
.header("content-type", "application/json")
.body("{\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\n}")
.asString();
const data = JSON.stringify({
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T16:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:45:28.7537228+00:00'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/deliverystate/driverlocation');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/driverlocation',
headers: {'content-type': 'application/json'},
data: {
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T16:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:45:28.7537228+00:00'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/deliverystate/driverlocation';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"EtaAtDeliveryAddress":"2020-12-25T16:45:28.7537228+00:00","EtaAtRestaurant":"2020-12-25T16:30:28.7537228+00:00","Location":{"Accuracy":12.814,"Heading":357.10382,"Latitude":51.51641,"Longitude":-0.103198,"Speed":8.68},"TimeStampWithUtcOffset":"2020-12-25T15:45:28.7537228+00:00"}'
};
try {
const response = await 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/:orderId/deliverystate/driverlocation',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",\n "EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",\n "Location": {\n "Accuracy": 12.814,\n "Heading": 357.10382,\n "Latitude": 51.51641,\n "Longitude": -0.103198,\n "Speed": 8.68\n },\n "TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/driverlocation")
.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/orders/:orderId/deliverystate/driverlocation',
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({
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T16:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:45:28.7537228+00:00'
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/driverlocation',
headers: {'content-type': 'application/json'},
body: {
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T16:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:45:28.7537228+00:00'
},
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}}/orders/:orderId/deliverystate/driverlocation');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T16:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:45:28.7537228+00:00'
});
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}}/orders/:orderId/deliverystate/driverlocation',
headers: {'content-type': 'application/json'},
data: {
EtaAtDeliveryAddress: '2020-12-25T16:45:28.7537228+00:00',
EtaAtRestaurant: '2020-12-25T16:30:28.7537228+00:00',
Location: {
Accuracy: 12.814,
Heading: 357.10382,
Latitude: 51.51641,
Longitude: -0.103198,
Speed: 8.68
},
TimeStampWithUtcOffset: '2020-12-25T15:45:28.7537228+00:00'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/deliverystate/driverlocation';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"EtaAtDeliveryAddress":"2020-12-25T16:45:28.7537228+00:00","EtaAtRestaurant":"2020-12-25T16:30:28.7537228+00:00","Location":{"Accuracy":12.814,"Heading":357.10382,"Latitude":51.51641,"Longitude":-0.103198,"Speed":8.68},"TimeStampWithUtcOffset":"2020-12-25T15:45:28.7537228+00:00"}'
};
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 = @{ @"EtaAtDeliveryAddress": @"2020-12-25T16:45:28.7537228+00:00",
@"EtaAtRestaurant": @"2020-12-25T16:30:28.7537228+00:00",
@"Location": @{ @"Accuracy": @12.814, @"Heading": @357.10382, @"Latitude": @51.51641, @"Longitude": @-0.103198, @"Speed": @8.68 },
@"TimeStampWithUtcOffset": @"2020-12-25T15:45:28.7537228+00:00" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/deliverystate/driverlocation"]
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}}/orders/:orderId/deliverystate/driverlocation" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/deliverystate/driverlocation",
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([
'EtaAtDeliveryAddress' => '2020-12-25T16:45:28.7537228+00:00',
'EtaAtRestaurant' => '2020-12-25T16:30:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
],
'TimeStampWithUtcOffset' => '2020-12-25T15:45:28.7537228+00:00'
]),
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}}/orders/:orderId/deliverystate/driverlocation', [
'body' => '{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/deliverystate/driverlocation');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'EtaAtDeliveryAddress' => '2020-12-25T16:45:28.7537228+00:00',
'EtaAtRestaurant' => '2020-12-25T16:30:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
],
'TimeStampWithUtcOffset' => '2020-12-25T15:45:28.7537228+00:00'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'EtaAtDeliveryAddress' => '2020-12-25T16:45:28.7537228+00:00',
'EtaAtRestaurant' => '2020-12-25T16:30:28.7537228+00:00',
'Location' => [
'Accuracy' => 12.814,
'Heading' => 357.10382,
'Latitude' => 51.51641,
'Longitude' => -0.103198,
'Speed' => 8.68
],
'TimeStampWithUtcOffset' => '2020-12-25T15:45:28.7537228+00:00'
]));
$request->setRequestUrl('{{baseUrl}}/orders/:orderId/deliverystate/driverlocation');
$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}}/orders/:orderId/deliverystate/driverlocation' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/deliverystate/driverlocation' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/:orderId/deliverystate/driverlocation", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/deliverystate/driverlocation"
payload = {
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00"
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/deliverystate/driverlocation"
payload <- "{\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/driverlocation")
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 \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\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/orders/:orderId/deliverystate/driverlocation') do |req|
req.body = "{\n \"EtaAtDeliveryAddress\": \"2020-12-25T16:45:28.7537228+00:00\",\n \"EtaAtRestaurant\": \"2020-12-25T16:30:28.7537228+00:00\",\n \"Location\": {\n \"Accuracy\": 12.814,\n \"Heading\": 357.10382,\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198,\n \"Speed\": 8.68\n },\n \"TimeStampWithUtcOffset\": \"2020-12-25T15:45:28.7537228+00:00\"\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}}/orders/:orderId/deliverystate/driverlocation";
let payload = json!({
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": json!({
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
}),
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00"
});
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}}/orders/:orderId/deliverystate/driverlocation \
--header 'content-type: application/json' \
--data '{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00"
}'
echo '{
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": {
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
},
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00"
}' | \
http PUT {{baseUrl}}/orders/:orderId/deliverystate/driverlocation \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",\n "EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",\n "Location": {\n "Accuracy": 12.814,\n "Heading": 357.10382,\n "Latitude": 51.51641,\n "Longitude": -0.103198,\n "Speed": 8.68\n },\n "TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00"\n}' \
--output-document \
- {{baseUrl}}/orders/:orderId/deliverystate/driverlocation
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"EtaAtDeliveryAddress": "2020-12-25T16:45:28.7537228+00:00",
"EtaAtRestaurant": "2020-12-25T16:30:28.7537228+00:00",
"Location": [
"Accuracy": 12.814,
"Heading": 357.10382,
"Latitude": 51.51641,
"Longitude": -0.103198,
"Speed": 8.68
],
"TimeStampWithUtcOffset": "2020-12-25T15:45:28.7537228+00:00"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/deliverystate/driverlocation")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Update the driver's estimated time to arrive at the Restaurant
{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta
QUERY PARAMS
orderId
BODY json
{
"bestGuess": "",
"estimatedAt": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta");
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 \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta" {:content-type :json
:form-params {:bestGuess ""
:estimatedAt ""}})
require "http/client"
url = "{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\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}}/orders/:orderId/deliverystate/atrestauranteta"),
Content = new StringContent("{\n \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\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/:orderId/deliverystate/atrestauranteta");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta"
payload := strings.NewReader("{\n \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\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/orders/:orderId/deliverystate/atrestauranteta HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 42
{
"bestGuess": "",
"estimatedAt": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta")
.setHeader("content-type", "application/json")
.setBody("{\n \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\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 \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta")
.header("content-type", "application/json")
.body("{\n \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\n}")
.asString();
const data = JSON.stringify({
bestGuess: '',
estimatedAt: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta',
headers: {'content-type': 'application/json'},
data: {bestGuess: '', estimatedAt: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"bestGuess":"","estimatedAt":""}'
};
try {
const response = await 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/:orderId/deliverystate/atrestauranteta',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "bestGuess": "",\n "estimatedAt": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta")
.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/orders/:orderId/deliverystate/atrestauranteta',
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({bestGuess: '', estimatedAt: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta',
headers: {'content-type': 'application/json'},
body: {bestGuess: '', estimatedAt: ''},
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}}/orders/:orderId/deliverystate/atrestauranteta');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
bestGuess: '',
estimatedAt: ''
});
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}}/orders/:orderId/deliverystate/atrestauranteta',
headers: {'content-type': 'application/json'},
data: {bestGuess: '', estimatedAt: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"bestGuess":"","estimatedAt":""}'
};
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 = @{ @"bestGuess": @"",
@"estimatedAt": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta"]
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}}/orders/:orderId/deliverystate/atrestauranteta" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta",
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([
'bestGuess' => '',
'estimatedAt' => ''
]),
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}}/orders/:orderId/deliverystate/atrestauranteta', [
'body' => '{
"bestGuess": "",
"estimatedAt": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'bestGuess' => '',
'estimatedAt' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'bestGuess' => '',
'estimatedAt' => ''
]));
$request->setRequestUrl('{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta');
$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}}/orders/:orderId/deliverystate/atrestauranteta' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"bestGuess": "",
"estimatedAt": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"bestGuess": "",
"estimatedAt": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/orders/:orderId/deliverystate/atrestauranteta", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta"
payload = {
"bestGuess": "",
"estimatedAt": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta"
payload <- "{\n \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\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}}/orders/:orderId/deliverystate/atrestauranteta")
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 \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\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/orders/:orderId/deliverystate/atrestauranteta') do |req|
req.body = "{\n \"bestGuess\": \"\",\n \"estimatedAt\": \"\"\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}}/orders/:orderId/deliverystate/atrestauranteta";
let payload = json!({
"bestGuess": "",
"estimatedAt": ""
});
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}}/orders/:orderId/deliverystate/atrestauranteta \
--header 'content-type: application/json' \
--data '{
"bestGuess": "",
"estimatedAt": ""
}'
echo '{
"bestGuess": "",
"estimatedAt": ""
}' | \
http PUT {{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "bestGuess": "",\n "estimatedAt": ""\n}' \
--output-document \
- {{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"bestGuess": "",
"estimatedAt": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:orderId/deliverystate/atrestauranteta")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Driver Assigned to Delivery
{{baseUrl}}/driver-assigned-to-delivery
BODY json
{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/driver-assigned-to-delivery");
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 \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/driver-assigned-to-delivery" {:content-type :json
:form-params {:DriverContactNumber ""
:DriverName ""
:EstimatedDeliveryTime ""
:EstimatedPickupTime ""
:Event ""
:OrderId ""
:TimeStamp ""}})
require "http/client"
url = "{{baseUrl}}/driver-assigned-to-delivery"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-assigned-to-delivery"),
Content = new StringContent("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-assigned-to-delivery");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/driver-assigned-to-delivery"
payload := strings.NewReader("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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/driver-assigned-to-delivery HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 162
{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/driver-assigned-to-delivery")
.setHeader("content-type", "application/json")
.setBody("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/driver-assigned-to-delivery"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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 \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/driver-assigned-to-delivery")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/driver-assigned-to-delivery")
.header("content-type", "application/json")
.body("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
.asString();
const data = JSON.stringify({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/driver-assigned-to-delivery');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/driver-assigned-to-delivery',
headers: {'content-type': 'application/json'},
data: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/driver-assigned-to-delivery';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DriverContactNumber":"","DriverName":"","EstimatedDeliveryTime":"","EstimatedPickupTime":"","Event":"","OrderId":"","TimeStamp":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/driver-assigned-to-delivery',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "DriverContactNumber": "",\n "DriverName": "",\n "EstimatedDeliveryTime": "",\n "EstimatedPickupTime": "",\n "Event": "",\n "OrderId": "",\n "TimeStamp": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/driver-assigned-to-delivery")
.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/driver-assigned-to-delivery',
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({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/driver-assigned-to-delivery',
headers: {'content-type': 'application/json'},
body: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
},
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}}/driver-assigned-to-delivery');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
});
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}}/driver-assigned-to-delivery',
headers: {'content-type': 'application/json'},
data: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/driver-assigned-to-delivery';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DriverContactNumber":"","DriverName":"","EstimatedDeliveryTime":"","EstimatedPickupTime":"","Event":"","OrderId":"","TimeStamp":""}'
};
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 = @{ @"DriverContactNumber": @"",
@"DriverName": @"",
@"EstimatedDeliveryTime": @"",
@"EstimatedPickupTime": @"",
@"Event": @"",
@"OrderId": @"",
@"TimeStamp": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/driver-assigned-to-delivery"]
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}}/driver-assigned-to-delivery" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/driver-assigned-to-delivery",
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([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]),
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}}/driver-assigned-to-delivery', [
'body' => '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/driver-assigned-to-delivery');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]));
$request->setRequestUrl('{{baseUrl}}/driver-assigned-to-delivery');
$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}}/driver-assigned-to-delivery' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/driver-assigned-to-delivery' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/driver-assigned-to-delivery", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/driver-assigned-to-delivery"
payload = {
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/driver-assigned-to-delivery"
payload <- "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-assigned-to-delivery")
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 \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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/driver-assigned-to-delivery') do |req|
req.body = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-assigned-to-delivery";
let payload = json!({
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
});
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}}/driver-assigned-to-delivery \
--header 'content-type: application/json' \
--data '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
echo '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}' | \
http PUT {{baseUrl}}/driver-assigned-to-delivery \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "DriverContactNumber": "",\n "DriverName": "",\n "EstimatedDeliveryTime": "",\n "EstimatedPickupTime": "",\n "Event": "",\n "OrderId": "",\n "TimeStamp": ""\n}' \
--output-document \
- {{baseUrl}}/driver-assigned-to-delivery
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/driver-assigned-to-delivery")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Driver Location
{{baseUrl}}/driver-location
BODY json
{
"Location": {
"Latitude": "",
"Longitude": ""
},
"OrderId": "",
"TimeStamp": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/driver-location");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/driver-location" {:content-type :json
:form-params {:Location {:Latitude 51.51641
:Longitude -0.103198}}})
require "http/client"
url = "{{baseUrl}}/driver-location"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\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}}/driver-location"),
Content = new StringContent("{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\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}}/driver-location");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/driver-location"
payload := strings.NewReader("{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\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/driver-location HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 76
{
"Location": {
"Latitude": 51.51641,
"Longitude": -0.103198
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/driver-location")
.setHeader("content-type", "application/json")
.setBody("{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/driver-location"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n }\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/driver-location")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/driver-location")
.header("content-type", "application/json")
.body("{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n }\n}")
.asString();
const data = JSON.stringify({
Location: {
Latitude: 51.51641,
Longitude: -0.103198
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/driver-location');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/driver-location',
headers: {'content-type': 'application/json'},
data: {Location: {Latitude: 51.51641, Longitude: -0.103198}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/driver-location';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Location":{"Latitude":51.51641,"Longitude":-0.103198}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/driver-location',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Location": {\n "Latitude": 51.51641,\n "Longitude": -0.103198\n }\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/driver-location")
.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/driver-location',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({Location: {Latitude: 51.51641, Longitude: -0.103198}}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/driver-location',
headers: {'content-type': 'application/json'},
body: {Location: {Latitude: 51.51641, Longitude: -0.103198}},
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}}/driver-location');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Location: {
Latitude: 51.51641,
Longitude: -0.103198
}
});
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}}/driver-location',
headers: {'content-type': 'application/json'},
data: {Location: {Latitude: 51.51641, Longitude: -0.103198}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/driver-location';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Location":{"Latitude":51.51641,"Longitude":-0.103198}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"application/json" };
NSDictionary *parameters = @{ @"Location": @{ @"Latitude": @51.51641, @"Longitude": @-0.103198 } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/driver-location"]
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}}/driver-location" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/driver-location",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'Location' => [
'Latitude' => 51.51641,
'Longitude' => -0.103198
]
]),
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}}/driver-location', [
'body' => '{
"Location": {
"Latitude": 51.51641,
"Longitude": -0.103198
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/driver-location');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Location' => [
'Latitude' => 51.51641,
'Longitude' => -0.103198
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Location' => [
'Latitude' => 51.51641,
'Longitude' => -0.103198
]
]));
$request->setRequestUrl('{{baseUrl}}/driver-location');
$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}}/driver-location' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Location": {
"Latitude": 51.51641,
"Longitude": -0.103198
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/driver-location' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Location": {
"Latitude": 51.51641,
"Longitude": -0.103198
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/driver-location", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/driver-location"
payload = { "Location": {
"Latitude": 51.51641,
"Longitude": -0.103198
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/driver-location"
payload <- "{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\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}}/driver-location")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\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/driver-location') do |req|
req.body = "{\n \"Location\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\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}}/driver-location";
let payload = json!({"Location": json!({
"Latitude": 51.51641,
"Longitude": -0.103198
})});
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}}/driver-location \
--header 'content-type: application/json' \
--data '{
"Location": {
"Latitude": 51.51641,
"Longitude": -0.103198
}
}'
echo '{
"Location": {
"Latitude": 51.51641,
"Longitude": -0.103198
}
}' | \
http PUT {{baseUrl}}/driver-location \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "Location": {\n "Latitude": 51.51641,\n "Longitude": -0.103198\n }\n}' \
--output-document \
- {{baseUrl}}/driver-location
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["Location": [
"Latitude": 51.51641,
"Longitude": -0.103198
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/driver-location")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Driver at delivery address
{{baseUrl}}/driver-at-delivery-address
BODY json
{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/driver-at-delivery-address");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/driver-at-delivery-address" {:content-type :json
:form-params {:DriverContactNumber ""
:DriverName ""
:EstimatedDeliveryTime ""
:EstimatedPickupTime ""
:Event ""
:OrderId ""
:TimeStamp ""}})
require "http/client"
url = "{{baseUrl}}/driver-at-delivery-address"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-at-delivery-address"),
Content = new StringContent("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-at-delivery-address");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/driver-at-delivery-address"
payload := strings.NewReader("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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/driver-at-delivery-address HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 162
{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/driver-at-delivery-address")
.setHeader("content-type", "application/json")
.setBody("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/driver-at-delivery-address"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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 \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/driver-at-delivery-address")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/driver-at-delivery-address")
.header("content-type", "application/json")
.body("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
.asString();
const data = JSON.stringify({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/driver-at-delivery-address');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/driver-at-delivery-address',
headers: {'content-type': 'application/json'},
data: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/driver-at-delivery-address';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DriverContactNumber":"","DriverName":"","EstimatedDeliveryTime":"","EstimatedPickupTime":"","Event":"","OrderId":"","TimeStamp":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/driver-at-delivery-address',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "DriverContactNumber": "",\n "DriverName": "",\n "EstimatedDeliveryTime": "",\n "EstimatedPickupTime": "",\n "Event": "",\n "OrderId": "",\n "TimeStamp": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/driver-at-delivery-address")
.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/driver-at-delivery-address',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/driver-at-delivery-address',
headers: {'content-type': 'application/json'},
body: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
},
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}}/driver-at-delivery-address');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
});
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}}/driver-at-delivery-address',
headers: {'content-type': 'application/json'},
data: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/driver-at-delivery-address';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DriverContactNumber":"","DriverName":"","EstimatedDeliveryTime":"","EstimatedPickupTime":"","Event":"","OrderId":"","TimeStamp":""}'
};
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 = @{ @"DriverContactNumber": @"",
@"DriverName": @"",
@"EstimatedDeliveryTime": @"",
@"EstimatedPickupTime": @"",
@"Event": @"",
@"OrderId": @"",
@"TimeStamp": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/driver-at-delivery-address"]
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}}/driver-at-delivery-address" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/driver-at-delivery-address",
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([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]),
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}}/driver-at-delivery-address', [
'body' => '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/driver-at-delivery-address');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]));
$request->setRequestUrl('{{baseUrl}}/driver-at-delivery-address');
$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}}/driver-at-delivery-address' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/driver-at-delivery-address' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/driver-at-delivery-address", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/driver-at-delivery-address"
payload = {
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/driver-at-delivery-address"
payload <- "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-at-delivery-address")
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 \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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/driver-at-delivery-address') do |req|
req.body = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-at-delivery-address";
let payload = json!({
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
});
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}}/driver-at-delivery-address \
--header 'content-type: application/json' \
--data '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
echo '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}' | \
http PUT {{baseUrl}}/driver-at-delivery-address \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "DriverContactNumber": "",\n "DriverName": "",\n "EstimatedDeliveryTime": "",\n "EstimatedPickupTime": "",\n "Event": "",\n "OrderId": "",\n "TimeStamp": ""\n}' \
--output-document \
- {{baseUrl}}/driver-at-delivery-address
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/driver-at-delivery-address")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Driver at restaurant
{{baseUrl}}/driver-at-restaurant
BODY json
{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/driver-at-restaurant");
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 \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/driver-at-restaurant" {:content-type :json
:form-params {:DriverContactNumber ""
:DriverName ""
:EstimatedDeliveryTime ""
:EstimatedPickupTime ""
:Event ""
:OrderId ""
:TimeStamp ""}})
require "http/client"
url = "{{baseUrl}}/driver-at-restaurant"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-at-restaurant"),
Content = new StringContent("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-at-restaurant");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/driver-at-restaurant"
payload := strings.NewReader("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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/driver-at-restaurant HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 162
{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/driver-at-restaurant")
.setHeader("content-type", "application/json")
.setBody("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/driver-at-restaurant"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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 \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/driver-at-restaurant")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/driver-at-restaurant")
.header("content-type", "application/json")
.body("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
.asString();
const data = JSON.stringify({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/driver-at-restaurant');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/driver-at-restaurant',
headers: {'content-type': 'application/json'},
data: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/driver-at-restaurant';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DriverContactNumber":"","DriverName":"","EstimatedDeliveryTime":"","EstimatedPickupTime":"","Event":"","OrderId":"","TimeStamp":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/driver-at-restaurant',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "DriverContactNumber": "",\n "DriverName": "",\n "EstimatedDeliveryTime": "",\n "EstimatedPickupTime": "",\n "Event": "",\n "OrderId": "",\n "TimeStamp": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/driver-at-restaurant")
.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/driver-at-restaurant',
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({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/driver-at-restaurant',
headers: {'content-type': 'application/json'},
body: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
},
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}}/driver-at-restaurant');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
});
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}}/driver-at-restaurant',
headers: {'content-type': 'application/json'},
data: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/driver-at-restaurant';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DriverContactNumber":"","DriverName":"","EstimatedDeliveryTime":"","EstimatedPickupTime":"","Event":"","OrderId":"","TimeStamp":""}'
};
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 = @{ @"DriverContactNumber": @"",
@"DriverName": @"",
@"EstimatedDeliveryTime": @"",
@"EstimatedPickupTime": @"",
@"Event": @"",
@"OrderId": @"",
@"TimeStamp": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/driver-at-restaurant"]
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}}/driver-at-restaurant" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/driver-at-restaurant",
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([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]),
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}}/driver-at-restaurant', [
'body' => '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/driver-at-restaurant');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]));
$request->setRequestUrl('{{baseUrl}}/driver-at-restaurant');
$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}}/driver-at-restaurant' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/driver-at-restaurant' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/driver-at-restaurant", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/driver-at-restaurant"
payload = {
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/driver-at-restaurant"
payload <- "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-at-restaurant")
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 \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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/driver-at-restaurant') do |req|
req.body = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-at-restaurant";
let payload = json!({
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
});
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}}/driver-at-restaurant \
--header 'content-type: application/json' \
--data '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
echo '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}' | \
http PUT {{baseUrl}}/driver-at-restaurant \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "DriverContactNumber": "",\n "DriverName": "",\n "EstimatedDeliveryTime": "",\n "EstimatedPickupTime": "",\n "Event": "",\n "OrderId": "",\n "TimeStamp": ""\n}' \
--output-document \
- {{baseUrl}}/driver-at-restaurant
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/driver-at-restaurant")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Driver has delivered order
{{baseUrl}}/driver-has-delivered-order
BODY json
{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/driver-has-delivered-order");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/driver-has-delivered-order" {:content-type :json
:form-params {:DriverContactNumber ""
:DriverName ""
:EstimatedDeliveryTime ""
:EstimatedPickupTime ""
:Event ""
:OrderId ""
:TimeStamp ""}})
require "http/client"
url = "{{baseUrl}}/driver-has-delivered-order"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-has-delivered-order"),
Content = new StringContent("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-has-delivered-order");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/driver-has-delivered-order"
payload := strings.NewReader("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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/driver-has-delivered-order HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 162
{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/driver-has-delivered-order")
.setHeader("content-type", "application/json")
.setBody("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/driver-has-delivered-order"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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 \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/driver-has-delivered-order")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/driver-has-delivered-order")
.header("content-type", "application/json")
.body("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
.asString();
const data = JSON.stringify({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/driver-has-delivered-order');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/driver-has-delivered-order',
headers: {'content-type': 'application/json'},
data: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/driver-has-delivered-order';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DriverContactNumber":"","DriverName":"","EstimatedDeliveryTime":"","EstimatedPickupTime":"","Event":"","OrderId":"","TimeStamp":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/driver-has-delivered-order',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "DriverContactNumber": "",\n "DriverName": "",\n "EstimatedDeliveryTime": "",\n "EstimatedPickupTime": "",\n "Event": "",\n "OrderId": "",\n "TimeStamp": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/driver-has-delivered-order")
.put(body)
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/driver-has-delivered-order',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/driver-has-delivered-order',
headers: {'content-type': 'application/json'},
body: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
},
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}}/driver-has-delivered-order');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
});
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}}/driver-has-delivered-order',
headers: {'content-type': 'application/json'},
data: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/driver-has-delivered-order';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DriverContactNumber":"","DriverName":"","EstimatedDeliveryTime":"","EstimatedPickupTime":"","Event":"","OrderId":"","TimeStamp":""}'
};
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 = @{ @"DriverContactNumber": @"",
@"DriverName": @"",
@"EstimatedDeliveryTime": @"",
@"EstimatedPickupTime": @"",
@"Event": @"",
@"OrderId": @"",
@"TimeStamp": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/driver-has-delivered-order"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/driver-has-delivered-order" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/driver-has-delivered-order",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]),
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}}/driver-has-delivered-order', [
'body' => '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/driver-has-delivered-order');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]));
$request->setRequestUrl('{{baseUrl}}/driver-has-delivered-order');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/driver-has-delivered-order' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/driver-has-delivered-order' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/driver-has-delivered-order", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/driver-has-delivered-order"
payload = {
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/driver-has-delivered-order"
payload <- "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-has-delivered-order")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request.body = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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/driver-has-delivered-order') do |req|
req.body = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-has-delivered-order";
let payload = json!({
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
});
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}}/driver-has-delivered-order \
--header 'content-type: application/json' \
--data '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
echo '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}' | \
http PUT {{baseUrl}}/driver-has-delivered-order \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "DriverContactNumber": "",\n "DriverName": "",\n "EstimatedDeliveryTime": "",\n "EstimatedPickupTime": "",\n "Event": "",\n "OrderId": "",\n "TimeStamp": ""\n}' \
--output-document \
- {{baseUrl}}/driver-has-delivered-order
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/driver-has-delivered-order")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Driver on their way to delivery address
{{baseUrl}}/driver-on-their-way-to-delivery-address
BODY json
{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/driver-on-their-way-to-delivery-address");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/driver-on-their-way-to-delivery-address" {:content-type :json
:form-params {:DriverContactNumber ""
:DriverName ""
:EstimatedDeliveryTime ""
:EstimatedPickupTime ""
:Event ""
:OrderId ""
:TimeStamp ""}})
require "http/client"
url = "{{baseUrl}}/driver-on-their-way-to-delivery-address"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-on-their-way-to-delivery-address"),
Content = new StringContent("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-on-their-way-to-delivery-address");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/driver-on-their-way-to-delivery-address"
payload := strings.NewReader("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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/driver-on-their-way-to-delivery-address HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 162
{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/driver-on-their-way-to-delivery-address")
.setHeader("content-type", "application/json")
.setBody("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/driver-on-their-way-to-delivery-address"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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 \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/driver-on-their-way-to-delivery-address")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/driver-on-their-way-to-delivery-address")
.header("content-type", "application/json")
.body("{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
.asString();
const data = JSON.stringify({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/driver-on-their-way-to-delivery-address');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/driver-on-their-way-to-delivery-address',
headers: {'content-type': 'application/json'},
data: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/driver-on-their-way-to-delivery-address';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DriverContactNumber":"","DriverName":"","EstimatedDeliveryTime":"","EstimatedPickupTime":"","Event":"","OrderId":"","TimeStamp":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/driver-on-their-way-to-delivery-address',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "DriverContactNumber": "",\n "DriverName": "",\n "EstimatedDeliveryTime": "",\n "EstimatedPickupTime": "",\n "Event": "",\n "OrderId": "",\n "TimeStamp": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/driver-on-their-way-to-delivery-address")
.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/driver-on-their-way-to-delivery-address',
headers: {
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/driver-on-their-way-to-delivery-address',
headers: {'content-type': 'application/json'},
body: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
},
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}}/driver-on-their-way-to-delivery-address');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
});
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}}/driver-on-their-way-to-delivery-address',
headers: {'content-type': 'application/json'},
data: {
DriverContactNumber: '',
DriverName: '',
EstimatedDeliveryTime: '',
EstimatedPickupTime: '',
Event: '',
OrderId: '',
TimeStamp: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/driver-on-their-way-to-delivery-address';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"DriverContactNumber":"","DriverName":"","EstimatedDeliveryTime":"","EstimatedPickupTime":"","Event":"","OrderId":"","TimeStamp":""}'
};
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 = @{ @"DriverContactNumber": @"",
@"DriverName": @"",
@"EstimatedDeliveryTime": @"",
@"EstimatedPickupTime": @"",
@"Event": @"",
@"OrderId": @"",
@"TimeStamp": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/driver-on-their-way-to-delivery-address"]
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}}/driver-on-their-way-to-delivery-address" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/driver-on-their-way-to-delivery-address",
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([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]),
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}}/driver-on-their-way-to-delivery-address', [
'body' => '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/driver-on-their-way-to-delivery-address');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'DriverContactNumber' => '',
'DriverName' => '',
'EstimatedDeliveryTime' => '',
'EstimatedPickupTime' => '',
'Event' => '',
'OrderId' => '',
'TimeStamp' => ''
]));
$request->setRequestUrl('{{baseUrl}}/driver-on-their-way-to-delivery-address');
$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}}/driver-on-their-way-to-delivery-address' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/driver-on-their-way-to-delivery-address' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/driver-on-their-way-to-delivery-address", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/driver-on-their-way-to-delivery-address"
payload = {
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/driver-on-their-way-to-delivery-address"
payload <- "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-on-their-way-to-delivery-address")
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 \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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/driver-on-their-way-to-delivery-address') do |req|
req.body = "{\n \"DriverContactNumber\": \"\",\n \"DriverName\": \"\",\n \"EstimatedDeliveryTime\": \"\",\n \"EstimatedPickupTime\": \"\",\n \"Event\": \"\",\n \"OrderId\": \"\",\n \"TimeStamp\": \"\"\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}}/driver-on-their-way-to-delivery-address";
let payload = json!({
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
});
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}}/driver-on-their-way-to-delivery-address \
--header 'content-type: application/json' \
--data '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}'
echo '{
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
}' | \
http PUT {{baseUrl}}/driver-on-their-way-to-delivery-address \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "DriverContactNumber": "",\n "DriverName": "",\n "EstimatedDeliveryTime": "",\n "EstimatedPickupTime": "",\n "Event": "",\n "OrderId": "",\n "TimeStamp": ""\n}' \
--output-document \
- {{baseUrl}}/driver-on-their-way-to-delivery-address
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"DriverContactNumber": "",
"DriverName": "",
"EstimatedDeliveryTime": "",
"EstimatedPickupTime": "",
"Event": "",
"OrderId": "",
"TimeStamp": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/driver-on-their-way-to-delivery-address")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Order ready for pickup
{{baseUrl}}/order-is-ready-for-pickup
BODY json
{
"Event": "",
"Timestamp": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/order-is-ready-for-pickup");
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 \"Event\": \"\",\n \"Timestamp\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/order-is-ready-for-pickup" {:content-type :json
:form-params {:Event ""
:Timestamp ""}})
require "http/client"
url = "{{baseUrl}}/order-is-ready-for-pickup"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Event\": \"\",\n \"Timestamp\": \"\"\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}}/order-is-ready-for-pickup"),
Content = new StringContent("{\n \"Event\": \"\",\n \"Timestamp\": \"\"\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}}/order-is-ready-for-pickup");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Event\": \"\",\n \"Timestamp\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/order-is-ready-for-pickup"
payload := strings.NewReader("{\n \"Event\": \"\",\n \"Timestamp\": \"\"\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/order-is-ready-for-pickup HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 36
{
"Event": "",
"Timestamp": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/order-is-ready-for-pickup")
.setHeader("content-type", "application/json")
.setBody("{\n \"Event\": \"\",\n \"Timestamp\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/order-is-ready-for-pickup"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"Event\": \"\",\n \"Timestamp\": \"\"\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 \"Event\": \"\",\n \"Timestamp\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/order-is-ready-for-pickup")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/order-is-ready-for-pickup")
.header("content-type", "application/json")
.body("{\n \"Event\": \"\",\n \"Timestamp\": \"\"\n}")
.asString();
const data = JSON.stringify({
Event: '',
Timestamp: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/order-is-ready-for-pickup');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/order-is-ready-for-pickup',
headers: {'content-type': 'application/json'},
data: {Event: '', Timestamp: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/order-is-ready-for-pickup';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Event":"","Timestamp":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/order-is-ready-for-pickup',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Event": "",\n "Timestamp": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Event\": \"\",\n \"Timestamp\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/order-is-ready-for-pickup")
.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/order-is-ready-for-pickup',
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({Event: '', Timestamp: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/order-is-ready-for-pickup',
headers: {'content-type': 'application/json'},
body: {Event: '', Timestamp: ''},
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}}/order-is-ready-for-pickup');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Event: '',
Timestamp: ''
});
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}}/order-is-ready-for-pickup',
headers: {'content-type': 'application/json'},
data: {Event: '', Timestamp: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/order-is-ready-for-pickup';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"Event":"","Timestamp":""}'
};
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 = @{ @"Event": @"",
@"Timestamp": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/order-is-ready-for-pickup"]
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}}/order-is-ready-for-pickup" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Event\": \"\",\n \"Timestamp\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/order-is-ready-for-pickup",
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([
'Event' => '',
'Timestamp' => ''
]),
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}}/order-is-ready-for-pickup', [
'body' => '{
"Event": "",
"Timestamp": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/order-is-ready-for-pickup');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Event' => '',
'Timestamp' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Event' => '',
'Timestamp' => ''
]));
$request->setRequestUrl('{{baseUrl}}/order-is-ready-for-pickup');
$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}}/order-is-ready-for-pickup' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Event": "",
"Timestamp": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/order-is-ready-for-pickup' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"Event": "",
"Timestamp": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Event\": \"\",\n \"Timestamp\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/order-is-ready-for-pickup", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/order-is-ready-for-pickup"
payload = {
"Event": "",
"Timestamp": ""
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/order-is-ready-for-pickup"
payload <- "{\n \"Event\": \"\",\n \"Timestamp\": \"\"\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}}/order-is-ready-for-pickup")
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 \"Event\": \"\",\n \"Timestamp\": \"\"\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/order-is-ready-for-pickup') do |req|
req.body = "{\n \"Event\": \"\",\n \"Timestamp\": \"\"\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}}/order-is-ready-for-pickup";
let payload = json!({
"Event": "",
"Timestamp": ""
});
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}}/order-is-ready-for-pickup \
--header 'content-type: application/json' \
--data '{
"Event": "",
"Timestamp": ""
}'
echo '{
"Event": "",
"Timestamp": ""
}' | \
http PUT {{baseUrl}}/order-is-ready-for-pickup \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "Event": "",\n "Timestamp": ""\n}' \
--output-document \
- {{baseUrl}}/order-is-ready-for-pickup
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"Event": "",
"Timestamp": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/order-is-ready-for-pickup")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Order requires delivery acceptance
{{baseUrl}}/order-requires-delivery-acceptance
BODY json
[
{
"BasketInfo": {
"BasketId": "",
"DeliveryCharge": "",
"Discount": "",
"Discounts": [
{
"Discount": "",
"DiscountType": "",
"Id": "",
"QualifyingValue": ""
}
],
"GroupedBasketItems": [
{
"BasketItem": {
"CombinedPrice": "",
"Discounts": [
{
"Amount": "",
"DiscountType": ""
}
],
"MealParts": [
{
"GroupId": "",
"MealPartId": "",
"Name": "",
"OptionalAccessories": [
{
"Name": "",
"OptionalAccessoryId": "",
"Quantity": "",
"UnitPrice": ""
}
],
"RequiredAccessories": [
{
"GroupId": "",
"Name": "",
"RequiredAccessoryId": "",
"UnitPrice": ""
}
],
"Synonym": ""
}
],
"MenuCardNumber": "",
"MultiBuyDiscounts": [
{
"Amount": "",
"DiscountType": "",
"OrderItemId": "",
"ProductTypeId": ""
}
],
"Name": "",
"OptionalAccessories": [
{
"Name": "",
"OptionalAccessoryId": "",
"Quantity": "",
"UnitPrice": ""
}
],
"ProductId": "",
"ProductTypeId": "",
"RequiredAccessories": [
{
"GroupId": "",
"Name": "",
"RequiredAccessoryId": "",
"UnitPrice": ""
}
],
"Synonym": "",
"UnitPrice": ""
},
"CombinedPrice": "",
"MenuCardNumber": "",
"OrderSubId": "",
"Quantity": ""
}
],
"MenuId": "",
"MultiBuyDiscount": "",
"SubTotal": "",
"ToSpend": "",
"Total": ""
},
"CustomerInfo": {
"Address": "",
"City": "",
"DisplayPhoneNumber": "",
"Email": "",
"Id": "",
"Latitude": "",
"LocationAccuracyDescription": "",
"LocationAccuracyInMeters": "",
"LocationSource": "",
"Longitude": "",
"Name": "",
"PhoneMaskingCode": "",
"PhoneNumber": "",
"Postcode": "",
"PreviousRestuarantOrderCount": "",
"TimeZone": ""
},
"CustomerOrderId": "",
"FriendlyOrderReference": "",
"Id": "",
"IsAMiniFistPumpOrder": false,
"Order": {
"DueDate": "",
"DueDateWithUtcOffset": "",
"InitialDueDate": "",
"InitialDueDateWithUtcOffset": "",
"NoteToRestaurant": "",
"PickupNoticePeriod": "",
"PlacedDate": "",
"PromptAsap": false,
"RdsPickupTimeWithUtcOffset": "",
"ServiceType": ""
},
"OrderId": "",
"OrderReference": "",
"PaymentInfo": {
"CashOnDelivery": false,
"DriverTipValue": "",
"PaidDate": "",
"PaymentLines": [
{
"CardFee": "",
"Type": "",
"Value": ""
}
],
"Total": "",
"TotalComplementary": ""
},
"RestaurantInfo": {
"AddressLines": [],
"City": "",
"DispatchMethod": "",
"EmailAddress": "",
"Id": "",
"Latitude": "",
"Longitude": "",
"Name": "",
"PhoneNumber": "",
"PickupNotes": "",
"Postcode": ""
},
"Restrictions": [
{
"Type": ""
}
]
}
]
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/order-requires-delivery-acceptance");
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 {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\n }\n]");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/order-requires-delivery-acceptance" {:content-type :json
:form-params [{:CustomerOrderId 348322088
:FriendlyOrderReference "348322088"
:Id "348322088"
:OrderId "ijdhpy7bdusgtc28bapspa"
:OrderReference "39cce3f0-0278-dd25-ae32-e8effe1ce4eb"}]})
require "http/client"
url = "{{baseUrl}}/order-requires-delivery-acceptance"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "[\n {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\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}}/order-requires-delivery-acceptance"),
Content = new StringContent("[\n {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\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}}/order-requires-delivery-acceptance");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "[\n {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\n }\n]", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/order-requires-delivery-acceptance"
payload := strings.NewReader("[\n {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\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/order-requires-delivery-acceptance HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 213
[
{
"CustomerOrderId": 348322088,
"FriendlyOrderReference": "348322088",
"Id": "348322088",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"OrderReference": "39cce3f0-0278-dd25-ae32-e8effe1ce4eb"
}
]
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/order-requires-delivery-acceptance")
.setHeader("content-type", "application/json")
.setBody("[\n {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\n }\n]")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/order-requires-delivery-acceptance"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("[\n {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\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 {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\n }\n]");
Request request = new Request.Builder()
.url("{{baseUrl}}/order-requires-delivery-acceptance")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/order-requires-delivery-acceptance")
.header("content-type", "application/json")
.body("[\n {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\n }\n]")
.asString();
const data = JSON.stringify([
{
CustomerOrderId: 348322088,
FriendlyOrderReference: '348322088',
Id: '348322088',
OrderId: 'ijdhpy7bdusgtc28bapspa',
OrderReference: '39cce3f0-0278-dd25-ae32-e8effe1ce4eb'
}
]);
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/order-requires-delivery-acceptance');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/order-requires-delivery-acceptance',
headers: {'content-type': 'application/json'},
data: [
{
CustomerOrderId: 348322088,
FriendlyOrderReference: '348322088',
Id: '348322088',
OrderId: 'ijdhpy7bdusgtc28bapspa',
OrderReference: '39cce3f0-0278-dd25-ae32-e8effe1ce4eb'
}
]
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/order-requires-delivery-acceptance';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '[{"CustomerOrderId":348322088,"FriendlyOrderReference":"348322088","Id":"348322088","OrderId":"ijdhpy7bdusgtc28bapspa","OrderReference":"39cce3f0-0278-dd25-ae32-e8effe1ce4eb"}]'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/order-requires-delivery-acceptance',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '[\n {\n "CustomerOrderId": 348322088,\n "FriendlyOrderReference": "348322088",\n "Id": "348322088",\n "OrderId": "ijdhpy7bdusgtc28bapspa",\n "OrderReference": "39cce3f0-0278-dd25-ae32-e8effe1ce4eb"\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 {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\n }\n]")
val request = Request.Builder()
.url("{{baseUrl}}/order-requires-delivery-acceptance")
.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/order-requires-delivery-acceptance',
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([
{
CustomerOrderId: 348322088,
FriendlyOrderReference: '348322088',
Id: '348322088',
OrderId: 'ijdhpy7bdusgtc28bapspa',
OrderReference: '39cce3f0-0278-dd25-ae32-e8effe1ce4eb'
}
]));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/order-requires-delivery-acceptance',
headers: {'content-type': 'application/json'},
body: [
{
CustomerOrderId: 348322088,
FriendlyOrderReference: '348322088',
Id: '348322088',
OrderId: 'ijdhpy7bdusgtc28bapspa',
OrderReference: '39cce3f0-0278-dd25-ae32-e8effe1ce4eb'
}
],
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}}/order-requires-delivery-acceptance');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send([
{
CustomerOrderId: 348322088,
FriendlyOrderReference: '348322088',
Id: '348322088',
OrderId: 'ijdhpy7bdusgtc28bapspa',
OrderReference: '39cce3f0-0278-dd25-ae32-e8effe1ce4eb'
}
]);
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}}/order-requires-delivery-acceptance',
headers: {'content-type': 'application/json'},
data: [
{
CustomerOrderId: 348322088,
FriendlyOrderReference: '348322088',
Id: '348322088',
OrderId: 'ijdhpy7bdusgtc28bapspa',
OrderReference: '39cce3f0-0278-dd25-ae32-e8effe1ce4eb'
}
]
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/order-requires-delivery-acceptance';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '[{"CustomerOrderId":348322088,"FriendlyOrderReference":"348322088","Id":"348322088","OrderId":"ijdhpy7bdusgtc28bapspa","OrderReference":"39cce3f0-0278-dd25-ae32-e8effe1ce4eb"}]'
};
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 = @[ @{ @"CustomerOrderId": @348322088, @"FriendlyOrderReference": @"348322088", @"Id": @"348322088", @"OrderId": @"ijdhpy7bdusgtc28bapspa", @"OrderReference": @"39cce3f0-0278-dd25-ae32-e8effe1ce4eb" } ];
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/order-requires-delivery-acceptance"]
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}}/order-requires-delivery-acceptance" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "[\n {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\n }\n]" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/order-requires-delivery-acceptance",
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([
[
'CustomerOrderId' => 348322088,
'FriendlyOrderReference' => '348322088',
'Id' => '348322088',
'OrderId' => 'ijdhpy7bdusgtc28bapspa',
'OrderReference' => '39cce3f0-0278-dd25-ae32-e8effe1ce4eb'
]
]),
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}}/order-requires-delivery-acceptance', [
'body' => '[
{
"CustomerOrderId": 348322088,
"FriendlyOrderReference": "348322088",
"Id": "348322088",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"OrderReference": "39cce3f0-0278-dd25-ae32-e8effe1ce4eb"
}
]',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/order-requires-delivery-acceptance');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
[
'CustomerOrderId' => 348322088,
'FriendlyOrderReference' => '348322088',
'Id' => '348322088',
'OrderId' => 'ijdhpy7bdusgtc28bapspa',
'OrderReference' => '39cce3f0-0278-dd25-ae32-e8effe1ce4eb'
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
[
'CustomerOrderId' => 348322088,
'FriendlyOrderReference' => '348322088',
'Id' => '348322088',
'OrderId' => 'ijdhpy7bdusgtc28bapspa',
'OrderReference' => '39cce3f0-0278-dd25-ae32-e8effe1ce4eb'
]
]));
$request->setRequestUrl('{{baseUrl}}/order-requires-delivery-acceptance');
$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}}/order-requires-delivery-acceptance' -Method PUT -Headers $headers -ContentType 'application/json' -Body '[
{
"CustomerOrderId": 348322088,
"FriendlyOrderReference": "348322088",
"Id": "348322088",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"OrderReference": "39cce3f0-0278-dd25-ae32-e8effe1ce4eb"
}
]'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/order-requires-delivery-acceptance' -Method PUT -Headers $headers -ContentType 'application/json' -Body '[
{
"CustomerOrderId": 348322088,
"FriendlyOrderReference": "348322088",
"Id": "348322088",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"OrderReference": "39cce3f0-0278-dd25-ae32-e8effe1ce4eb"
}
]'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "[\n {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\n }\n]"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/order-requires-delivery-acceptance", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/order-requires-delivery-acceptance"
payload = [
{
"CustomerOrderId": 348322088,
"FriendlyOrderReference": "348322088",
"Id": "348322088",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"OrderReference": "39cce3f0-0278-dd25-ae32-e8effe1ce4eb"
}
]
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/order-requires-delivery-acceptance"
payload <- "[\n {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\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}}/order-requires-delivery-acceptance")
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 {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\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/order-requires-delivery-acceptance') do |req|
req.body = "[\n {\n \"CustomerOrderId\": 348322088,\n \"FriendlyOrderReference\": \"348322088\",\n \"Id\": \"348322088\",\n \"OrderId\": \"ijdhpy7bdusgtc28bapspa\",\n \"OrderReference\": \"39cce3f0-0278-dd25-ae32-e8effe1ce4eb\"\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}}/order-requires-delivery-acceptance";
let payload = (
json!({
"CustomerOrderId": 348322088,
"FriendlyOrderReference": "348322088",
"Id": "348322088",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"OrderReference": "39cce3f0-0278-dd25-ae32-e8effe1ce4eb"
})
);
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}}/order-requires-delivery-acceptance \
--header 'content-type: application/json' \
--data '[
{
"CustomerOrderId": 348322088,
"FriendlyOrderReference": "348322088",
"Id": "348322088",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"OrderReference": "39cce3f0-0278-dd25-ae32-e8effe1ce4eb"
}
]'
echo '[
{
"CustomerOrderId": 348322088,
"FriendlyOrderReference": "348322088",
"Id": "348322088",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"OrderReference": "39cce3f0-0278-dd25-ae32-e8effe1ce4eb"
}
]' | \
http PUT {{baseUrl}}/order-requires-delivery-acceptance \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '[\n {\n "CustomerOrderId": 348322088,\n "FriendlyOrderReference": "348322088",\n "Id": "348322088",\n "OrderId": "ijdhpy7bdusgtc28bapspa",\n "OrderReference": "39cce3f0-0278-dd25-ae32-e8effe1ce4eb"\n }\n]' \
--output-document \
- {{baseUrl}}/order-requires-delivery-acceptance
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
[
"CustomerOrderId": 348322088,
"FriendlyOrderReference": "348322088",
"Id": "348322088",
"OrderId": "ijdhpy7bdusgtc28bapspa",
"OrderReference": "39cce3f0-0278-dd25-ae32-e8effe1ce4eb"
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/order-requires-delivery-acceptance")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Order ready for preparation (async)
{{baseUrl}}/order-ready-for-preparation-async
BODY json
{
"Currency": "",
"Customer": {
"Id": "",
"Name": ""
},
"CustomerNotes": {},
"Fulfilment": {
"Address": {
"City": "",
"Geolocation": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"Lines": [],
"PostalCode": ""
},
"CustomerDueAsap": false,
"CustomerDueDate": "",
"Method": "",
"PhoneNumber": "",
"PreparationTime": "",
"PrepareFor": ""
},
"IsTest": false,
"Items": [
{
"Items": [],
"Name": "",
"Quantity": 0,
"Reference": "",
"UnitPrice": 0
}
],
"OrderId": "",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "",
"Value": ""
}
]
},
"PlacedDate": "",
"PriceBreakdown": {
"Discount": "",
"Fees": {
"Delivery": "",
"Other": "",
"ServiceCharge": ""
},
"Items": "",
"Taxes": "",
"Tips": ""
},
"Restaurant": {
"Address": {
"City": "",
"Geolocation": {},
"Lines": [],
"PostalCode": ""
},
"Id": "",
"Name": "",
"PhoneNumber": "",
"Reference": ""
},
"TotalPrice": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/order-ready-for-preparation-async");
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 \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/order-ready-for-preparation-async" {:content-type :json
:form-params {:Currency "GBP"
:Customer {:Id "Batman"
:Name "Bruce Wayne"}
:CustomerNotes [{:Key "Floor"
:Value "5th floor"} {:Key "Code"
:Value "Code 1234"}]
:Fulfilment {:Address {:City "London"
:Geolocation {:Latitude 51.51641
:Longitude -0.103198}
:Lines ["Fleet Place House" "Fleet Pl"]
:PostalCode "EC4M 7RD"}
:CustomerDueAsap false
:CustomerDueDate "2018-03-10T14:45:28Z"
:Method "Delivery"
:PhoneNumber "+441234567890"}
:IsTest true
:Items [{:Items [{:Items []
:Name "Fries"
:Quantity 1
:Reference "9876"
:Synonym "Regular"
:UnitPrice 0} {:Items []
:Name "Pepsi"
:Quantity 2
:Reference "6789"
:Synonym "330ml"
:UnitPrice 0}]
:Name "Chicken Box Meal"
:Quantity 2
:Reference "1234"
:Synonym ""
:TotalPrice 10
:UnitPrice 5} {:Items []
:Name "Milkshake"
:Quantity 1
:Reference "4321"
:Synonym ""
:TotalPrice 7.25
:UnitPrice 7.25}]
:OrderId "XYZ123456"
:Payment {:Lines [{:Paid false
:Type "card"
:Value 19.25}]}
:PlacedDate "2018-03-10T14:45:28Z"
:PriceBreakdown {:Discount 0
:Fees {:Delivery 1
:Other 0
:ServiceCharge 0.5}
:Items 17.25
:Taxes 3.85
:Tips 0.5}
:Restaurant {:Address {:City "London"
:Geolocation {:Latitude 51.4484
:Longitude -0.1504}
:Lines ["Oldridge Road"]
:PostalCode "SW12 8PW"}
:Id "99999"
:Name "Just Eat Test Restaurant"
:PhoneNumber "+441200000000"
:Refererence "R99999"}
:TotalPrice 19.25}})
require "http/client"
url = "{{baseUrl}}/order-ready-for-preparation-async"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\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}}/order-ready-for-preparation-async"),
Content = new StringContent("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\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}}/order-ready-for-preparation-async");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/order-ready-for-preparation-async"
payload := strings.NewReader("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\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/order-ready-for-preparation-async HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2179
{
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "card",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/order-ready-for-preparation-async")
.setHeader("content-type", "application/json")
.setBody("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/order-ready-for-preparation-async"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\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 \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/order-ready-for-preparation-async")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/order-ready-for-preparation-async")
.header("content-type", "application/json")
.body("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}")
.asString();
const data = JSON.stringify({
Currency: 'GBP',
Customer: {
Id: 'Batman',
Name: 'Bruce Wayne'
},
CustomerNotes: [
{
Key: 'Floor',
Value: '5th floor'
},
{
Key: 'Code',
Value: 'Code 1234'
}
],
Fulfilment: {
Address: {
City: 'London',
Geolocation: {
Latitude: 51.51641,
Longitude: -0.103198
},
Lines: [
'Fleet Place House',
'Fleet Pl'
],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneNumber: '+441234567890'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'XYZ123456',
Payment: {
Lines: [
{
Paid: false,
Type: 'card',
Value: 19.25
}
]
},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {
Delivery: 1,
Other: 0,
ServiceCharge: 0.5
},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {
Latitude: 51.4484,
Longitude: -0.1504
},
Lines: [
'Oldridge Road'
],
PostalCode: 'SW12 8PW'
},
Id: '99999',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999'
},
TotalPrice: 19.25
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/order-ready-for-preparation-async');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/order-ready-for-preparation-async',
headers: {'content-type': 'application/json'},
data: {
Currency: 'GBP',
Customer: {Id: 'Batman', Name: 'Bruce Wayne'},
CustomerNotes: [{Key: 'Floor', Value: '5th floor'}, {Key: 'Code', Value: 'Code 1234'}],
Fulfilment: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.51641, Longitude: -0.103198},
Lines: ['Fleet Place House', 'Fleet Pl'],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneNumber: '+441234567890'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'XYZ123456',
Payment: {Lines: [{Paid: false, Type: 'card', Value: 19.25}]},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {Delivery: 1, Other: 0, ServiceCharge: 0.5},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.4484, Longitude: -0.1504},
Lines: ['Oldridge Road'],
PostalCode: 'SW12 8PW'
},
Id: '99999',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999'
},
TotalPrice: 19.25
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/order-ready-for-preparation-async';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"Currency":"GBP","Customer":{"Id":"Batman","Name":"Bruce Wayne"},"CustomerNotes":[{"Key":"Floor","Value":"5th floor"},{"Key":"Code","Value":"Code 1234"}],"Fulfilment":{"Address":{"City":"London","Geolocation":{"Latitude":51.51641,"Longitude":-0.103198},"Lines":["Fleet Place House","Fleet Pl"],"PostalCode":"EC4M 7RD"},"CustomerDueAsap":false,"CustomerDueDate":"2018-03-10T14:45:28Z","Method":"Delivery","PhoneNumber":"+441234567890"},"IsTest":true,"Items":[{"Items":[{"Items":[],"Name":"Fries","Quantity":1,"Reference":"9876","Synonym":"Regular","UnitPrice":0},{"Items":[],"Name":"Pepsi","Quantity":2,"Reference":"6789","Synonym":"330ml","UnitPrice":0}],"Name":"Chicken Box Meal","Quantity":2,"Reference":"1234","Synonym":"","TotalPrice":10,"UnitPrice":5},{"Items":[],"Name":"Milkshake","Quantity":1,"Reference":"4321","Synonym":"","TotalPrice":7.25,"UnitPrice":7.25}],"OrderId":"XYZ123456","Payment":{"Lines":[{"Paid":false,"Type":"card","Value":19.25}]},"PlacedDate":"2018-03-10T14:45:28Z","PriceBreakdown":{"Discount":0,"Fees":{"Delivery":1,"Other":0,"ServiceCharge":0.5},"Items":17.25,"Taxes":3.85,"Tips":0.5},"Restaurant":{"Address":{"City":"London","Geolocation":{"Latitude":51.4484,"Longitude":-0.1504},"Lines":["Oldridge Road"],"PostalCode":"SW12 8PW"},"Id":"99999","Name":"Just Eat Test Restaurant","PhoneNumber":"+441200000000","Refererence":"R99999"},"TotalPrice":19.25}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/order-ready-for-preparation-async',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Currency": "GBP",\n "Customer": {\n "Id": "Batman",\n "Name": "Bruce Wayne"\n },\n "CustomerNotes": [\n {\n "Key": "Floor",\n "Value": "5th floor"\n },\n {\n "Key": "Code",\n "Value": "Code 1234"\n }\n ],\n "Fulfilment": {\n "Address": {\n "City": "London",\n "Geolocation": {\n "Latitude": 51.51641,\n "Longitude": -0.103198\n },\n "Lines": [\n "Fleet Place House",\n "Fleet Pl"\n ],\n "PostalCode": "EC4M 7RD"\n },\n "CustomerDueAsap": false,\n "CustomerDueDate": "2018-03-10T14:45:28Z",\n "Method": "Delivery",\n "PhoneNumber": "+441234567890"\n },\n "IsTest": true,\n "Items": [\n {\n "Items": [\n {\n "Items": [],\n "Name": "Fries",\n "Quantity": 1,\n "Reference": "9876",\n "Synonym": "Regular",\n "UnitPrice": 0\n },\n {\n "Items": [],\n "Name": "Pepsi",\n "Quantity": 2,\n "Reference": "6789",\n "Synonym": "330ml",\n "UnitPrice": 0\n }\n ],\n "Name": "Chicken Box Meal",\n "Quantity": 2,\n "Reference": "1234",\n "Synonym": "",\n "TotalPrice": 10,\n "UnitPrice": 5\n },\n {\n "Items": [],\n "Name": "Milkshake",\n "Quantity": 1,\n "Reference": "4321",\n "Synonym": "",\n "TotalPrice": 7.25,\n "UnitPrice": 7.25\n }\n ],\n "OrderId": "XYZ123456",\n "Payment": {\n "Lines": [\n {\n "Paid": false,\n "Type": "card",\n "Value": 19.25\n }\n ]\n },\n "PlacedDate": "2018-03-10T14:45:28Z",\n "PriceBreakdown": {\n "Discount": 0,\n "Fees": {\n "Delivery": 1,\n "Other": 0,\n "ServiceCharge": 0.5\n },\n "Items": 17.25,\n "Taxes": 3.85,\n "Tips": 0.5\n },\n "Restaurant": {\n "Address": {\n "City": "London",\n "Geolocation": {\n "Latitude": 51.4484,\n "Longitude": -0.1504\n },\n "Lines": [\n "Oldridge Road"\n ],\n "PostalCode": "SW12 8PW"\n },\n "Id": "99999",\n "Name": "Just Eat Test Restaurant",\n "PhoneNumber": "+441200000000",\n "Refererence": "R99999"\n },\n "TotalPrice": 19.25\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}")
val request = Request.Builder()
.url("{{baseUrl}}/order-ready-for-preparation-async")
.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/order-ready-for-preparation-async',
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({
Currency: 'GBP',
Customer: {Id: 'Batman', Name: 'Bruce Wayne'},
CustomerNotes: [{Key: 'Floor', Value: '5th floor'}, {Key: 'Code', Value: 'Code 1234'}],
Fulfilment: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.51641, Longitude: -0.103198},
Lines: ['Fleet Place House', 'Fleet Pl'],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneNumber: '+441234567890'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'XYZ123456',
Payment: {Lines: [{Paid: false, Type: 'card', Value: 19.25}]},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {Delivery: 1, Other: 0, ServiceCharge: 0.5},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.4484, Longitude: -0.1504},
Lines: ['Oldridge Road'],
PostalCode: 'SW12 8PW'
},
Id: '99999',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999'
},
TotalPrice: 19.25
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/order-ready-for-preparation-async',
headers: {'content-type': 'application/json'},
body: {
Currency: 'GBP',
Customer: {Id: 'Batman', Name: 'Bruce Wayne'},
CustomerNotes: [{Key: 'Floor', Value: '5th floor'}, {Key: 'Code', Value: 'Code 1234'}],
Fulfilment: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.51641, Longitude: -0.103198},
Lines: ['Fleet Place House', 'Fleet Pl'],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneNumber: '+441234567890'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'XYZ123456',
Payment: {Lines: [{Paid: false, Type: 'card', Value: 19.25}]},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {Delivery: 1, Other: 0, ServiceCharge: 0.5},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.4484, Longitude: -0.1504},
Lines: ['Oldridge Road'],
PostalCode: 'SW12 8PW'
},
Id: '99999',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999'
},
TotalPrice: 19.25
},
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}}/order-ready-for-preparation-async');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Currency: 'GBP',
Customer: {
Id: 'Batman',
Name: 'Bruce Wayne'
},
CustomerNotes: [
{
Key: 'Floor',
Value: '5th floor'
},
{
Key: 'Code',
Value: 'Code 1234'
}
],
Fulfilment: {
Address: {
City: 'London',
Geolocation: {
Latitude: 51.51641,
Longitude: -0.103198
},
Lines: [
'Fleet Place House',
'Fleet Pl'
],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneNumber: '+441234567890'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'XYZ123456',
Payment: {
Lines: [
{
Paid: false,
Type: 'card',
Value: 19.25
}
]
},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {
Delivery: 1,
Other: 0,
ServiceCharge: 0.5
},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {
Latitude: 51.4484,
Longitude: -0.1504
},
Lines: [
'Oldridge Road'
],
PostalCode: 'SW12 8PW'
},
Id: '99999',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999'
},
TotalPrice: 19.25
});
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}}/order-ready-for-preparation-async',
headers: {'content-type': 'application/json'},
data: {
Currency: 'GBP',
Customer: {Id: 'Batman', Name: 'Bruce Wayne'},
CustomerNotes: [{Key: 'Floor', Value: '5th floor'}, {Key: 'Code', Value: 'Code 1234'}],
Fulfilment: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.51641, Longitude: -0.103198},
Lines: ['Fleet Place House', 'Fleet Pl'],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneNumber: '+441234567890'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'XYZ123456',
Payment: {Lines: [{Paid: false, Type: 'card', Value: 19.25}]},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {Delivery: 1, Other: 0, ServiceCharge: 0.5},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.4484, Longitude: -0.1504},
Lines: ['Oldridge Road'],
PostalCode: 'SW12 8PW'
},
Id: '99999',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999'
},
TotalPrice: 19.25
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/order-ready-for-preparation-async';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"Currency":"GBP","Customer":{"Id":"Batman","Name":"Bruce Wayne"},"CustomerNotes":[{"Key":"Floor","Value":"5th floor"},{"Key":"Code","Value":"Code 1234"}],"Fulfilment":{"Address":{"City":"London","Geolocation":{"Latitude":51.51641,"Longitude":-0.103198},"Lines":["Fleet Place House","Fleet Pl"],"PostalCode":"EC4M 7RD"},"CustomerDueAsap":false,"CustomerDueDate":"2018-03-10T14:45:28Z","Method":"Delivery","PhoneNumber":"+441234567890"},"IsTest":true,"Items":[{"Items":[{"Items":[],"Name":"Fries","Quantity":1,"Reference":"9876","Synonym":"Regular","UnitPrice":0},{"Items":[],"Name":"Pepsi","Quantity":2,"Reference":"6789","Synonym":"330ml","UnitPrice":0}],"Name":"Chicken Box Meal","Quantity":2,"Reference":"1234","Synonym":"","TotalPrice":10,"UnitPrice":5},{"Items":[],"Name":"Milkshake","Quantity":1,"Reference":"4321","Synonym":"","TotalPrice":7.25,"UnitPrice":7.25}],"OrderId":"XYZ123456","Payment":{"Lines":[{"Paid":false,"Type":"card","Value":19.25}]},"PlacedDate":"2018-03-10T14:45:28Z","PriceBreakdown":{"Discount":0,"Fees":{"Delivery":1,"Other":0,"ServiceCharge":0.5},"Items":17.25,"Taxes":3.85,"Tips":0.5},"Restaurant":{"Address":{"City":"London","Geolocation":{"Latitude":51.4484,"Longitude":-0.1504},"Lines":["Oldridge Road"],"PostalCode":"SW12 8PW"},"Id":"99999","Name":"Just Eat Test Restaurant","PhoneNumber":"+441200000000","Refererence":"R99999"},"TotalPrice":19.25}'
};
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 = @{ @"Currency": @"GBP",
@"Customer": @{ @"Id": @"Batman", @"Name": @"Bruce Wayne" },
@"CustomerNotes": @[ @{ @"Key": @"Floor", @"Value": @"5th floor" }, @{ @"Key": @"Code", @"Value": @"Code 1234" } ],
@"Fulfilment": @{ @"Address": @{ @"City": @"London", @"Geolocation": @{ @"Latitude": @51.51641, @"Longitude": @-0.103198 }, @"Lines": @[ @"Fleet Place House", @"Fleet Pl" ], @"PostalCode": @"EC4M 7RD" }, @"CustomerDueAsap": @NO, @"CustomerDueDate": @"2018-03-10T14:45:28Z", @"Method": @"Delivery", @"PhoneNumber": @"+441234567890" },
@"IsTest": @YES,
@"Items": @[ @{ @"Items": @[ @{ @"Items": @[ ], @"Name": @"Fries", @"Quantity": @1, @"Reference": @"9876", @"Synonym": @"Regular", @"UnitPrice": @0 }, @{ @"Items": @[ ], @"Name": @"Pepsi", @"Quantity": @2, @"Reference": @"6789", @"Synonym": @"330ml", @"UnitPrice": @0 } ], @"Name": @"Chicken Box Meal", @"Quantity": @2, @"Reference": @"1234", @"Synonym": @"", @"TotalPrice": @10, @"UnitPrice": @5 }, @{ @"Items": @[ ], @"Name": @"Milkshake", @"Quantity": @1, @"Reference": @"4321", @"Synonym": @"", @"TotalPrice": @7.25, @"UnitPrice": @7.25 } ],
@"OrderId": @"XYZ123456",
@"Payment": @{ @"Lines": @[ @{ @"Paid": @NO, @"Type": @"card", @"Value": @19.25 } ] },
@"PlacedDate": @"2018-03-10T14:45:28Z",
@"PriceBreakdown": @{ @"Discount": @0, @"Fees": @{ @"Delivery": @1, @"Other": @0, @"ServiceCharge": @0.5 }, @"Items": @17.25, @"Taxes": @3.85, @"Tips": @0.5 },
@"Restaurant": @{ @"Address": @{ @"City": @"London", @"Geolocation": @{ @"Latitude": @51.4484, @"Longitude": @-0.1504 }, @"Lines": @[ @"Oldridge Road" ], @"PostalCode": @"SW12 8PW" }, @"Id": @"99999", @"Name": @"Just Eat Test Restaurant", @"PhoneNumber": @"+441200000000", @"Refererence": @"R99999" },
@"TotalPrice": @19.25 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/order-ready-for-preparation-async"]
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}}/order-ready-for-preparation-async" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/order-ready-for-preparation-async",
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([
'Currency' => 'GBP',
'Customer' => [
'Id' => 'Batman',
'Name' => 'Bruce Wayne'
],
'CustomerNotes' => [
[
'Key' => 'Floor',
'Value' => '5th floor'
],
[
'Key' => 'Code',
'Value' => 'Code 1234'
]
],
'Fulfilment' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.51641,
'Longitude' => -0.103198
],
'Lines' => [
'Fleet Place House',
'Fleet Pl'
],
'PostalCode' => 'EC4M 7RD'
],
'CustomerDueAsap' => null,
'CustomerDueDate' => '2018-03-10T14:45:28Z',
'Method' => 'Delivery',
'PhoneNumber' => '+441234567890'
],
'IsTest' => null,
'Items' => [
[
'Items' => [
[
'Items' => [
],
'Name' => 'Fries',
'Quantity' => 1,
'Reference' => '9876',
'Synonym' => 'Regular',
'UnitPrice' => 0
],
[
'Items' => [
],
'Name' => 'Pepsi',
'Quantity' => 2,
'Reference' => '6789',
'Synonym' => '330ml',
'UnitPrice' => 0
]
],
'Name' => 'Chicken Box Meal',
'Quantity' => 2,
'Reference' => '1234',
'Synonym' => '',
'TotalPrice' => 10,
'UnitPrice' => 5
],
[
'Items' => [
],
'Name' => 'Milkshake',
'Quantity' => 1,
'Reference' => '4321',
'Synonym' => '',
'TotalPrice' => 7.25,
'UnitPrice' => 7.25
]
],
'OrderId' => 'XYZ123456',
'Payment' => [
'Lines' => [
[
'Paid' => null,
'Type' => 'card',
'Value' => 19.25
]
]
],
'PlacedDate' => '2018-03-10T14:45:28Z',
'PriceBreakdown' => [
'Discount' => 0,
'Fees' => [
'Delivery' => 1,
'Other' => 0,
'ServiceCharge' => 0.5
],
'Items' => 17.25,
'Taxes' => 3.85,
'Tips' => 0.5
],
'Restaurant' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.4484,
'Longitude' => -0.1504
],
'Lines' => [
'Oldridge Road'
],
'PostalCode' => 'SW12 8PW'
],
'Id' => '99999',
'Name' => 'Just Eat Test Restaurant',
'PhoneNumber' => '+441200000000',
'Refererence' => 'R99999'
],
'TotalPrice' => 19.25
]),
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}}/order-ready-for-preparation-async', [
'body' => '{
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "card",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/order-ready-for-preparation-async');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Currency' => 'GBP',
'Customer' => [
'Id' => 'Batman',
'Name' => 'Bruce Wayne'
],
'CustomerNotes' => [
[
'Key' => 'Floor',
'Value' => '5th floor'
],
[
'Key' => 'Code',
'Value' => 'Code 1234'
]
],
'Fulfilment' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.51641,
'Longitude' => -0.103198
],
'Lines' => [
'Fleet Place House',
'Fleet Pl'
],
'PostalCode' => 'EC4M 7RD'
],
'CustomerDueAsap' => null,
'CustomerDueDate' => '2018-03-10T14:45:28Z',
'Method' => 'Delivery',
'PhoneNumber' => '+441234567890'
],
'IsTest' => null,
'Items' => [
[
'Items' => [
[
'Items' => [
],
'Name' => 'Fries',
'Quantity' => 1,
'Reference' => '9876',
'Synonym' => 'Regular',
'UnitPrice' => 0
],
[
'Items' => [
],
'Name' => 'Pepsi',
'Quantity' => 2,
'Reference' => '6789',
'Synonym' => '330ml',
'UnitPrice' => 0
]
],
'Name' => 'Chicken Box Meal',
'Quantity' => 2,
'Reference' => '1234',
'Synonym' => '',
'TotalPrice' => 10,
'UnitPrice' => 5
],
[
'Items' => [
],
'Name' => 'Milkshake',
'Quantity' => 1,
'Reference' => '4321',
'Synonym' => '',
'TotalPrice' => 7.25,
'UnitPrice' => 7.25
]
],
'OrderId' => 'XYZ123456',
'Payment' => [
'Lines' => [
[
'Paid' => null,
'Type' => 'card',
'Value' => 19.25
]
]
],
'PlacedDate' => '2018-03-10T14:45:28Z',
'PriceBreakdown' => [
'Discount' => 0,
'Fees' => [
'Delivery' => 1,
'Other' => 0,
'ServiceCharge' => 0.5
],
'Items' => 17.25,
'Taxes' => 3.85,
'Tips' => 0.5
],
'Restaurant' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.4484,
'Longitude' => -0.1504
],
'Lines' => [
'Oldridge Road'
],
'PostalCode' => 'SW12 8PW'
],
'Id' => '99999',
'Name' => 'Just Eat Test Restaurant',
'PhoneNumber' => '+441200000000',
'Refererence' => 'R99999'
],
'TotalPrice' => 19.25
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Currency' => 'GBP',
'Customer' => [
'Id' => 'Batman',
'Name' => 'Bruce Wayne'
],
'CustomerNotes' => [
[
'Key' => 'Floor',
'Value' => '5th floor'
],
[
'Key' => 'Code',
'Value' => 'Code 1234'
]
],
'Fulfilment' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.51641,
'Longitude' => -0.103198
],
'Lines' => [
'Fleet Place House',
'Fleet Pl'
],
'PostalCode' => 'EC4M 7RD'
],
'CustomerDueAsap' => null,
'CustomerDueDate' => '2018-03-10T14:45:28Z',
'Method' => 'Delivery',
'PhoneNumber' => '+441234567890'
],
'IsTest' => null,
'Items' => [
[
'Items' => [
[
'Items' => [
],
'Name' => 'Fries',
'Quantity' => 1,
'Reference' => '9876',
'Synonym' => 'Regular',
'UnitPrice' => 0
],
[
'Items' => [
],
'Name' => 'Pepsi',
'Quantity' => 2,
'Reference' => '6789',
'Synonym' => '330ml',
'UnitPrice' => 0
]
],
'Name' => 'Chicken Box Meal',
'Quantity' => 2,
'Reference' => '1234',
'Synonym' => '',
'TotalPrice' => 10,
'UnitPrice' => 5
],
[
'Items' => [
],
'Name' => 'Milkshake',
'Quantity' => 1,
'Reference' => '4321',
'Synonym' => '',
'TotalPrice' => 7.25,
'UnitPrice' => 7.25
]
],
'OrderId' => 'XYZ123456',
'Payment' => [
'Lines' => [
[
'Paid' => null,
'Type' => 'card',
'Value' => 19.25
]
]
],
'PlacedDate' => '2018-03-10T14:45:28Z',
'PriceBreakdown' => [
'Discount' => 0,
'Fees' => [
'Delivery' => 1,
'Other' => 0,
'ServiceCharge' => 0.5
],
'Items' => 17.25,
'Taxes' => 3.85,
'Tips' => 0.5
],
'Restaurant' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.4484,
'Longitude' => -0.1504
],
'Lines' => [
'Oldridge Road'
],
'PostalCode' => 'SW12 8PW'
],
'Id' => '99999',
'Name' => 'Just Eat Test Restaurant',
'PhoneNumber' => '+441200000000',
'Refererence' => 'R99999'
],
'TotalPrice' => 19.25
]));
$request->setRequestUrl('{{baseUrl}}/order-ready-for-preparation-async');
$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}}/order-ready-for-preparation-async' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "card",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/order-ready-for-preparation-async' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "card",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/order-ready-for-preparation-async", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/order-ready-for-preparation-async"
payload = {
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": ["Fleet Place House", "Fleet Pl"],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": False,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": True,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": { "Lines": [
{
"Paid": False,
"Type": "card",
"Value": 19.25
}
] },
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": ["Oldridge Road"],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/order-ready-for-preparation-async"
payload <- "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\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}}/order-ready-for-preparation-async")
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 \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\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/order-ready-for-preparation-async') do |req|
req.body = "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/order-ready-for-preparation-async";
let payload = json!({
"Currency": "GBP",
"Customer": json!({
"Id": "Batman",
"Name": "Bruce Wayne"
}),
"CustomerNotes": (
json!({
"Key": "Floor",
"Value": "5th floor"
}),
json!({
"Key": "Code",
"Value": "Code 1234"
})
),
"Fulfilment": json!({
"Address": json!({
"City": "London",
"Geolocation": json!({
"Latitude": 51.51641,
"Longitude": -0.103198
}),
"Lines": ("Fleet Place House", "Fleet Pl"),
"PostalCode": "EC4M 7RD"
}),
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
}),
"IsTest": true,
"Items": (
json!({
"Items": (
json!({
"Items": (),
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
}),
json!({
"Items": (),
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
})
),
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
}),
json!({
"Items": (),
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
})
),
"OrderId": "XYZ123456",
"Payment": json!({"Lines": (
json!({
"Paid": false,
"Type": "card",
"Value": 19.25
})
)}),
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": json!({
"Discount": 0,
"Fees": json!({
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
}),
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
}),
"Restaurant": json!({
"Address": json!({
"City": "London",
"Geolocation": json!({
"Latitude": 51.4484,
"Longitude": -0.1504
}),
"Lines": ("Oldridge Road"),
"PostalCode": "SW12 8PW"
}),
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
}),
"TotalPrice": 19.25
});
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}}/order-ready-for-preparation-async \
--header 'content-type: application/json' \
--data '{
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "card",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}'
echo '{
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "card",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}' | \
http POST {{baseUrl}}/order-ready-for-preparation-async \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "Currency": "GBP",\n "Customer": {\n "Id": "Batman",\n "Name": "Bruce Wayne"\n },\n "CustomerNotes": [\n {\n "Key": "Floor",\n "Value": "5th floor"\n },\n {\n "Key": "Code",\n "Value": "Code 1234"\n }\n ],\n "Fulfilment": {\n "Address": {\n "City": "London",\n "Geolocation": {\n "Latitude": 51.51641,\n "Longitude": -0.103198\n },\n "Lines": [\n "Fleet Place House",\n "Fleet Pl"\n ],\n "PostalCode": "EC4M 7RD"\n },\n "CustomerDueAsap": false,\n "CustomerDueDate": "2018-03-10T14:45:28Z",\n "Method": "Delivery",\n "PhoneNumber": "+441234567890"\n },\n "IsTest": true,\n "Items": [\n {\n "Items": [\n {\n "Items": [],\n "Name": "Fries",\n "Quantity": 1,\n "Reference": "9876",\n "Synonym": "Regular",\n "UnitPrice": 0\n },\n {\n "Items": [],\n "Name": "Pepsi",\n "Quantity": 2,\n "Reference": "6789",\n "Synonym": "330ml",\n "UnitPrice": 0\n }\n ],\n "Name": "Chicken Box Meal",\n "Quantity": 2,\n "Reference": "1234",\n "Synonym": "",\n "TotalPrice": 10,\n "UnitPrice": 5\n },\n {\n "Items": [],\n "Name": "Milkshake",\n "Quantity": 1,\n "Reference": "4321",\n "Synonym": "",\n "TotalPrice": 7.25,\n "UnitPrice": 7.25\n }\n ],\n "OrderId": "XYZ123456",\n "Payment": {\n "Lines": [\n {\n "Paid": false,\n "Type": "card",\n "Value": 19.25\n }\n ]\n },\n "PlacedDate": "2018-03-10T14:45:28Z",\n "PriceBreakdown": {\n "Discount": 0,\n "Fees": {\n "Delivery": 1,\n "Other": 0,\n "ServiceCharge": 0.5\n },\n "Items": 17.25,\n "Taxes": 3.85,\n "Tips": 0.5\n },\n "Restaurant": {\n "Address": {\n "City": "London",\n "Geolocation": {\n "Latitude": 51.4484,\n "Longitude": -0.1504\n },\n "Lines": [\n "Oldridge Road"\n ],\n "PostalCode": "SW12 8PW"\n },\n "Id": "99999",\n "Name": "Just Eat Test Restaurant",\n "PhoneNumber": "+441200000000",\n "Refererence": "R99999"\n },\n "TotalPrice": 19.25\n}' \
--output-document \
- {{baseUrl}}/order-ready-for-preparation-async
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"Currency": "GBP",
"Customer": [
"Id": "Batman",
"Name": "Bruce Wayne"
],
"CustomerNotes": [
[
"Key": "Floor",
"Value": "5th floor"
],
[
"Key": "Code",
"Value": "Code 1234"
]
],
"Fulfilment": [
"Address": [
"City": "London",
"Geolocation": [
"Latitude": 51.51641,
"Longitude": -0.103198
],
"Lines": ["Fleet Place House", "Fleet Pl"],
"PostalCode": "EC4M 7RD"
],
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
],
"IsTest": true,
"Items": [
[
"Items": [
[
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
],
[
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
]
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
],
[
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
]
],
"OrderId": "XYZ123456",
"Payment": ["Lines": [
[
"Paid": false,
"Type": "card",
"Value": 19.25
]
]],
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": [
"Discount": 0,
"Fees": [
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
],
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
],
"Restaurant": [
"Address": [
"City": "London",
"Geolocation": [
"Latitude": 51.4484,
"Longitude": -0.1504
],
"Lines": ["Oldridge Road"],
"PostalCode": "SW12 8PW"
],
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
],
"TotalPrice": 19.25
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/order-ready-for-preparation-async")! 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
Order ready for preparation (sync)
{{baseUrl}}/order-ready-for-preparation-sync
BODY json
{
"Currency": "",
"Customer": {
"Id": "",
"Name": ""
},
"CustomerNotes": {},
"Fulfilment": {
"Address": {
"City": "",
"Geolocation": {
"Accuracy": "",
"Heading": "",
"Latitude": "",
"Longitude": "",
"Speed": ""
},
"Lines": [],
"PostalCode": ""
},
"CustomerDueAsap": false,
"CustomerDueDate": "",
"Method": "",
"PhoneNumber": "",
"PreparationTime": "",
"PrepareFor": ""
},
"IsTest": false,
"Items": [
{
"Items": [],
"Name": "",
"Quantity": 0,
"Reference": "",
"UnitPrice": 0
}
],
"OrderId": "",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "",
"Value": ""
}
]
},
"PlacedDate": "",
"PriceBreakdown": {
"Discount": "",
"Fees": {
"Delivery": "",
"Other": "",
"ServiceCharge": ""
},
"Items": "",
"Taxes": "",
"Tips": ""
},
"Restaurant": {
"Address": {
"City": "",
"Geolocation": {},
"Lines": [],
"PostalCode": ""
},
"Id": "",
"Name": "",
"PhoneNumber": "",
"Reference": ""
},
"TotalPrice": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/order-ready-for-preparation-sync");
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 \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/order-ready-for-preparation-sync" {:content-type :json
:form-params {:Currency "GBP"
:Customer {:Id "Batman"
:Name "Bruce Wayne"}
:CustomerNotes [{:Key "Floor"
:Value "5th floor"} {:Key "Code"
:Value "Code 1234"}]
:Fulfilment {:Address {:City "London"
:Geolocation {:Latitude 51.51641
:Longitude -0.103198}
:Lines ["Fleet Place House" "Fleet Pl"]
:PostalCode "EC4M 7RD"}
:CustomerDueAsap false
:CustomerDueDate "2018-03-10T14:45:28Z"
:Method "Delivery"
:PhoneNumber "+441234567890"}
:IsTest true
:Items [{:Items [{:Items []
:Name "Fries"
:Quantity 1
:Reference "9876"
:Synonym "Regular"
:UnitPrice 0} {:Items []
:Name "Pepsi"
:Quantity 2
:Reference "6789"
:Synonym "330ml"
:UnitPrice 0}]
:Name "Chicken Box Meal"
:Quantity 2
:Reference "1234"
:Synonym ""
:TotalPrice 10
:UnitPrice 5} {:Items []
:Name "Milkshake"
:Quantity 1
:Reference "4321"
:Synonym ""
:TotalPrice 7.25
:UnitPrice 7.25}]
:OrderId "XYZ123456"
:Payment {:Lines [{:Paid false
:Type "card"
:Value 19.25}]}
:PlacedDate "2018-03-10T14:45:28Z"
:PriceBreakdown {:Discount 0
:Fees {:Delivery 1
:Other 0
:ServiceCharge 0.5}
:Items 17.25
:Taxes 3.85
:Tips 0.5}
:Restaurant {:Address {:City "London"
:Geolocation {:Latitude 51.4484
:Longitude -0.1504}
:Lines ["Oldridge Road"]
:PostalCode "SW12 8PW"}
:Id "99999"
:Name "Just Eat Test Restaurant"
:PhoneNumber "+441200000000"
:Refererence "R99999"}
:TotalPrice 19.25}})
require "http/client"
url = "{{baseUrl}}/order-ready-for-preparation-sync"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\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}}/order-ready-for-preparation-sync"),
Content = new StringContent("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\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}}/order-ready-for-preparation-sync");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/order-ready-for-preparation-sync"
payload := strings.NewReader("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\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/order-ready-for-preparation-sync HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 2179
{
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "card",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/order-ready-for-preparation-sync")
.setHeader("content-type", "application/json")
.setBody("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/order-ready-for-preparation-sync"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\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 \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/order-ready-for-preparation-sync")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/order-ready-for-preparation-sync")
.header("content-type", "application/json")
.body("{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}")
.asString();
const data = JSON.stringify({
Currency: 'GBP',
Customer: {
Id: 'Batman',
Name: 'Bruce Wayne'
},
CustomerNotes: [
{
Key: 'Floor',
Value: '5th floor'
},
{
Key: 'Code',
Value: 'Code 1234'
}
],
Fulfilment: {
Address: {
City: 'London',
Geolocation: {
Latitude: 51.51641,
Longitude: -0.103198
},
Lines: [
'Fleet Place House',
'Fleet Pl'
],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneNumber: '+441234567890'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'XYZ123456',
Payment: {
Lines: [
{
Paid: false,
Type: 'card',
Value: 19.25
}
]
},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {
Delivery: 1,
Other: 0,
ServiceCharge: 0.5
},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {
Latitude: 51.4484,
Longitude: -0.1504
},
Lines: [
'Oldridge Road'
],
PostalCode: 'SW12 8PW'
},
Id: '99999',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999'
},
TotalPrice: 19.25
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/order-ready-for-preparation-sync');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/order-ready-for-preparation-sync',
headers: {'content-type': 'application/json'},
data: {
Currency: 'GBP',
Customer: {Id: 'Batman', Name: 'Bruce Wayne'},
CustomerNotes: [{Key: 'Floor', Value: '5th floor'}, {Key: 'Code', Value: 'Code 1234'}],
Fulfilment: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.51641, Longitude: -0.103198},
Lines: ['Fleet Place House', 'Fleet Pl'],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneNumber: '+441234567890'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'XYZ123456',
Payment: {Lines: [{Paid: false, Type: 'card', Value: 19.25}]},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {Delivery: 1, Other: 0, ServiceCharge: 0.5},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.4484, Longitude: -0.1504},
Lines: ['Oldridge Road'],
PostalCode: 'SW12 8PW'
},
Id: '99999',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999'
},
TotalPrice: 19.25
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/order-ready-for-preparation-sync';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"Currency":"GBP","Customer":{"Id":"Batman","Name":"Bruce Wayne"},"CustomerNotes":[{"Key":"Floor","Value":"5th floor"},{"Key":"Code","Value":"Code 1234"}],"Fulfilment":{"Address":{"City":"London","Geolocation":{"Latitude":51.51641,"Longitude":-0.103198},"Lines":["Fleet Place House","Fleet Pl"],"PostalCode":"EC4M 7RD"},"CustomerDueAsap":false,"CustomerDueDate":"2018-03-10T14:45:28Z","Method":"Delivery","PhoneNumber":"+441234567890"},"IsTest":true,"Items":[{"Items":[{"Items":[],"Name":"Fries","Quantity":1,"Reference":"9876","Synonym":"Regular","UnitPrice":0},{"Items":[],"Name":"Pepsi","Quantity":2,"Reference":"6789","Synonym":"330ml","UnitPrice":0}],"Name":"Chicken Box Meal","Quantity":2,"Reference":"1234","Synonym":"","TotalPrice":10,"UnitPrice":5},{"Items":[],"Name":"Milkshake","Quantity":1,"Reference":"4321","Synonym":"","TotalPrice":7.25,"UnitPrice":7.25}],"OrderId":"XYZ123456","Payment":{"Lines":[{"Paid":false,"Type":"card","Value":19.25}]},"PlacedDate":"2018-03-10T14:45:28Z","PriceBreakdown":{"Discount":0,"Fees":{"Delivery":1,"Other":0,"ServiceCharge":0.5},"Items":17.25,"Taxes":3.85,"Tips":0.5},"Restaurant":{"Address":{"City":"London","Geolocation":{"Latitude":51.4484,"Longitude":-0.1504},"Lines":["Oldridge Road"],"PostalCode":"SW12 8PW"},"Id":"99999","Name":"Just Eat Test Restaurant","PhoneNumber":"+441200000000","Refererence":"R99999"},"TotalPrice":19.25}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/order-ready-for-preparation-sync',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "Currency": "GBP",\n "Customer": {\n "Id": "Batman",\n "Name": "Bruce Wayne"\n },\n "CustomerNotes": [\n {\n "Key": "Floor",\n "Value": "5th floor"\n },\n {\n "Key": "Code",\n "Value": "Code 1234"\n }\n ],\n "Fulfilment": {\n "Address": {\n "City": "London",\n "Geolocation": {\n "Latitude": 51.51641,\n "Longitude": -0.103198\n },\n "Lines": [\n "Fleet Place House",\n "Fleet Pl"\n ],\n "PostalCode": "EC4M 7RD"\n },\n "CustomerDueAsap": false,\n "CustomerDueDate": "2018-03-10T14:45:28Z",\n "Method": "Delivery",\n "PhoneNumber": "+441234567890"\n },\n "IsTest": true,\n "Items": [\n {\n "Items": [\n {\n "Items": [],\n "Name": "Fries",\n "Quantity": 1,\n "Reference": "9876",\n "Synonym": "Regular",\n "UnitPrice": 0\n },\n {\n "Items": [],\n "Name": "Pepsi",\n "Quantity": 2,\n "Reference": "6789",\n "Synonym": "330ml",\n "UnitPrice": 0\n }\n ],\n "Name": "Chicken Box Meal",\n "Quantity": 2,\n "Reference": "1234",\n "Synonym": "",\n "TotalPrice": 10,\n "UnitPrice": 5\n },\n {\n "Items": [],\n "Name": "Milkshake",\n "Quantity": 1,\n "Reference": "4321",\n "Synonym": "",\n "TotalPrice": 7.25,\n "UnitPrice": 7.25\n }\n ],\n "OrderId": "XYZ123456",\n "Payment": {\n "Lines": [\n {\n "Paid": false,\n "Type": "card",\n "Value": 19.25\n }\n ]\n },\n "PlacedDate": "2018-03-10T14:45:28Z",\n "PriceBreakdown": {\n "Discount": 0,\n "Fees": {\n "Delivery": 1,\n "Other": 0,\n "ServiceCharge": 0.5\n },\n "Items": 17.25,\n "Taxes": 3.85,\n "Tips": 0.5\n },\n "Restaurant": {\n "Address": {\n "City": "London",\n "Geolocation": {\n "Latitude": 51.4484,\n "Longitude": -0.1504\n },\n "Lines": [\n "Oldridge Road"\n ],\n "PostalCode": "SW12 8PW"\n },\n "Id": "99999",\n "Name": "Just Eat Test Restaurant",\n "PhoneNumber": "+441200000000",\n "Refererence": "R99999"\n },\n "TotalPrice": 19.25\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}")
val request = Request.Builder()
.url("{{baseUrl}}/order-ready-for-preparation-sync")
.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/order-ready-for-preparation-sync',
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({
Currency: 'GBP',
Customer: {Id: 'Batman', Name: 'Bruce Wayne'},
CustomerNotes: [{Key: 'Floor', Value: '5th floor'}, {Key: 'Code', Value: 'Code 1234'}],
Fulfilment: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.51641, Longitude: -0.103198},
Lines: ['Fleet Place House', 'Fleet Pl'],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneNumber: '+441234567890'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'XYZ123456',
Payment: {Lines: [{Paid: false, Type: 'card', Value: 19.25}]},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {Delivery: 1, Other: 0, ServiceCharge: 0.5},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.4484, Longitude: -0.1504},
Lines: ['Oldridge Road'],
PostalCode: 'SW12 8PW'
},
Id: '99999',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999'
},
TotalPrice: 19.25
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/order-ready-for-preparation-sync',
headers: {'content-type': 'application/json'},
body: {
Currency: 'GBP',
Customer: {Id: 'Batman', Name: 'Bruce Wayne'},
CustomerNotes: [{Key: 'Floor', Value: '5th floor'}, {Key: 'Code', Value: 'Code 1234'}],
Fulfilment: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.51641, Longitude: -0.103198},
Lines: ['Fleet Place House', 'Fleet Pl'],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneNumber: '+441234567890'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'XYZ123456',
Payment: {Lines: [{Paid: false, Type: 'card', Value: 19.25}]},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {Delivery: 1, Other: 0, ServiceCharge: 0.5},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.4484, Longitude: -0.1504},
Lines: ['Oldridge Road'],
PostalCode: 'SW12 8PW'
},
Id: '99999',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999'
},
TotalPrice: 19.25
},
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}}/order-ready-for-preparation-sync');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
Currency: 'GBP',
Customer: {
Id: 'Batman',
Name: 'Bruce Wayne'
},
CustomerNotes: [
{
Key: 'Floor',
Value: '5th floor'
},
{
Key: 'Code',
Value: 'Code 1234'
}
],
Fulfilment: {
Address: {
City: 'London',
Geolocation: {
Latitude: 51.51641,
Longitude: -0.103198
},
Lines: [
'Fleet Place House',
'Fleet Pl'
],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneNumber: '+441234567890'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'XYZ123456',
Payment: {
Lines: [
{
Paid: false,
Type: 'card',
Value: 19.25
}
]
},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {
Delivery: 1,
Other: 0,
ServiceCharge: 0.5
},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {
Latitude: 51.4484,
Longitude: -0.1504
},
Lines: [
'Oldridge Road'
],
PostalCode: 'SW12 8PW'
},
Id: '99999',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999'
},
TotalPrice: 19.25
});
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}}/order-ready-for-preparation-sync',
headers: {'content-type': 'application/json'},
data: {
Currency: 'GBP',
Customer: {Id: 'Batman', Name: 'Bruce Wayne'},
CustomerNotes: [{Key: 'Floor', Value: '5th floor'}, {Key: 'Code', Value: 'Code 1234'}],
Fulfilment: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.51641, Longitude: -0.103198},
Lines: ['Fleet Place House', 'Fleet Pl'],
PostalCode: 'EC4M 7RD'
},
CustomerDueAsap: false,
CustomerDueDate: '2018-03-10T14:45:28Z',
Method: 'Delivery',
PhoneNumber: '+441234567890'
},
IsTest: true,
Items: [
{
Items: [
{
Items: [],
Name: 'Fries',
Quantity: 1,
Reference: '9876',
Synonym: 'Regular',
UnitPrice: 0
},
{
Items: [],
Name: 'Pepsi',
Quantity: 2,
Reference: '6789',
Synonym: '330ml',
UnitPrice: 0
}
],
Name: 'Chicken Box Meal',
Quantity: 2,
Reference: '1234',
Synonym: '',
TotalPrice: 10,
UnitPrice: 5
},
{
Items: [],
Name: 'Milkshake',
Quantity: 1,
Reference: '4321',
Synonym: '',
TotalPrice: 7.25,
UnitPrice: 7.25
}
],
OrderId: 'XYZ123456',
Payment: {Lines: [{Paid: false, Type: 'card', Value: 19.25}]},
PlacedDate: '2018-03-10T14:45:28Z',
PriceBreakdown: {
Discount: 0,
Fees: {Delivery: 1, Other: 0, ServiceCharge: 0.5},
Items: 17.25,
Taxes: 3.85,
Tips: 0.5
},
Restaurant: {
Address: {
City: 'London',
Geolocation: {Latitude: 51.4484, Longitude: -0.1504},
Lines: ['Oldridge Road'],
PostalCode: 'SW12 8PW'
},
Id: '99999',
Name: 'Just Eat Test Restaurant',
PhoneNumber: '+441200000000',
Refererence: 'R99999'
},
TotalPrice: 19.25
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/order-ready-for-preparation-sync';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"Currency":"GBP","Customer":{"Id":"Batman","Name":"Bruce Wayne"},"CustomerNotes":[{"Key":"Floor","Value":"5th floor"},{"Key":"Code","Value":"Code 1234"}],"Fulfilment":{"Address":{"City":"London","Geolocation":{"Latitude":51.51641,"Longitude":-0.103198},"Lines":["Fleet Place House","Fleet Pl"],"PostalCode":"EC4M 7RD"},"CustomerDueAsap":false,"CustomerDueDate":"2018-03-10T14:45:28Z","Method":"Delivery","PhoneNumber":"+441234567890"},"IsTest":true,"Items":[{"Items":[{"Items":[],"Name":"Fries","Quantity":1,"Reference":"9876","Synonym":"Regular","UnitPrice":0},{"Items":[],"Name":"Pepsi","Quantity":2,"Reference":"6789","Synonym":"330ml","UnitPrice":0}],"Name":"Chicken Box Meal","Quantity":2,"Reference":"1234","Synonym":"","TotalPrice":10,"UnitPrice":5},{"Items":[],"Name":"Milkshake","Quantity":1,"Reference":"4321","Synonym":"","TotalPrice":7.25,"UnitPrice":7.25}],"OrderId":"XYZ123456","Payment":{"Lines":[{"Paid":false,"Type":"card","Value":19.25}]},"PlacedDate":"2018-03-10T14:45:28Z","PriceBreakdown":{"Discount":0,"Fees":{"Delivery":1,"Other":0,"ServiceCharge":0.5},"Items":17.25,"Taxes":3.85,"Tips":0.5},"Restaurant":{"Address":{"City":"London","Geolocation":{"Latitude":51.4484,"Longitude":-0.1504},"Lines":["Oldridge Road"],"PostalCode":"SW12 8PW"},"Id":"99999","Name":"Just Eat Test Restaurant","PhoneNumber":"+441200000000","Refererence":"R99999"},"TotalPrice":19.25}'
};
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 = @{ @"Currency": @"GBP",
@"Customer": @{ @"Id": @"Batman", @"Name": @"Bruce Wayne" },
@"CustomerNotes": @[ @{ @"Key": @"Floor", @"Value": @"5th floor" }, @{ @"Key": @"Code", @"Value": @"Code 1234" } ],
@"Fulfilment": @{ @"Address": @{ @"City": @"London", @"Geolocation": @{ @"Latitude": @51.51641, @"Longitude": @-0.103198 }, @"Lines": @[ @"Fleet Place House", @"Fleet Pl" ], @"PostalCode": @"EC4M 7RD" }, @"CustomerDueAsap": @NO, @"CustomerDueDate": @"2018-03-10T14:45:28Z", @"Method": @"Delivery", @"PhoneNumber": @"+441234567890" },
@"IsTest": @YES,
@"Items": @[ @{ @"Items": @[ @{ @"Items": @[ ], @"Name": @"Fries", @"Quantity": @1, @"Reference": @"9876", @"Synonym": @"Regular", @"UnitPrice": @0 }, @{ @"Items": @[ ], @"Name": @"Pepsi", @"Quantity": @2, @"Reference": @"6789", @"Synonym": @"330ml", @"UnitPrice": @0 } ], @"Name": @"Chicken Box Meal", @"Quantity": @2, @"Reference": @"1234", @"Synonym": @"", @"TotalPrice": @10, @"UnitPrice": @5 }, @{ @"Items": @[ ], @"Name": @"Milkshake", @"Quantity": @1, @"Reference": @"4321", @"Synonym": @"", @"TotalPrice": @7.25, @"UnitPrice": @7.25 } ],
@"OrderId": @"XYZ123456",
@"Payment": @{ @"Lines": @[ @{ @"Paid": @NO, @"Type": @"card", @"Value": @19.25 } ] },
@"PlacedDate": @"2018-03-10T14:45:28Z",
@"PriceBreakdown": @{ @"Discount": @0, @"Fees": @{ @"Delivery": @1, @"Other": @0, @"ServiceCharge": @0.5 }, @"Items": @17.25, @"Taxes": @3.85, @"Tips": @0.5 },
@"Restaurant": @{ @"Address": @{ @"City": @"London", @"Geolocation": @{ @"Latitude": @51.4484, @"Longitude": @-0.1504 }, @"Lines": @[ @"Oldridge Road" ], @"PostalCode": @"SW12 8PW" }, @"Id": @"99999", @"Name": @"Just Eat Test Restaurant", @"PhoneNumber": @"+441200000000", @"Refererence": @"R99999" },
@"TotalPrice": @19.25 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/order-ready-for-preparation-sync"]
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}}/order-ready-for-preparation-sync" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/order-ready-for-preparation-sync",
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([
'Currency' => 'GBP',
'Customer' => [
'Id' => 'Batman',
'Name' => 'Bruce Wayne'
],
'CustomerNotes' => [
[
'Key' => 'Floor',
'Value' => '5th floor'
],
[
'Key' => 'Code',
'Value' => 'Code 1234'
]
],
'Fulfilment' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.51641,
'Longitude' => -0.103198
],
'Lines' => [
'Fleet Place House',
'Fleet Pl'
],
'PostalCode' => 'EC4M 7RD'
],
'CustomerDueAsap' => null,
'CustomerDueDate' => '2018-03-10T14:45:28Z',
'Method' => 'Delivery',
'PhoneNumber' => '+441234567890'
],
'IsTest' => null,
'Items' => [
[
'Items' => [
[
'Items' => [
],
'Name' => 'Fries',
'Quantity' => 1,
'Reference' => '9876',
'Synonym' => 'Regular',
'UnitPrice' => 0
],
[
'Items' => [
],
'Name' => 'Pepsi',
'Quantity' => 2,
'Reference' => '6789',
'Synonym' => '330ml',
'UnitPrice' => 0
]
],
'Name' => 'Chicken Box Meal',
'Quantity' => 2,
'Reference' => '1234',
'Synonym' => '',
'TotalPrice' => 10,
'UnitPrice' => 5
],
[
'Items' => [
],
'Name' => 'Milkshake',
'Quantity' => 1,
'Reference' => '4321',
'Synonym' => '',
'TotalPrice' => 7.25,
'UnitPrice' => 7.25
]
],
'OrderId' => 'XYZ123456',
'Payment' => [
'Lines' => [
[
'Paid' => null,
'Type' => 'card',
'Value' => 19.25
]
]
],
'PlacedDate' => '2018-03-10T14:45:28Z',
'PriceBreakdown' => [
'Discount' => 0,
'Fees' => [
'Delivery' => 1,
'Other' => 0,
'ServiceCharge' => 0.5
],
'Items' => 17.25,
'Taxes' => 3.85,
'Tips' => 0.5
],
'Restaurant' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.4484,
'Longitude' => -0.1504
],
'Lines' => [
'Oldridge Road'
],
'PostalCode' => 'SW12 8PW'
],
'Id' => '99999',
'Name' => 'Just Eat Test Restaurant',
'PhoneNumber' => '+441200000000',
'Refererence' => 'R99999'
],
'TotalPrice' => 19.25
]),
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}}/order-ready-for-preparation-sync', [
'body' => '{
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "card",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/order-ready-for-preparation-sync');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Currency' => 'GBP',
'Customer' => [
'Id' => 'Batman',
'Name' => 'Bruce Wayne'
],
'CustomerNotes' => [
[
'Key' => 'Floor',
'Value' => '5th floor'
],
[
'Key' => 'Code',
'Value' => 'Code 1234'
]
],
'Fulfilment' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.51641,
'Longitude' => -0.103198
],
'Lines' => [
'Fleet Place House',
'Fleet Pl'
],
'PostalCode' => 'EC4M 7RD'
],
'CustomerDueAsap' => null,
'CustomerDueDate' => '2018-03-10T14:45:28Z',
'Method' => 'Delivery',
'PhoneNumber' => '+441234567890'
],
'IsTest' => null,
'Items' => [
[
'Items' => [
[
'Items' => [
],
'Name' => 'Fries',
'Quantity' => 1,
'Reference' => '9876',
'Synonym' => 'Regular',
'UnitPrice' => 0
],
[
'Items' => [
],
'Name' => 'Pepsi',
'Quantity' => 2,
'Reference' => '6789',
'Synonym' => '330ml',
'UnitPrice' => 0
]
],
'Name' => 'Chicken Box Meal',
'Quantity' => 2,
'Reference' => '1234',
'Synonym' => '',
'TotalPrice' => 10,
'UnitPrice' => 5
],
[
'Items' => [
],
'Name' => 'Milkshake',
'Quantity' => 1,
'Reference' => '4321',
'Synonym' => '',
'TotalPrice' => 7.25,
'UnitPrice' => 7.25
]
],
'OrderId' => 'XYZ123456',
'Payment' => [
'Lines' => [
[
'Paid' => null,
'Type' => 'card',
'Value' => 19.25
]
]
],
'PlacedDate' => '2018-03-10T14:45:28Z',
'PriceBreakdown' => [
'Discount' => 0,
'Fees' => [
'Delivery' => 1,
'Other' => 0,
'ServiceCharge' => 0.5
],
'Items' => 17.25,
'Taxes' => 3.85,
'Tips' => 0.5
],
'Restaurant' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.4484,
'Longitude' => -0.1504
],
'Lines' => [
'Oldridge Road'
],
'PostalCode' => 'SW12 8PW'
],
'Id' => '99999',
'Name' => 'Just Eat Test Restaurant',
'PhoneNumber' => '+441200000000',
'Refererence' => 'R99999'
],
'TotalPrice' => 19.25
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Currency' => 'GBP',
'Customer' => [
'Id' => 'Batman',
'Name' => 'Bruce Wayne'
],
'CustomerNotes' => [
[
'Key' => 'Floor',
'Value' => '5th floor'
],
[
'Key' => 'Code',
'Value' => 'Code 1234'
]
],
'Fulfilment' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.51641,
'Longitude' => -0.103198
],
'Lines' => [
'Fleet Place House',
'Fleet Pl'
],
'PostalCode' => 'EC4M 7RD'
],
'CustomerDueAsap' => null,
'CustomerDueDate' => '2018-03-10T14:45:28Z',
'Method' => 'Delivery',
'PhoneNumber' => '+441234567890'
],
'IsTest' => null,
'Items' => [
[
'Items' => [
[
'Items' => [
],
'Name' => 'Fries',
'Quantity' => 1,
'Reference' => '9876',
'Synonym' => 'Regular',
'UnitPrice' => 0
],
[
'Items' => [
],
'Name' => 'Pepsi',
'Quantity' => 2,
'Reference' => '6789',
'Synonym' => '330ml',
'UnitPrice' => 0
]
],
'Name' => 'Chicken Box Meal',
'Quantity' => 2,
'Reference' => '1234',
'Synonym' => '',
'TotalPrice' => 10,
'UnitPrice' => 5
],
[
'Items' => [
],
'Name' => 'Milkshake',
'Quantity' => 1,
'Reference' => '4321',
'Synonym' => '',
'TotalPrice' => 7.25,
'UnitPrice' => 7.25
]
],
'OrderId' => 'XYZ123456',
'Payment' => [
'Lines' => [
[
'Paid' => null,
'Type' => 'card',
'Value' => 19.25
]
]
],
'PlacedDate' => '2018-03-10T14:45:28Z',
'PriceBreakdown' => [
'Discount' => 0,
'Fees' => [
'Delivery' => 1,
'Other' => 0,
'ServiceCharge' => 0.5
],
'Items' => 17.25,
'Taxes' => 3.85,
'Tips' => 0.5
],
'Restaurant' => [
'Address' => [
'City' => 'London',
'Geolocation' => [
'Latitude' => 51.4484,
'Longitude' => -0.1504
],
'Lines' => [
'Oldridge Road'
],
'PostalCode' => 'SW12 8PW'
],
'Id' => '99999',
'Name' => 'Just Eat Test Restaurant',
'PhoneNumber' => '+441200000000',
'Refererence' => 'R99999'
],
'TotalPrice' => 19.25
]));
$request->setRequestUrl('{{baseUrl}}/order-ready-for-preparation-sync');
$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}}/order-ready-for-preparation-sync' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "card",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/order-ready-for-preparation-sync' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "card",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/order-ready-for-preparation-sync", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/order-ready-for-preparation-sync"
payload = {
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": ["Fleet Place House", "Fleet Pl"],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": False,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": True,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": { "Lines": [
{
"Paid": False,
"Type": "card",
"Value": 19.25
}
] },
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": ["Oldridge Road"],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/order-ready-for-preparation-sync"
payload <- "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\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}}/order-ready-for-preparation-sync")
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 \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\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/order-ready-for-preparation-sync') do |req|
req.body = "{\n \"Currency\": \"GBP\",\n \"Customer\": {\n \"Id\": \"Batman\",\n \"Name\": \"Bruce Wayne\"\n },\n \"CustomerNotes\": [\n {\n \"Key\": \"Floor\",\n \"Value\": \"5th floor\"\n },\n {\n \"Key\": \"Code\",\n \"Value\": \"Code 1234\"\n }\n ],\n \"Fulfilment\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.51641,\n \"Longitude\": -0.103198\n },\n \"Lines\": [\n \"Fleet Place House\",\n \"Fleet Pl\"\n ],\n \"PostalCode\": \"EC4M 7RD\"\n },\n \"CustomerDueAsap\": false,\n \"CustomerDueDate\": \"2018-03-10T14:45:28Z\",\n \"Method\": \"Delivery\",\n \"PhoneNumber\": \"+441234567890\"\n },\n \"IsTest\": true,\n \"Items\": [\n {\n \"Items\": [\n {\n \"Items\": [],\n \"Name\": \"Fries\",\n \"Quantity\": 1,\n \"Reference\": \"9876\",\n \"Synonym\": \"Regular\",\n \"UnitPrice\": 0\n },\n {\n \"Items\": [],\n \"Name\": \"Pepsi\",\n \"Quantity\": 2,\n \"Reference\": \"6789\",\n \"Synonym\": \"330ml\",\n \"UnitPrice\": 0\n }\n ],\n \"Name\": \"Chicken Box Meal\",\n \"Quantity\": 2,\n \"Reference\": \"1234\",\n \"Synonym\": \"\",\n \"TotalPrice\": 10,\n \"UnitPrice\": 5\n },\n {\n \"Items\": [],\n \"Name\": \"Milkshake\",\n \"Quantity\": 1,\n \"Reference\": \"4321\",\n \"Synonym\": \"\",\n \"TotalPrice\": 7.25,\n \"UnitPrice\": 7.25\n }\n ],\n \"OrderId\": \"XYZ123456\",\n \"Payment\": {\n \"Lines\": [\n {\n \"Paid\": false,\n \"Type\": \"card\",\n \"Value\": 19.25\n }\n ]\n },\n \"PlacedDate\": \"2018-03-10T14:45:28Z\",\n \"PriceBreakdown\": {\n \"Discount\": 0,\n \"Fees\": {\n \"Delivery\": 1,\n \"Other\": 0,\n \"ServiceCharge\": 0.5\n },\n \"Items\": 17.25,\n \"Taxes\": 3.85,\n \"Tips\": 0.5\n },\n \"Restaurant\": {\n \"Address\": {\n \"City\": \"London\",\n \"Geolocation\": {\n \"Latitude\": 51.4484,\n \"Longitude\": -0.1504\n },\n \"Lines\": [\n \"Oldridge Road\"\n ],\n \"PostalCode\": \"SW12 8PW\"\n },\n \"Id\": \"99999\",\n \"Name\": \"Just Eat Test Restaurant\",\n \"PhoneNumber\": \"+441200000000\",\n \"Refererence\": \"R99999\"\n },\n \"TotalPrice\": 19.25\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/order-ready-for-preparation-sync";
let payload = json!({
"Currency": "GBP",
"Customer": json!({
"Id": "Batman",
"Name": "Bruce Wayne"
}),
"CustomerNotes": (
json!({
"Key": "Floor",
"Value": "5th floor"
}),
json!({
"Key": "Code",
"Value": "Code 1234"
})
),
"Fulfilment": json!({
"Address": json!({
"City": "London",
"Geolocation": json!({
"Latitude": 51.51641,
"Longitude": -0.103198
}),
"Lines": ("Fleet Place House", "Fleet Pl"),
"PostalCode": "EC4M 7RD"
}),
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
}),
"IsTest": true,
"Items": (
json!({
"Items": (
json!({
"Items": (),
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
}),
json!({
"Items": (),
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
})
),
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
}),
json!({
"Items": (),
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
})
),
"OrderId": "XYZ123456",
"Payment": json!({"Lines": (
json!({
"Paid": false,
"Type": "card",
"Value": 19.25
})
)}),
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": json!({
"Discount": 0,
"Fees": json!({
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
}),
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
}),
"Restaurant": json!({
"Address": json!({
"City": "London",
"Geolocation": json!({
"Latitude": 51.4484,
"Longitude": -0.1504
}),
"Lines": ("Oldridge Road"),
"PostalCode": "SW12 8PW"
}),
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
}),
"TotalPrice": 19.25
});
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}}/order-ready-for-preparation-sync \
--header 'content-type: application/json' \
--data '{
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "card",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}'
echo '{
"Currency": "GBP",
"Customer": {
"Id": "Batman",
"Name": "Bruce Wayne"
},
"CustomerNotes": [
{
"Key": "Floor",
"Value": "5th floor"
},
{
"Key": "Code",
"Value": "Code 1234"
}
],
"Fulfilment": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.51641,
"Longitude": -0.103198
},
"Lines": [
"Fleet Place House",
"Fleet Pl"
],
"PostalCode": "EC4M 7RD"
},
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
},
"IsTest": true,
"Items": [
{
"Items": [
{
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
},
{
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
}
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
},
{
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
}
],
"OrderId": "XYZ123456",
"Payment": {
"Lines": [
{
"Paid": false,
"Type": "card",
"Value": 19.25
}
]
},
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": {
"Discount": 0,
"Fees": {
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
},
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
},
"Restaurant": {
"Address": {
"City": "London",
"Geolocation": {
"Latitude": 51.4484,
"Longitude": -0.1504
},
"Lines": [
"Oldridge Road"
],
"PostalCode": "SW12 8PW"
},
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
},
"TotalPrice": 19.25
}' | \
http POST {{baseUrl}}/order-ready-for-preparation-sync \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "Currency": "GBP",\n "Customer": {\n "Id": "Batman",\n "Name": "Bruce Wayne"\n },\n "CustomerNotes": [\n {\n "Key": "Floor",\n "Value": "5th floor"\n },\n {\n "Key": "Code",\n "Value": "Code 1234"\n }\n ],\n "Fulfilment": {\n "Address": {\n "City": "London",\n "Geolocation": {\n "Latitude": 51.51641,\n "Longitude": -0.103198\n },\n "Lines": [\n "Fleet Place House",\n "Fleet Pl"\n ],\n "PostalCode": "EC4M 7RD"\n },\n "CustomerDueAsap": false,\n "CustomerDueDate": "2018-03-10T14:45:28Z",\n "Method": "Delivery",\n "PhoneNumber": "+441234567890"\n },\n "IsTest": true,\n "Items": [\n {\n "Items": [\n {\n "Items": [],\n "Name": "Fries",\n "Quantity": 1,\n "Reference": "9876",\n "Synonym": "Regular",\n "UnitPrice": 0\n },\n {\n "Items": [],\n "Name": "Pepsi",\n "Quantity": 2,\n "Reference": "6789",\n "Synonym": "330ml",\n "UnitPrice": 0\n }\n ],\n "Name": "Chicken Box Meal",\n "Quantity": 2,\n "Reference": "1234",\n "Synonym": "",\n "TotalPrice": 10,\n "UnitPrice": 5\n },\n {\n "Items": [],\n "Name": "Milkshake",\n "Quantity": 1,\n "Reference": "4321",\n "Synonym": "",\n "TotalPrice": 7.25,\n "UnitPrice": 7.25\n }\n ],\n "OrderId": "XYZ123456",\n "Payment": {\n "Lines": [\n {\n "Paid": false,\n "Type": "card",\n "Value": 19.25\n }\n ]\n },\n "PlacedDate": "2018-03-10T14:45:28Z",\n "PriceBreakdown": {\n "Discount": 0,\n "Fees": {\n "Delivery": 1,\n "Other": 0,\n "ServiceCharge": 0.5\n },\n "Items": 17.25,\n "Taxes": 3.85,\n "Tips": 0.5\n },\n "Restaurant": {\n "Address": {\n "City": "London",\n "Geolocation": {\n "Latitude": 51.4484,\n "Longitude": -0.1504\n },\n "Lines": [\n "Oldridge Road"\n ],\n "PostalCode": "SW12 8PW"\n },\n "Id": "99999",\n "Name": "Just Eat Test Restaurant",\n "PhoneNumber": "+441200000000",\n "Refererence": "R99999"\n },\n "TotalPrice": 19.25\n}' \
--output-document \
- {{baseUrl}}/order-ready-for-preparation-sync
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"Currency": "GBP",
"Customer": [
"Id": "Batman",
"Name": "Bruce Wayne"
],
"CustomerNotes": [
[
"Key": "Floor",
"Value": "5th floor"
],
[
"Key": "Code",
"Value": "Code 1234"
]
],
"Fulfilment": [
"Address": [
"City": "London",
"Geolocation": [
"Latitude": 51.51641,
"Longitude": -0.103198
],
"Lines": ["Fleet Place House", "Fleet Pl"],
"PostalCode": "EC4M 7RD"
],
"CustomerDueAsap": false,
"CustomerDueDate": "2018-03-10T14:45:28Z",
"Method": "Delivery",
"PhoneNumber": "+441234567890"
],
"IsTest": true,
"Items": [
[
"Items": [
[
"Items": [],
"Name": "Fries",
"Quantity": 1,
"Reference": "9876",
"Synonym": "Regular",
"UnitPrice": 0
],
[
"Items": [],
"Name": "Pepsi",
"Quantity": 2,
"Reference": "6789",
"Synonym": "330ml",
"UnitPrice": 0
]
],
"Name": "Chicken Box Meal",
"Quantity": 2,
"Reference": "1234",
"Synonym": "",
"TotalPrice": 10,
"UnitPrice": 5
],
[
"Items": [],
"Name": "Milkshake",
"Quantity": 1,
"Reference": "4321",
"Synonym": "",
"TotalPrice": 7.25,
"UnitPrice": 7.25
]
],
"OrderId": "XYZ123456",
"Payment": ["Lines": [
[
"Paid": false,
"Type": "card",
"Value": 19.25
]
]],
"PlacedDate": "2018-03-10T14:45:28Z",
"PriceBreakdown": [
"Discount": 0,
"Fees": [
"Delivery": 1,
"Other": 0,
"ServiceCharge": 0.5
],
"Items": 17.25,
"Taxes": 3.85,
"Tips": 0.5
],
"Restaurant": [
"Address": [
"City": "London",
"Geolocation": [
"Latitude": 51.4484,
"Longitude": -0.1504
],
"Lines": ["Oldridge Road"],
"PostalCode": "SW12 8PW"
],
"Id": "99999",
"Name": "Just Eat Test Restaurant",
"PhoneNumber": "+441200000000",
"Refererence": "R99999"
],
"TotalPrice": 19.25
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/order-ready-for-preparation-sync")! 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
Send to POS failed
{{baseUrl}}/send-to-pos-failed
BODY json
{
"OrderId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/send-to-pos-failed");
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 \"OrderId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/send-to-pos-failed" {:content-type :json
:form-params {:OrderId ""}})
require "http/client"
url = "{{baseUrl}}/send-to-pos-failed"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"OrderId\": \"\"\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}}/send-to-pos-failed"),
Content = new StringContent("{\n \"OrderId\": \"\"\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}}/send-to-pos-failed");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"OrderId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/send-to-pos-failed"
payload := strings.NewReader("{\n \"OrderId\": \"\"\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/send-to-pos-failed HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 19
{
"OrderId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/send-to-pos-failed")
.setHeader("content-type", "application/json")
.setBody("{\n \"OrderId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/send-to-pos-failed"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"OrderId\": \"\"\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 \"OrderId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/send-to-pos-failed")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/send-to-pos-failed")
.header("content-type", "application/json")
.body("{\n \"OrderId\": \"\"\n}")
.asString();
const data = JSON.stringify({
OrderId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/send-to-pos-failed');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/send-to-pos-failed',
headers: {'content-type': 'application/json'},
data: {OrderId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/send-to-pos-failed';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"OrderId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/send-to-pos-failed',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "OrderId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"OrderId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/send-to-pos-failed")
.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/send-to-pos-failed',
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({OrderId: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/send-to-pos-failed',
headers: {'content-type': 'application/json'},
body: {OrderId: ''},
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}}/send-to-pos-failed');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
OrderId: ''
});
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}}/send-to-pos-failed',
headers: {'content-type': 'application/json'},
data: {OrderId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/send-to-pos-failed';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"OrderId":""}'
};
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 = @{ @"OrderId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/send-to-pos-failed"]
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}}/send-to-pos-failed" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"OrderId\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/send-to-pos-failed",
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([
'OrderId' => ''
]),
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}}/send-to-pos-failed', [
'body' => '{
"OrderId": ""
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/send-to-pos-failed');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'OrderId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'OrderId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/send-to-pos-failed');
$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}}/send-to-pos-failed' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"OrderId": ""
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/send-to-pos-failed' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"OrderId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"OrderId\": \"\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/send-to-pos-failed", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/send-to-pos-failed"
payload = { "OrderId": "" }
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/send-to-pos-failed"
payload <- "{\n \"OrderId\": \"\"\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}}/send-to-pos-failed")
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 \"OrderId\": \"\"\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/send-to-pos-failed') do |req|
req.body = "{\n \"OrderId\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/send-to-pos-failed";
let payload = json!({"OrderId": ""});
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}}/send-to-pos-failed \
--header 'content-type: application/json' \
--data '{
"OrderId": ""
}'
echo '{
"OrderId": ""
}' | \
http POST {{baseUrl}}/send-to-pos-failed \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "OrderId": ""\n}' \
--output-document \
- {{baseUrl}}/send-to-pos-failed
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["OrderId": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/send-to-pos-failed")! 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 the restaurant's delivery and collection lead times
{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes
HEADERS
Authorization
QUERY PARAMS
tenant
restaurantId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: ");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes" {:headers {:authorization ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes"
headers = HTTP::Headers{
"authorization" => ""
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes"),
Headers =
{
{ "authorization", "" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes");
var request = new RestRequest("", Method.Get);
request.AddHeader("authorization", "");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/restaurants/:tenant/:restaurantId/ordertimes HTTP/1.1
Authorization:
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes")
.setHeader("authorization", "")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes"))
.header("authorization", "")
.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}}/restaurants/:tenant/:restaurantId/ordertimes")
.get()
.addHeader("authorization", "")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes")
.header("authorization", "")
.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}}/restaurants/:tenant/:restaurantId/ordertimes');
xhr.setRequestHeader('authorization', '');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes',
headers: {authorization: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes';
const options = {method: 'GET', headers: {authorization: ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes',
method: 'GET',
headers: {
authorization: ''
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes")
.get()
.addHeader("authorization", "")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/ordertimes',
headers: {
authorization: ''
}
};
const req = http.request(options, function (res) {
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}}/restaurants/:tenant/:restaurantId/ordertimes',
headers: {authorization: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes');
req.headers({
authorization: ''
});
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}}/restaurants/:tenant/:restaurantId/ordertimes',
headers: {authorization: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes';
const options = {method: 'GET', headers: {authorization: ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"authorization": @"" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes" in
let headers = Header.add (Header.init ()) "authorization" "" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"authorization: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes', [
'headers' => [
'authorization' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'authorization' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes');
$request->setRequestMethod('GET');
$request->setHeaders([
'authorization' => ''
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("authorization", "")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes' -Method GET -Headers $headers
$headers=@{}
$headers.Add("authorization", "")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'authorization': "" }
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/ordertimes", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes"
headers = {"authorization": ""}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes"
response <- VERB("GET", url, add_headers('authorization' = ''), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = ''
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/restaurants/:tenant/:restaurantId/ordertimes') do |req|
req.headers['authorization'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("authorization", "".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes \
--header 'authorization: '
http GET {{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes \
authorization:''
wget --quiet \
--method GET \
--header 'authorization: ' \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes
import Foundation
let headers = ["authorization": ""]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as 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
[
{
"dayOfWeek": "Sunday",
"lowerBoundMinutes": 35,
"serviceType": "Delivery",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Monday",
"lowerBoundMinutes": 35,
"serviceType": "Delivery",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Tuesday",
"lowerBoundMinutes": 35,
"serviceType": "Delivery",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Wednesday",
"lowerBoundMinutes": 35,
"serviceType": "Delivery",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Thursday",
"lowerBoundMinutes": 35,
"serviceType": "Delivery",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Friday",
"lowerBoundMinutes": 35,
"serviceType": "Delivery",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Saturday",
"lowerBoundMinutes": 35,
"serviceType": "Delivery",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Sunday",
"lowerBoundMinutes": 35,
"serviceType": "Collection",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Monday",
"lowerBoundMinutes": 35,
"serviceType": "Collection",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Tuesday",
"lowerBoundMinutes": 35,
"serviceType": "Collection",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Wednesday",
"lowerBoundMinutes": 35,
"serviceType": "Collection",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Thursday",
"lowerBoundMinutes": 35,
"serviceType": "Collection",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Friday",
"lowerBoundMinutes": 35,
"serviceType": "Collection",
"upperBoundMinutes": 50
},
{
"dayOfWeek": "Saturday",
"lowerBoundMinutes": 35,
"serviceType": "Collection",
"upperBoundMinutes": 50
}
]
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Unauthorized. The client did not provide an authentication token or the token was invalid.",
"errorCode": "ERR401"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "The restaurant still uses deprecated approach of Lunch and Night menus",
"errorCode": "Forbidden"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
PUT
Update the restaurant's delivery and collection lead times
{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType
HEADERS
Authorization
QUERY PARAMS
tenant
restaurantId
dayOfWeek
serviceType
BODY json
{
"lowerBoundMinutes": 0,
"upperBoundMinutes": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType" {:headers {:authorization ""}
:content-type :json
:form-params {:lowerBoundMinutes 0
:upperBoundMinutes 0}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType"
headers = HTTP::Headers{
"authorization" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType"),
Headers =
{
{ "authorization", "" },
},
Content = new StringContent("{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType");
var request = new RestRequest("", Method.Put);
request.AddHeader("authorization", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType"
payload := strings.NewReader("{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("authorization", "")
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/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType HTTP/1.1
Authorization:
Content-Type: application/json
Host: example.com
Content-Length: 54
{
"lowerBoundMinutes": 0,
"upperBoundMinutes": 0
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType")
.setHeader("authorization", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType"))
.header("authorization", "")
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType")
.put(body)
.addHeader("authorization", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType")
.header("authorization", "")
.header("content-type", "application/json")
.body("{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}")
.asString();
const data = JSON.stringify({
lowerBoundMinutes: 0,
upperBoundMinutes: 0
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType');
xhr.setRequestHeader('authorization', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType',
headers: {authorization: '', 'content-type': 'application/json'},
data: {lowerBoundMinutes: 0, upperBoundMinutes: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType';
const options = {
method: 'PUT',
headers: {authorization: '', 'content-type': 'application/json'},
body: '{"lowerBoundMinutes":0,"upperBoundMinutes":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}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType',
method: 'PUT',
headers: {
authorization: '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "lowerBoundMinutes": 0,\n "upperBoundMinutes": 0\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}")
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType")
.put(body)
.addHeader("authorization", "")
.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/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType',
headers: {
authorization: '',
'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({lowerBoundMinutes: 0, upperBoundMinutes: 0}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType',
headers: {authorization: '', 'content-type': 'application/json'},
body: {lowerBoundMinutes: 0, upperBoundMinutes: 0},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType');
req.headers({
authorization: '',
'content-type': 'application/json'
});
req.type('json');
req.send({
lowerBoundMinutes: 0,
upperBoundMinutes: 0
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType',
headers: {authorization: '', 'content-type': 'application/json'},
data: {lowerBoundMinutes: 0, upperBoundMinutes: 0}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType';
const options = {
method: 'PUT',
headers: {authorization: '', 'content-type': 'application/json'},
body: '{"lowerBoundMinutes":0,"upperBoundMinutes":0}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"authorization": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"lowerBoundMinutes": @0,
@"upperBoundMinutes": @0 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType"]
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}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType" in
let headers = Header.add_list (Header.init ()) [
("authorization", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType",
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([
'lowerBoundMinutes' => 0,
'upperBoundMinutes' => 0
]),
CURLOPT_HTTPHEADER => [
"authorization: ",
"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}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType', [
'body' => '{
"lowerBoundMinutes": 0,
"upperBoundMinutes": 0
}',
'headers' => [
'authorization' => '',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'authorization' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'lowerBoundMinutes' => 0,
'upperBoundMinutes' => 0
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'lowerBoundMinutes' => 0,
'upperBoundMinutes' => 0
]));
$request->setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'authorization' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("authorization", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"lowerBoundMinutes": 0,
"upperBoundMinutes": 0
}'
$headers=@{}
$headers.Add("authorization", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"lowerBoundMinutes": 0,
"upperBoundMinutes": 0
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}"
headers = {
'authorization': "",
'content-type': "application/json"
}
conn.request("PUT", "/baseUrl/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType"
payload = {
"lowerBoundMinutes": 0,
"upperBoundMinutes": 0
}
headers = {
"authorization": "",
"content-type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType"
payload <- "{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, add_headers('authorization' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["authorization"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType') do |req|
req.headers['authorization'] = ''
req.body = "{\n \"lowerBoundMinutes\": 0,\n \"upperBoundMinutes\": 0\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType";
let payload = json!({
"lowerBoundMinutes": 0,
"upperBoundMinutes": 0
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("authorization", "".parse().unwrap());
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}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType \
--header 'authorization: ' \
--header 'content-type: application/json' \
--data '{
"lowerBoundMinutes": 0,
"upperBoundMinutes": 0
}'
echo '{
"lowerBoundMinutes": 0,
"upperBoundMinutes": 0
}' | \
http PUT {{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType \
authorization:'' \
content-type:application/json
wget --quiet \
--method PUT \
--header 'authorization: ' \
--header 'content-type: application/json' \
--body-data '{\n "lowerBoundMinutes": 0,\n "upperBoundMinutes": 0\n}' \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType
import Foundation
let headers = [
"authorization": "",
"content-type": "application/json"
]
let parameters = [
"lowerBoundMinutes": 0,
"upperBoundMinutes": 0
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/ordertimes/:dayOfWeek/:serviceType")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Bad Request",
"errorCode": "ERR400"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Unauthorized. The client did not provide an authentication token or the token was invalid.",
"errorCode": "ERR401"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Forbidden"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
PUT
Add reason and comments to the response
{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification
HEADERS
Content-Type
QUERY PARAMS
tenant
restaurantId
id
BODY json
{
"comments": "",
"reason": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: ");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"comments\": \"\",\n \"reason\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification" {:content-type :json
:form-params {:comments ""
:reason ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification"
headers = HTTP::Headers{
"content-type" => ""
}
reqBody = "{\n \"comments\": \"\",\n \"reason\": \"\"\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}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification"),
Content = new StringContent("{\n \"comments\": \"\",\n \"reason\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "");
request.AddParameter("", "{\n \"comments\": \"\",\n \"reason\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification"
payload := strings.NewReader("{\n \"comments\": \"\",\n \"reason\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification HTTP/1.1
Content-Type:
Host: example.com
Content-Length: 36
{
"comments": "",
"reason": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification")
.setHeader("content-type", "")
.setBody("{\n \"comments\": \"\",\n \"reason\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification"))
.header("content-type", "")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"comments\": \"\",\n \"reason\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"reason\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification")
.put(body)
.addHeader("content-type", "")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification")
.header("content-type", "")
.body("{\n \"comments\": \"\",\n \"reason\": \"\"\n}")
.asString();
const data = JSON.stringify({
comments: '',
reason: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification');
xhr.setRequestHeader('content-type', '');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification',
headers: {'content-type': ''},
data: {comments: '', reason: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification';
const options = {
method: 'PUT',
headers: {'content-type': ''},
body: '{"comments":"","reason":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification',
method: 'PUT',
headers: {
'content-type': ''
},
processData: false,
data: '{\n "comments": "",\n "reason": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"comments\": \"\",\n \"reason\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification")
.put(body)
.addHeader("content-type", "")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification',
headers: {
'content-type': ''
}
};
const req = http.request(options, function (res) {
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({comments: '', reason: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification',
headers: {'content-type': ''},
body: {comments: '', reason: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification');
req.headers({
'content-type': ''
});
req.type('json');
req.send({
comments: '',
reason: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification',
headers: {'content-type': ''},
data: {comments: '', reason: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification';
const options = {
method: 'PUT',
headers: {'content-type': ''},
body: '{"comments":"","reason":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"" };
NSDictionary *parameters = @{ @"comments": @"",
@"reason": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification"]
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}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification" in
let headers = Header.add (Header.init ()) "content-type" "" in
let body = Cohttp_lwt_body.of_string "{\n \"comments\": \"\",\n \"reason\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification",
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([
'comments' => '',
'reason' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification', [
'body' => '{
"comments": "",
"reason": ""
}',
'headers' => [
'content-type' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => ''
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'comments' => '',
'reason' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'comments' => '',
'reason' => ''
]));
$request->setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'content-type' => ''
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification' -Method PUT -Headers $headers -ContentType '' -Body '{
"comments": "",
"reason": ""
}'
$headers=@{}
$headers.Add("content-type", "")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification' -Method PUT -Headers $headers -ContentType '' -Body '{
"comments": "",
"reason": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"comments\": \"\",\n \"reason\": \"\"\n}"
headers = { 'content-type': "" }
conn.request("PUT", "/baseUrl/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification"
payload = {
"comments": "",
"reason": ""
}
headers = {"content-type": ""}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification"
payload <- "{\n \"comments\": \"\",\n \"reason\": \"\"\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}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["content-type"] = ''
request.body = "{\n \"comments\": \"\",\n \"reason\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.put('/baseUrl/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification') do |req|
req.body = "{\n \"comments\": \"\",\n \"reason\": \"\"\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}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification";
let payload = json!({
"comments": "",
"reason": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "".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}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification \
--header 'content-type: ' \
--data '{
"comments": "",
"reason": ""
}'
echo '{
"comments": "",
"reason": ""
}' | \
http PUT {{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification \
content-type:''
wget --quiet \
--method PUT \
--header 'content-type: ' \
--body-data '{\n "comments": "",\n "reason": ""\n}' \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification
import Foundation
let headers = ["content-type": ""]
let parameters = [
"comments": "",
"reason": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse/justification")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Bad Request. Reason doesn't match any of the predefined values"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Unauthorized. The client did not provide an authentication token or the token was invalid.",
"errorCode": "ERR401"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Forbidden"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
GET
Get claims
{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims
QUERY PARAMS
tenant
restaurantId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims")
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims"
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}}/restaurants/:tenant/:restaurantId/customerclaims"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims"
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/restaurants/:tenant/:restaurantId/customerclaims HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims"))
.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}}/restaurants/:tenant/:restaurantId/customerclaims")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims")
.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}}/restaurants/:tenant/:restaurantId/customerclaims');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims';
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}}/restaurants/:tenant/:restaurantId/customerclaims',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/customerclaims',
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}}/restaurants/:tenant/:restaurantId/customerclaims'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims');
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}}/restaurants/:tenant/:restaurantId/customerclaims'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims';
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}}/restaurants/:tenant/:restaurantId/customerclaims"]
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}}/restaurants/:tenant/:restaurantId/customerclaims" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims",
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}}/restaurants/:tenant/:restaurantId/customerclaims');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/customerclaims")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims")
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/restaurants/:tenant/:restaurantId/customerclaims') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims";
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}}/restaurants/:tenant/:restaurantId/customerclaims
http GET {{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims")! 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
{
"claims": [
{
"currency": "GBP",
"expirationDate": "2020-05-22T14:22:11.1053368+00:00",
"friendlyOrderReference": "954226580",
"id": "z2749442-a62a-abcd-8623-04202878e034",
"issueType": "LateOrder",
"orderId": "z27tqoxdoeupdx9w8evorw",
"resolution": {
"decision": "Accepted",
"resolvedChannel": "OrderPad",
"resolvedDate": "2020-05-28T06:40:48.1053368+00:00",
"totalClaimedAccepted": 4000
},
"restaurantResponse": {
"decision": "Accepted",
"justification": null
},
"state": "Closed",
"submittedDate": "2020-05-20T14:22:11.1053368+00:00",
"totalClaimed": 4000
},
{
"affectedItems": [
{
"additionalContext": null,
"decision": "NotDecided",
"id": "NJ7iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc1",
"name": "Potato skin",
"quantity": 1,
"reference": "productid%4t56574596",
"totalClaimed": 1900,
"unitPrice": 2000
},
{
"additionalContext": null,
"decision": "NotDecided",
"id": "123iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc1",
"name": "Pizza",
"quantity": 1,
"reference": "productid%t5y6574596",
"totalClaimed": 1900,
"unitPrice": 2000
}
],
"currency": "GBP",
"expirationDate": "2020-05-22T14:22:11.1053368+00:00",
"friendlyOrderReference": "451226580",
"id": "2f749442-a62a-abcd-8623-04202878e034",
"issueType": "Damaged",
"orderId": "r23tqoxdoeupdx9w8evorw",
"resolution": null,
"restaurantResponse": null,
"state": "Open",
"submittedDate": "2020-05-20T14:22:11.1053368+00:00",
"totalClaimed": 3800
},
{
"affectedItems": [
{
"additionalContext": "Potato skin was cold",
"decision": "Rejected",
"id": "NJ7iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc1",
"name": "Potato skin",
"quantity": 1,
"reference": "productid%4t56574596",
"totalClaimed": 1900,
"unitPrice": 2000
}
],
"currency": "GBP",
"expirationDate": "2020-05-22T14:22:11.1053368+00:00",
"friendlyOrderReference": "151226580",
"id": "1f749442-a62a-abcd-8623-04202878e034",
"issueType": "Cold",
"orderId": "a23tqoxdoeupdx9w8evorw",
"resolution": {
"decision": "Rejected",
"resolvedChannel": "PartnerCentre",
"resolvedDate": "2020-05-28T06:40:48.1053368+00:00",
"totalClaimedAccepted": 0
},
"restaurantResponse": {
"items": [
{
"decision": "Rejected",
"id": "NJ7iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc1"
}
],
"justification": {
"comments": null,
"reason": "OrderWasHot"
}
},
"state": "Closed",
"submittedDate": "2020-05-20T14:22:11.1053368+00:00",
"totalClaimed": 1900
},
{
"affectedItems": [
{
"additionalContext": "Potato skin was cold",
"decision": "Accepted",
"id": "NJ7iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc1",
"name": "Potato skin",
"quantity": 1,
"reference": "productid%4t56574596",
"totalClaimed": 1900,
"unitPrice": 2000
}
],
"currency": "GBP",
"expirationDate": "2020-05-22T14:22:11.1053368+00:00",
"friendlyOrderReference": "951226580",
"id": "zf749442-a62a-abcd-8623-04202878e034",
"issueType": "Cold",
"orderId": "z23tqoxdoeupdx9w8evorw",
"resolution": {
"decision": "Accepted",
"resolvedChannel": "OrderPad",
"resolvedDate": "2020-05-28T06:40:48.1053368+00:00",
"totalClaimedAccepted": 1900
},
"restaurantResponse": {
"items": [
{
"decision": "Accepted",
"id": "NJ7iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc1"
}
],
"justification": null
},
"state": "Closed",
"submittedDate": "2020-05-20T14:22:11.1053368+00:00",
"totalClaimed": 1900
},
{
"affectedItems": [
{
"additionalContext": "Potato skin was cold",
"decision": "Accepted",
"id": "NJ7iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc1",
"name": "Potato skin",
"quantity": 1,
"reference": "productid%4t56574596",
"totalClaimed": 1900,
"unitPrice": 2000
},
{
"additionalContext": "Meat was terribly cold",
"decision": "Rejected",
"id": "NJ7iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc3",
"name": "Meat",
"quantity": 1,
"reference": "productid%4t56574593",
"totalClaimed": 2900,
"unitPrice": 3000
}
],
"currency": "GBP",
"expirationDate": "2020-05-22T14:22:11.1053368+00:00",
"friendlyOrderReference": "951226588",
"id": "zf749442-a62a-abcd-8623-04202878e038",
"issueType": "Cold",
"orderId": "z23tqoxdoeupdx9w8evorz",
"resolution": {
"decision": "PartiallyAccepted",
"resolvedChannel": "OrderPad",
"resolvedDate": "2020-05-28T06:40:48.1053368+00:00",
"totalClaimedAccepted": 1900
},
"restaurantResponse": {
"items": [
{
"decision": "Accepted",
"id": "NJ7iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc1"
},
{
"decision": "Rejected",
"id": "NJ7iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc3"
}
],
"justification": null
},
"state": "Closed",
"submittedDate": "2020-05-20T14:22:11.1053368+00:00",
"totalClaimed": 1900
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Bad Request. End date limiter should have date-time format."
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Unauthorized. The client did not provide an authentication token or the token was invalid.",
"errorCode": "ERR401"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Forbidden"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
GET
Get order claim
{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id
QUERY PARAMS
tenant
restaurantId
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id")
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/: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}}/restaurants/:tenant/:restaurantId/customerclaims/:id"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/: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/restaurants/:tenant/:restaurantId/customerclaims/:id HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/: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}}/restaurants/:tenant/:restaurantId/customerclaims/:id")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/: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}}/restaurants/:tenant/:restaurantId/customerclaims/:id');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/: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}}/restaurants/:tenant/:restaurantId/customerclaims/:id',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/customerclaims/: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}}/restaurants/:tenant/:restaurantId/customerclaims/: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}}/restaurants/:tenant/:restaurantId/customerclaims/: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}}/restaurants/:tenant/:restaurantId/customerclaims/:id'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/: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}}/restaurants/:tenant/:restaurantId/customerclaims/: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}}/restaurants/:tenant/:restaurantId/customerclaims/:id" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/: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}}/restaurants/:tenant/:restaurantId/customerclaims/:id');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/customerclaims/:id")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/: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/restaurants/:tenant/:restaurantId/customerclaims/:id') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/: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}}/restaurants/:tenant/:restaurantId/customerclaims/:id
http GET {{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/: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
{
"affectedItems": [
{
"additionalContext": "Potato skin was damaged",
"decision": "Rejected",
"id": "NJ7iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc1",
"name": "Potato skin",
"quantity": 1,
"reference": "productid%4t56574596",
"totalClaimed": 1900,
"unitPrice": 2000
},
{
"additionalContext": "Pizza was damaged too",
"decision": "Accepted",
"id": "123iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc1",
"name": "Pizza",
"quantity": 1,
"reference": "productid%t5y6574596",
"totalClaimed": 1900,
"unitPrice": 2000
}
],
"currency": "GBP",
"expirationDate": "2020-05-22T14:22:11.1053368+00:00",
"friendlyOrderReference": "451226580",
"id": "2f749442-a62a-abcd-8623-04202878e034",
"issueType": "Damaged",
"orderId": "r23tqoxdoeupdx9w8evorw",
"resolution": {
"decision": "PartiallyAccepted",
"resolvedChannel": "PartnerCentre",
"resolvedDate": "2020-05-28T06:40:48.1053368+00:00",
"totalClaimedAccepted": 1900
},
"restaurantResponse": {
"decision": "PartiallyAccepted",
"items": [
{
"decision": "Rejected",
"id": "NJ7iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc1"
},
{
"decision": "Accepted",
"id": "123iYXNrZXRJdGVtLTM2NTc0GTk2LTMwNDY2LXMzOWJxb3hkb2V1cGR4OXc4ZXZvcnc1"
}
],
"justification": {
"comments": "The food was packed properly",
"reason": "Other"
}
},
"state": "Closed",
"submittedDate": "2020-05-20T14:22:11.1053368+00:00",
"totalClaimed": 3800
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Unauthorized. The client did not provide an authentication token or the token was invalid.",
"errorCode": "ERR401"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Forbidden"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
POST
Submit a restaurant response for the claim
{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse
HEADERS
Content-Type
QUERY PARAMS
tenant
restaurantId
id
BODY json
{
"decision": "",
"items": [
{
"decision": "",
"id": ""
}
],
"justification": {
"comments": "",
"reason": ""
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "content-type: ");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse" {:content-type :json
:form-params {:decision ""
:items [{:decision ""
:id ""}]
:justification {:comments ""
:reason ""}}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse"
headers = HTTP::Headers{
"content-type" => ""
}
reqBody = "{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\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}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse"),
Content = new StringContent("{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\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}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "");
request.AddParameter("", "{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse"
payload := strings.NewReader("{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("content-type", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse HTTP/1.1
Content-Type:
Host: example.com
Content-Length: 150
{
"decision": "",
"items": [
{
"decision": "",
"id": ""
}
],
"justification": {
"comments": "",
"reason": ""
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse")
.setHeader("content-type", "")
.setBody("{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse"))
.header("content-type", "")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\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 \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse")
.post(body)
.addHeader("content-type", "")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse")
.header("content-type", "")
.body("{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\n }\n}")
.asString();
const data = JSON.stringify({
decision: '',
items: [
{
decision: '',
id: ''
}
],
justification: {
comments: '',
reason: ''
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse');
xhr.setRequestHeader('content-type', '');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse',
headers: {'content-type': ''},
data: {
decision: '',
items: [{decision: '', id: ''}],
justification: {comments: '', reason: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse';
const options = {
method: 'POST',
headers: {'content-type': ''},
body: '{"decision":"","items":[{"decision":"","id":""}],"justification":{"comments":"","reason":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse',
method: 'POST',
headers: {
'content-type': ''
},
processData: false,
data: '{\n "decision": "",\n "items": [\n {\n "decision": "",\n "id": ""\n }\n ],\n "justification": {\n "comments": "",\n "reason": ""\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 \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse")
.post(body)
.addHeader("content-type", "")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse',
headers: {
'content-type': ''
}
};
const req = http.request(options, function (res) {
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({
decision: '',
items: [{decision: '', id: ''}],
justification: {comments: '', reason: ''}
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse',
headers: {'content-type': ''},
body: {
decision: '',
items: [{decision: '', id: ''}],
justification: {comments: '', reason: ''}
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse');
req.headers({
'content-type': ''
});
req.type('json');
req.send({
decision: '',
items: [
{
decision: '',
id: ''
}
],
justification: {
comments: '',
reason: ''
}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse',
headers: {'content-type': ''},
data: {
decision: '',
items: [{decision: '', id: ''}],
justification: {comments: '', reason: ''}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse';
const options = {
method: 'POST',
headers: {'content-type': ''},
body: '{"decision":"","items":[{"decision":"","id":""}],"justification":{"comments":"","reason":""}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"content-type": @"" };
NSDictionary *parameters = @{ @"decision": @"",
@"items": @[ @{ @"decision": @"", @"id": @"" } ],
@"justification": @{ @"comments": @"", @"reason": @"" } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse"]
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}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse" in
let headers = Header.add (Header.init ()) "content-type" "" in
let body = Cohttp_lwt_body.of_string "{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\n }\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse",
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([
'decision' => '',
'items' => [
[
'decision' => '',
'id' => ''
]
],
'justification' => [
'comments' => '',
'reason' => ''
]
]),
CURLOPT_HTTPHEADER => [
"content-type: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse', [
'body' => '{
"decision": "",
"items": [
{
"decision": "",
"id": ""
}
],
"justification": {
"comments": "",
"reason": ""
}
}',
'headers' => [
'content-type' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => ''
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'decision' => '',
'items' => [
[
'decision' => '',
'id' => ''
]
],
'justification' => [
'comments' => '',
'reason' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'decision' => '',
'items' => [
[
'decision' => '',
'id' => ''
]
],
'justification' => [
'comments' => '',
'reason' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'content-type' => ''
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("content-type", "")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse' -Method POST -Headers $headers -ContentType '' -Body '{
"decision": "",
"items": [
{
"decision": "",
"id": ""
}
],
"justification": {
"comments": "",
"reason": ""
}
}'
$headers=@{}
$headers.Add("content-type", "")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse' -Method POST -Headers $headers -ContentType '' -Body '{
"decision": "",
"items": [
{
"decision": "",
"id": ""
}
],
"justification": {
"comments": "",
"reason": ""
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\n }\n}"
headers = { 'content-type': "" }
conn.request("POST", "/baseUrl/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse"
payload = {
"decision": "",
"items": [
{
"decision": "",
"id": ""
}
],
"justification": {
"comments": "",
"reason": ""
}
}
headers = {"content-type": ""}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse"
payload <- "{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\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}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["content-type"] = ''
request.body = "{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse') do |req|
req.body = "{\n \"decision\": \"\",\n \"items\": [\n {\n \"decision\": \"\",\n \"id\": \"\"\n }\n ],\n \"justification\": {\n \"comments\": \"\",\n \"reason\": \"\"\n }\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse";
let payload = json!({
"decision": "",
"items": (
json!({
"decision": "",
"id": ""
})
),
"justification": json!({
"comments": "",
"reason": ""
})
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "".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}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse \
--header 'content-type: ' \
--data '{
"decision": "",
"items": [
{
"decision": "",
"id": ""
}
],
"justification": {
"comments": "",
"reason": ""
}
}'
echo '{
"decision": "",
"items": [
{
"decision": "",
"id": ""
}
],
"justification": {
"comments": "",
"reason": ""
}
}' | \
http POST {{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse \
content-type:''
wget --quiet \
--method POST \
--header 'content-type: ' \
--body-data '{\n "decision": "",\n "items": [\n {\n "decision": "",\n "id": ""\n }\n ],\n "justification": {\n "comments": "",\n "reason": ""\n }\n}' \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse
import Foundation
let headers = ["content-type": ""]
let parameters = [
"decision": "",
"items": [
[
"decision": "",
"id": ""
]
],
"justification": [
"comments": "",
"reason": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/customerclaims/:id/restaurantresponse")! 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
{
"errors": [
{
"description": "Bad Request. Incorrect decision",
"errorCode": "IncorrectDecision"
},
{
"description": "Bad Request. Missing decision",
"errorCode": "MissingDecision"
},
{
"description": "Bad Request. The request you are sending is missing some items for the claim you are trying to resolve",
"errorCode": "MissingItems"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Unauthorized. The client did not provide an authentication token or the token was invalid.",
"errorCode": "ERR401"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Forbidden"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "The claim you are attempting to resolve is has been resolved",
"errorCode": "AlreadyResolved"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "The claim you are attempting to update does not contain the items from the request",
"errorCode": "WrongItems"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
POST
Create Offline Event
{{baseUrl}}/v1/:tenant/restaurants/event/offline
HEADERS
X-JE-Requester
X-JE-User-Role
QUERY PARAMS
tenant
BODY json
{
"allowRestaurantOverride": false,
"category": "",
"duration": "",
"endDate": "",
"legacyTempOfflineType": "",
"name": "",
"reason": "",
"restaurantIds": "",
"startDate": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:tenant/restaurants/event/offline");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-je-requester: ");
headers = curl_slist_append(headers, "x-je-user-role: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/v1/:tenant/restaurants/event/offline" {:headers {:x-je-requester ""
:x-je-user-role ""}
:content-type :json
:form-params {:allowRestaurantOverride false
:category ""
:duration ""
:endDate ""
:legacyTempOfflineType ""
:name ""
:reason ""
:restaurantIds ""
:startDate ""}})
require "http/client"
url = "{{baseUrl}}/v1/:tenant/restaurants/event/offline"
headers = HTTP::Headers{
"x-je-requester" => ""
"x-je-user-role" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/v1/:tenant/restaurants/event/offline"),
Headers =
{
{ "x-je-requester", "" },
{ "x-je-user-role", "" },
},
Content = new StringContent("{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:tenant/restaurants/event/offline");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-je-requester", "");
request.AddHeader("x-je-user-role", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:tenant/restaurants/event/offline"
payload := strings.NewReader("{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-je-requester", "")
req.Header.Add("x-je-user-role", "")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/v1/:tenant/restaurants/event/offline HTTP/1.1
X-Je-Requester:
X-Je-User-Role:
Content-Type: application/json
Host: example.com
Content-Length: 194
{
"allowRestaurantOverride": false,
"category": "",
"duration": "",
"endDate": "",
"legacyTempOfflineType": "",
"name": "",
"reason": "",
"restaurantIds": "",
"startDate": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/v1/:tenant/restaurants/event/offline")
.setHeader("x-je-requester", "")
.setHeader("x-je-user-role", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:tenant/restaurants/event/offline"))
.header("x-je-requester", "")
.header("x-je-user-role", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\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 \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:tenant/restaurants/event/offline")
.post(body)
.addHeader("x-je-requester", "")
.addHeader("x-je-user-role", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/v1/:tenant/restaurants/event/offline")
.header("x-je-requester", "")
.header("x-je-user-role", "")
.header("content-type", "application/json")
.body("{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}")
.asString();
const data = JSON.stringify({
allowRestaurantOverride: false,
category: '',
duration: '',
endDate: '',
legacyTempOfflineType: '',
name: '',
reason: '',
restaurantIds: '',
startDate: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/v1/:tenant/restaurants/event/offline');
xhr.setRequestHeader('x-je-requester', '');
xhr.setRequestHeader('x-je-user-role', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:tenant/restaurants/event/offline',
headers: {'x-je-requester': '', 'x-je-user-role': '', 'content-type': 'application/json'},
data: {
allowRestaurantOverride: false,
category: '',
duration: '',
endDate: '',
legacyTempOfflineType: '',
name: '',
reason: '',
restaurantIds: '',
startDate: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:tenant/restaurants/event/offline';
const options = {
method: 'POST',
headers: {'x-je-requester': '', 'x-je-user-role': '', 'content-type': 'application/json'},
body: '{"allowRestaurantOverride":false,"category":"","duration":"","endDate":"","legacyTempOfflineType":"","name":"","reason":"","restaurantIds":"","startDate":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/:tenant/restaurants/event/offline',
method: 'POST',
headers: {
'x-je-requester': '',
'x-je-user-role': '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "allowRestaurantOverride": false,\n "category": "",\n "duration": "",\n "endDate": "",\n "legacyTempOfflineType": "",\n "name": "",\n "reason": "",\n "restaurantIds": "",\n "startDate": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/v1/:tenant/restaurants/event/offline")
.post(body)
.addHeader("x-je-requester", "")
.addHeader("x-je-user-role", "")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:tenant/restaurants/event/offline',
headers: {
'x-je-requester': '',
'x-je-user-role': '',
'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({
allowRestaurantOverride: false,
category: '',
duration: '',
endDate: '',
legacyTempOfflineType: '',
name: '',
reason: '',
restaurantIds: '',
startDate: ''
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:tenant/restaurants/event/offline',
headers: {'x-je-requester': '', 'x-je-user-role': '', 'content-type': 'application/json'},
body: {
allowRestaurantOverride: false,
category: '',
duration: '',
endDate: '',
legacyTempOfflineType: '',
name: '',
reason: '',
restaurantIds: '',
startDate: ''
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/v1/:tenant/restaurants/event/offline');
req.headers({
'x-je-requester': '',
'x-je-user-role': '',
'content-type': 'application/json'
});
req.type('json');
req.send({
allowRestaurantOverride: false,
category: '',
duration: '',
endDate: '',
legacyTempOfflineType: '',
name: '',
reason: '',
restaurantIds: '',
startDate: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/v1/:tenant/restaurants/event/offline',
headers: {'x-je-requester': '', 'x-je-user-role': '', 'content-type': 'application/json'},
data: {
allowRestaurantOverride: false,
category: '',
duration: '',
endDate: '',
legacyTempOfflineType: '',
name: '',
reason: '',
restaurantIds: '',
startDate: ''
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:tenant/restaurants/event/offline';
const options = {
method: 'POST',
headers: {'x-je-requester': '', 'x-je-user-role': '', 'content-type': 'application/json'},
body: '{"allowRestaurantOverride":false,"category":"","duration":"","endDate":"","legacyTempOfflineType":"","name":"","reason":"","restaurantIds":"","startDate":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-je-requester": @"",
@"x-je-user-role": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"allowRestaurantOverride": @NO,
@"category": @"",
@"duration": @"",
@"endDate": @"",
@"legacyTempOfflineType": @"",
@"name": @"",
@"reason": @"",
@"restaurantIds": @"",
@"startDate": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:tenant/restaurants/event/offline"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:tenant/restaurants/event/offline" in
let headers = Header.add_list (Header.init ()) [
("x-je-requester", "");
("x-je-user-role", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:tenant/restaurants/event/offline",
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([
'allowRestaurantOverride' => null,
'category' => '',
'duration' => '',
'endDate' => '',
'legacyTempOfflineType' => '',
'name' => '',
'reason' => '',
'restaurantIds' => '',
'startDate' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-je-requester: ",
"x-je-user-role: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/v1/:tenant/restaurants/event/offline', [
'body' => '{
"allowRestaurantOverride": false,
"category": "",
"duration": "",
"endDate": "",
"legacyTempOfflineType": "",
"name": "",
"reason": "",
"restaurantIds": "",
"startDate": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-je-requester' => '',
'x-je-user-role' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:tenant/restaurants/event/offline');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-je-requester' => '',
'x-je-user-role' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'allowRestaurantOverride' => null,
'category' => '',
'duration' => '',
'endDate' => '',
'legacyTempOfflineType' => '',
'name' => '',
'reason' => '',
'restaurantIds' => '',
'startDate' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'allowRestaurantOverride' => null,
'category' => '',
'duration' => '',
'endDate' => '',
'legacyTempOfflineType' => '',
'name' => '',
'reason' => '',
'restaurantIds' => '',
'startDate' => ''
]));
$request->setRequestUrl('{{baseUrl}}/v1/:tenant/restaurants/event/offline');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-je-requester' => '',
'x-je-user-role' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-je-requester", "")
$headers.Add("x-je-user-role", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:tenant/restaurants/event/offline' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"allowRestaurantOverride": false,
"category": "",
"duration": "",
"endDate": "",
"legacyTempOfflineType": "",
"name": "",
"reason": "",
"restaurantIds": "",
"startDate": ""
}'
$headers=@{}
$headers.Add("x-je-requester", "")
$headers.Add("x-je-user-role", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:tenant/restaurants/event/offline' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"allowRestaurantOverride": false,
"category": "",
"duration": "",
"endDate": "",
"legacyTempOfflineType": "",
"name": "",
"reason": "",
"restaurantIds": "",
"startDate": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}"
headers = {
'x-je-requester': "",
'x-je-user-role': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/v1/:tenant/restaurants/event/offline", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:tenant/restaurants/event/offline"
payload = {
"allowRestaurantOverride": False,
"category": "",
"duration": "",
"endDate": "",
"legacyTempOfflineType": "",
"name": "",
"reason": "",
"restaurantIds": "",
"startDate": ""
}
headers = {
"x-je-requester": "",
"x-je-user-role": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:tenant/restaurants/event/offline"
payload <- "{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-je-requester' = '', 'x-je-user-role' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:tenant/restaurants/event/offline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-je-requester"] = ''
request["x-je-user-role"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/v1/:tenant/restaurants/event/offline') do |req|
req.headers['x-je-requester'] = ''
req.headers['x-je-user-role'] = ''
req.body = "{\n \"allowRestaurantOverride\": false,\n \"category\": \"\",\n \"duration\": \"\",\n \"endDate\": \"\",\n \"legacyTempOfflineType\": \"\",\n \"name\": \"\",\n \"reason\": \"\",\n \"restaurantIds\": \"\",\n \"startDate\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:tenant/restaurants/event/offline";
let payload = json!({
"allowRestaurantOverride": false,
"category": "",
"duration": "",
"endDate": "",
"legacyTempOfflineType": "",
"name": "",
"reason": "",
"restaurantIds": "",
"startDate": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-je-requester", "".parse().unwrap());
headers.insert("x-je-user-role", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/v1/:tenant/restaurants/event/offline \
--header 'content-type: application/json' \
--header 'x-je-requester: ' \
--header 'x-je-user-role: ' \
--data '{
"allowRestaurantOverride": false,
"category": "",
"duration": "",
"endDate": "",
"legacyTempOfflineType": "",
"name": "",
"reason": "",
"restaurantIds": "",
"startDate": ""
}'
echo '{
"allowRestaurantOverride": false,
"category": "",
"duration": "",
"endDate": "",
"legacyTempOfflineType": "",
"name": "",
"reason": "",
"restaurantIds": "",
"startDate": ""
}' | \
http POST {{baseUrl}}/v1/:tenant/restaurants/event/offline \
content-type:application/json \
x-je-requester:'' \
x-je-user-role:''
wget --quiet \
--method POST \
--header 'x-je-requester: ' \
--header 'x-je-user-role: ' \
--header 'content-type: application/json' \
--body-data '{\n "allowRestaurantOverride": false,\n "category": "",\n "duration": "",\n "endDate": "",\n "legacyTempOfflineType": "",\n "name": "",\n "reason": "",\n "restaurantIds": "",\n "startDate": ""\n}' \
--output-document \
- {{baseUrl}}/v1/:tenant/restaurants/event/offline
import Foundation
let headers = [
"x-je-requester": "",
"x-je-user-role": "",
"content-type": "application/json"
]
let parameters = [
"allowRestaurantOverride": false,
"category": "",
"duration": "",
"endDate": "",
"legacyTempOfflineType": "",
"name": "",
"reason": "",
"restaurantIds": "",
"startDate": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:tenant/restaurants/event/offline")! 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
{
"restaurantEventId": "03bff206-d136-405f-b789-95190e9711a4",
"restaurantIds": "12345"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
[
{
"attemptedValue": null,
"customState": null,
"errorCode": "NotEmptyValidator",
"errorMessage": "TestProperty is empty",
"formattedMessageArguments": [],
"formattedMessagePlaceHolderValues": {
"PropertyName": "User Role",
"PropertyValue": null
},
"propertyName": "TestProperty",
"resourceName": null,
"severity": 0
}
]
DELETE
Delete Offline Event
{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline
HEADERS
X-JE-Requester
X-JE-User-Role
QUERY PARAMS
tenant
id
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-je-requester: ");
headers = curl_slist_append(headers, "x-je-user-role: ");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline" {:headers {:x-je-requester ""
:x-je-user-role ""}})
require "http/client"
url = "{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline"
headers = HTTP::Headers{
"x-je-requester" => ""
"x-je-user-role" => ""
}
response = HTTP::Client.delete url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline"),
Headers =
{
{ "x-je-requester", "" },
{ "x-je-user-role", "" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline");
var request = new RestRequest("", Method.Delete);
request.AddHeader("x-je-requester", "");
request.AddHeader("x-je-user-role", "");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-je-requester", "")
req.Header.Add("x-je-user-role", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/v1/:tenant/restaurants/:id/event/offline HTTP/1.1
X-Je-Requester:
X-Je-User-Role:
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline")
.setHeader("x-je-requester", "")
.setHeader("x-je-user-role", "")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline"))
.header("x-je-requester", "")
.header("x-je-user-role", "")
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline")
.delete(null)
.addHeader("x-je-requester", "")
.addHeader("x-je-user-role", "")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline")
.header("x-je-requester", "")
.header("x-je-user-role", "")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline');
xhr.setRequestHeader('x-je-requester', '');
xhr.setRequestHeader('x-je-user-role', '');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline',
headers: {'x-je-requester': '', 'x-je-user-role': ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline';
const options = {method: 'DELETE', headers: {'x-je-requester': '', 'x-je-user-role': ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline',
method: 'DELETE',
headers: {
'x-je-requester': '',
'x-je-user-role': ''
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline")
.delete(null)
.addHeader("x-je-requester", "")
.addHeader("x-je-user-role", "")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/v1/:tenant/restaurants/:id/event/offline',
headers: {
'x-je-requester': '',
'x-je-user-role': ''
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline',
headers: {'x-je-requester': '', 'x-je-user-role': ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline');
req.headers({
'x-je-requester': '',
'x-je-user-role': ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline',
headers: {'x-je-requester': '', 'x-je-user-role': ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline';
const options = {method: 'DELETE', headers: {'x-je-requester': '', 'x-je-user-role': ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-je-requester": @"",
@"x-je-user-role": @"" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline" in
let headers = Header.add_list (Header.init ()) [
("x-je-requester", "");
("x-je-user-role", "");
] in
Client.call ~headers `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"x-je-requester: ",
"x-je-user-role: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline', [
'headers' => [
'x-je-requester' => '',
'x-je-user-role' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'x-je-requester' => '',
'x-je-user-role' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline');
$request->setRequestMethod('DELETE');
$request->setHeaders([
'x-je-requester' => '',
'x-je-user-role' => ''
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-je-requester", "")
$headers.Add("x-je-user-role", "")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline' -Method DELETE -Headers $headers
$headers=@{}
$headers.Add("x-je-requester", "")
$headers.Add("x-je-user-role", "")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline' -Method DELETE -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = {
'x-je-requester': "",
'x-je-user-role': ""
}
conn.request("DELETE", "/baseUrl/v1/:tenant/restaurants/:id/event/offline", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline"
headers = {
"x-je-requester": "",
"x-je-user-role": ""
}
response = requests.delete(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline"
response <- VERB("DELETE", url, add_headers('x-je-requester' = '', 'x-je-user-role' = ''), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["x-je-requester"] = ''
request["x-je-user-role"] = ''
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/v1/:tenant/restaurants/:id/event/offline') do |req|
req.headers['x-je-requester'] = ''
req.headers['x-je-user-role'] = ''
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-je-requester", "".parse().unwrap());
headers.insert("x-je-user-role", "".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/v1/:tenant/restaurants/:id/event/offline \
--header 'x-je-requester: ' \
--header 'x-je-user-role: '
http DELETE {{baseUrl}}/v1/:tenant/restaurants/:id/event/offline \
x-je-requester:'' \
x-je-user-role:''
wget --quiet \
--method DELETE \
--header 'x-je-requester: ' \
--header 'x-je-user-role: ' \
--output-document \
- {{baseUrl}}/v1/:tenant/restaurants/:id/event/offline
import Foundation
let headers = [
"x-je-requester": "",
"x-je-user-role": ""
]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/v1/:tenant/restaurants/:id/event/offline")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as 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
[
{
"attemptedValue": null,
"customState": null,
"errorCode": "NotEmptyValidator",
"errorMessage": "TestProperty is empty",
"formattedMessageArguments": [],
"formattedMessagePlaceHolderValues": {
"PropertyName": "User Role",
"PropertyValue": null
},
"propertyName": "TestProperty",
"resourceName": null,
"severity": 0
}
]
PUT
Restaurant Offline Status
{{baseUrl}}/restaurant-offline-status
BODY json
{
"AllowRestaurantOverride": false,
"IsOffline": false,
"RestaurantId": "",
"Tenant": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurant-offline-status");
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 \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/restaurant-offline-status" {:content-type :json
:form-params {:AllowRestaurantOverride false
:IsOffline true
:RestaurantId "123456"
:Tenant "uk"}})
require "http/client"
url = "{{baseUrl}}/restaurant-offline-status"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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}}/restaurant-offline-status"),
Content = new StringContent("{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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}}/restaurant-offline-status");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurant-offline-status"
payload := strings.NewReader("{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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/restaurant-offline-status HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 105
{
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/restaurant-offline-status")
.setHeader("content-type", "application/json")
.setBody("{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurant-offline-status"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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 \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/restaurant-offline-status")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/restaurant-offline-status")
.header("content-type", "application/json")
.body("{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}")
.asString();
const data = JSON.stringify({
AllowRestaurantOverride: false,
IsOffline: true,
RestaurantId: '123456',
Tenant: 'uk'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/restaurant-offline-status');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurant-offline-status',
headers: {'content-type': 'application/json'},
data: {
AllowRestaurantOverride: false,
IsOffline: true,
RestaurantId: '123456',
Tenant: 'uk'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurant-offline-status';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"AllowRestaurantOverride":false,"IsOffline":true,"RestaurantId":"123456","Tenant":"uk"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/restaurant-offline-status',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "AllowRestaurantOverride": false,\n "IsOffline": true,\n "RestaurantId": "123456",\n "Tenant": "uk"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/restaurant-offline-status")
.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/restaurant-offline-status',
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({
AllowRestaurantOverride: false,
IsOffline: true,
RestaurantId: '123456',
Tenant: 'uk'
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurant-offline-status',
headers: {'content-type': 'application/json'},
body: {
AllowRestaurantOverride: false,
IsOffline: true,
RestaurantId: '123456',
Tenant: 'uk'
},
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}}/restaurant-offline-status');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
AllowRestaurantOverride: false,
IsOffline: true,
RestaurantId: '123456',
Tenant: 'uk'
});
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}}/restaurant-offline-status',
headers: {'content-type': 'application/json'},
data: {
AllowRestaurantOverride: false,
IsOffline: true,
RestaurantId: '123456',
Tenant: 'uk'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurant-offline-status';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"AllowRestaurantOverride":false,"IsOffline":true,"RestaurantId":"123456","Tenant":"uk"}'
};
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 = @{ @"AllowRestaurantOverride": @NO,
@"IsOffline": @YES,
@"RestaurantId": @"123456",
@"Tenant": @"uk" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/restaurant-offline-status"]
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}}/restaurant-offline-status" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurant-offline-status",
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([
'AllowRestaurantOverride' => null,
'IsOffline' => null,
'RestaurantId' => '123456',
'Tenant' => 'uk'
]),
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}}/restaurant-offline-status', [
'body' => '{
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/restaurant-offline-status');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'AllowRestaurantOverride' => null,
'IsOffline' => null,
'RestaurantId' => '123456',
'Tenant' => 'uk'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'AllowRestaurantOverride' => null,
'IsOffline' => null,
'RestaurantId' => '123456',
'Tenant' => 'uk'
]));
$request->setRequestUrl('{{baseUrl}}/restaurant-offline-status');
$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}}/restaurant-offline-status' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurant-offline-status' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/restaurant-offline-status", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurant-offline-status"
payload = {
"AllowRestaurantOverride": False,
"IsOffline": True,
"RestaurantId": "123456",
"Tenant": "uk"
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurant-offline-status"
payload <- "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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}}/restaurant-offline-status")
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 \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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/restaurant-offline-status') do |req|
req.body = "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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}}/restaurant-offline-status";
let payload = json!({
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
});
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}}/restaurant-offline-status \
--header 'content-type: application/json' \
--data '{
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
}'
echo '{
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
}' | \
http PUT {{baseUrl}}/restaurant-offline-status \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "AllowRestaurantOverride": false,\n "IsOffline": true,\n "RestaurantId": "123456",\n "Tenant": "uk"\n}' \
--output-document \
- {{baseUrl}}/restaurant-offline-status
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurant-offline-status")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Restaurant Online Status
{{baseUrl}}/restaurant-online-status
BODY json
{
"AllowRestaurantOverride": false,
"IsOffline": false,
"RestaurantId": "",
"Tenant": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurant-online-status");
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 \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/restaurant-online-status" {:content-type :json
:form-params {:AllowRestaurantOverride false
:IsOffline true
:RestaurantId "123456"
:Tenant "uk"}})
require "http/client"
url = "{{baseUrl}}/restaurant-online-status"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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}}/restaurant-online-status"),
Content = new StringContent("{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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}}/restaurant-online-status");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurant-online-status"
payload := strings.NewReader("{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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/restaurant-online-status HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 105
{
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/restaurant-online-status")
.setHeader("content-type", "application/json")
.setBody("{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurant-online-status"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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 \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/restaurant-online-status")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/restaurant-online-status")
.header("content-type", "application/json")
.body("{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}")
.asString();
const data = JSON.stringify({
AllowRestaurantOverride: false,
IsOffline: true,
RestaurantId: '123456',
Tenant: 'uk'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/restaurant-online-status');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurant-online-status',
headers: {'content-type': 'application/json'},
data: {
AllowRestaurantOverride: false,
IsOffline: true,
RestaurantId: '123456',
Tenant: 'uk'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurant-online-status';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"AllowRestaurantOverride":false,"IsOffline":true,"RestaurantId":"123456","Tenant":"uk"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/restaurant-online-status',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "AllowRestaurantOverride": false,\n "IsOffline": true,\n "RestaurantId": "123456",\n "Tenant": "uk"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/restaurant-online-status")
.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/restaurant-online-status',
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({
AllowRestaurantOverride: false,
IsOffline: true,
RestaurantId: '123456',
Tenant: 'uk'
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurant-online-status',
headers: {'content-type': 'application/json'},
body: {
AllowRestaurantOverride: false,
IsOffline: true,
RestaurantId: '123456',
Tenant: 'uk'
},
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}}/restaurant-online-status');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
AllowRestaurantOverride: false,
IsOffline: true,
RestaurantId: '123456',
Tenant: 'uk'
});
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}}/restaurant-online-status',
headers: {'content-type': 'application/json'},
data: {
AllowRestaurantOverride: false,
IsOffline: true,
RestaurantId: '123456',
Tenant: 'uk'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurant-online-status';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"AllowRestaurantOverride":false,"IsOffline":true,"RestaurantId":"123456","Tenant":"uk"}'
};
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 = @{ @"AllowRestaurantOverride": @NO,
@"IsOffline": @YES,
@"RestaurantId": @"123456",
@"Tenant": @"uk" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/restaurant-online-status"]
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}}/restaurant-online-status" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurant-online-status",
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([
'AllowRestaurantOverride' => null,
'IsOffline' => null,
'RestaurantId' => '123456',
'Tenant' => 'uk'
]),
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}}/restaurant-online-status', [
'body' => '{
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/restaurant-online-status');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'AllowRestaurantOverride' => null,
'IsOffline' => null,
'RestaurantId' => '123456',
'Tenant' => 'uk'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'AllowRestaurantOverride' => null,
'IsOffline' => null,
'RestaurantId' => '123456',
'Tenant' => 'uk'
]));
$request->setRequestUrl('{{baseUrl}}/restaurant-online-status');
$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}}/restaurant-online-status' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurant-online-status' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/restaurant-online-status", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurant-online-status"
payload = {
"AllowRestaurantOverride": False,
"IsOffline": True,
"RestaurantId": "123456",
"Tenant": "uk"
}
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurant-online-status"
payload <- "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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}}/restaurant-online-status")
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 \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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/restaurant-online-status') do |req|
req.body = "{\n \"AllowRestaurantOverride\": false,\n \"IsOffline\": true,\n \"RestaurantId\": \"123456\",\n \"Tenant\": \"uk\"\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}}/restaurant-online-status";
let payload = json!({
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
});
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}}/restaurant-online-status \
--header 'content-type: application/json' \
--data '{
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
}'
echo '{
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
}' | \
http PUT {{baseUrl}}/restaurant-online-status \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "AllowRestaurantOverride": false,\n "IsOffline": true,\n "RestaurantId": "123456",\n "Tenant": "uk"\n}' \
--output-document \
- {{baseUrl}}/restaurant-online-status
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"AllowRestaurantOverride": false,
"IsOffline": true,
"RestaurantId": "123456",
"Tenant": "uk"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurant-online-status")! 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()
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/menu-ingestion-complete");
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 \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/menu-ingestion-complete" {:content-type :json
:form-params {:correlationId "64bef5ee-7265-47f8-9aee-28bc74f00b13"
:fault {:errors [{:code "123"
:description "Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"} {:code "145"
:description "Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"}]
:id "70e307df-0156-4d3c-ab92-dd57a103350b"}
:restaurantId "123456"
:result "fail"
:tenant "uk"
:timestamp "2020-01-01T00:00:00Z"}})
require "http/client"
url = "{{baseUrl}}/menu-ingestion-complete"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\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}}/menu-ingestion-complete"),
Content = new StringContent("{\n \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\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}}/menu-ingestion-complete");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/menu-ingestion-complete"
payload := strings.NewReader("{\n \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\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/menu-ingestion-complete HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 592
{
"correlationId": "64bef5ee-7265-47f8-9aee-28bc74f00b13",
"fault": {
"errors": [
{
"code": "123",
"description": "Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"
},
{
"code": "145",
"description": "Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"
}
],
"id": "70e307df-0156-4d3c-ab92-dd57a103350b"
},
"restaurantId": "123456",
"result": "fail",
"tenant": "uk",
"timestamp": "2020-01-01T00:00:00Z"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/menu-ingestion-complete")
.setHeader("content-type", "application/json")
.setBody("{\n \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/menu-ingestion-complete"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\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 \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/menu-ingestion-complete")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/menu-ingestion-complete")
.header("content-type", "application/json")
.body("{\n \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\n}")
.asString();
const data = JSON.stringify({
correlationId: '64bef5ee-7265-47f8-9aee-28bc74f00b13',
fault: {
errors: [
{
code: '123',
description: 'Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability'
},
{
code: '145',
description: 'Invalid availability ID: menu-105369-availabilities - availability IDs must be integers'
}
],
id: '70e307df-0156-4d3c-ab92-dd57a103350b'
},
restaurantId: '123456',
result: 'fail',
tenant: 'uk',
timestamp: '2020-01-01T00:00:00Z'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/menu-ingestion-complete');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/menu-ingestion-complete',
headers: {'content-type': 'application/json'},
data: {
correlationId: '64bef5ee-7265-47f8-9aee-28bc74f00b13',
fault: {
errors: [
{
code: '123',
description: 'Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability'
},
{
code: '145',
description: 'Invalid availability ID: menu-105369-availabilities - availability IDs must be integers'
}
],
id: '70e307df-0156-4d3c-ab92-dd57a103350b'
},
restaurantId: '123456',
result: 'fail',
tenant: 'uk',
timestamp: '2020-01-01T00:00:00Z'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/menu-ingestion-complete';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"correlationId":"64bef5ee-7265-47f8-9aee-28bc74f00b13","fault":{"errors":[{"code":"123","description":"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"},{"code":"145","description":"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"}],"id":"70e307df-0156-4d3c-ab92-dd57a103350b"},"restaurantId":"123456","result":"fail","tenant":"uk","timestamp":"2020-01-01T00:00:00Z"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/menu-ingestion-complete',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "correlationId": "64bef5ee-7265-47f8-9aee-28bc74f00b13",\n "fault": {\n "errors": [\n {\n "code": "123",\n "description": "Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"\n },\n {\n "code": "145",\n "description": "Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"\n }\n ],\n "id": "70e307df-0156-4d3c-ab92-dd57a103350b"\n },\n "restaurantId": "123456",\n "result": "fail",\n "tenant": "uk",\n "timestamp": "2020-01-01T00:00:00Z"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/menu-ingestion-complete")
.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/menu-ingestion-complete',
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({
correlationId: '64bef5ee-7265-47f8-9aee-28bc74f00b13',
fault: {
errors: [
{
code: '123',
description: 'Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability'
},
{
code: '145',
description: 'Invalid availability ID: menu-105369-availabilities - availability IDs must be integers'
}
],
id: '70e307df-0156-4d3c-ab92-dd57a103350b'
},
restaurantId: '123456',
result: 'fail',
tenant: 'uk',
timestamp: '2020-01-01T00:00:00Z'
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/menu-ingestion-complete',
headers: {'content-type': 'application/json'},
body: {
correlationId: '64bef5ee-7265-47f8-9aee-28bc74f00b13',
fault: {
errors: [
{
code: '123',
description: 'Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability'
},
{
code: '145',
description: 'Invalid availability ID: menu-105369-availabilities - availability IDs must be integers'
}
],
id: '70e307df-0156-4d3c-ab92-dd57a103350b'
},
restaurantId: '123456',
result: 'fail',
tenant: 'uk',
timestamp: '2020-01-01T00:00:00Z'
},
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}}/menu-ingestion-complete');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
correlationId: '64bef5ee-7265-47f8-9aee-28bc74f00b13',
fault: {
errors: [
{
code: '123',
description: 'Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability'
},
{
code: '145',
description: 'Invalid availability ID: menu-105369-availabilities - availability IDs must be integers'
}
],
id: '70e307df-0156-4d3c-ab92-dd57a103350b'
},
restaurantId: '123456',
result: 'fail',
tenant: 'uk',
timestamp: '2020-01-01T00:00:00Z'
});
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}}/menu-ingestion-complete',
headers: {'content-type': 'application/json'},
data: {
correlationId: '64bef5ee-7265-47f8-9aee-28bc74f00b13',
fault: {
errors: [
{
code: '123',
description: 'Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability'
},
{
code: '145',
description: 'Invalid availability ID: menu-105369-availabilities - availability IDs must be integers'
}
],
id: '70e307df-0156-4d3c-ab92-dd57a103350b'
},
restaurantId: '123456',
result: 'fail',
tenant: 'uk',
timestamp: '2020-01-01T00:00:00Z'
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/menu-ingestion-complete';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"correlationId":"64bef5ee-7265-47f8-9aee-28bc74f00b13","fault":{"errors":[{"code":"123","description":"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"},{"code":"145","description":"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"}],"id":"70e307df-0156-4d3c-ab92-dd57a103350b"},"restaurantId":"123456","result":"fail","tenant":"uk","timestamp":"2020-01-01T00:00:00Z"}'
};
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 = @{ @"correlationId": @"64bef5ee-7265-47f8-9aee-28bc74f00b13",
@"fault": @{ @"errors": @[ @{ @"code": @"123", @"description": @"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability" }, @{ @"code": @"145", @"description": @"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers" } ], @"id": @"70e307df-0156-4d3c-ab92-dd57a103350b" },
@"restaurantId": @"123456",
@"result": @"fail",
@"tenant": @"uk",
@"timestamp": @"2020-01-01T00:00:00Z" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/menu-ingestion-complete"]
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}}/menu-ingestion-complete" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/menu-ingestion-complete",
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([
'correlationId' => '64bef5ee-7265-47f8-9aee-28bc74f00b13',
'fault' => [
'errors' => [
[
'code' => '123',
'description' => 'Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability'
],
[
'code' => '145',
'description' => 'Invalid availability ID: menu-105369-availabilities - availability IDs must be integers'
]
],
'id' => '70e307df-0156-4d3c-ab92-dd57a103350b'
],
'restaurantId' => '123456',
'result' => 'fail',
'tenant' => 'uk',
'timestamp' => '2020-01-01T00:00:00Z'
]),
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}}/menu-ingestion-complete', [
'body' => '{
"correlationId": "64bef5ee-7265-47f8-9aee-28bc74f00b13",
"fault": {
"errors": [
{
"code": "123",
"description": "Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"
},
{
"code": "145",
"description": "Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"
}
],
"id": "70e307df-0156-4d3c-ab92-dd57a103350b"
},
"restaurantId": "123456",
"result": "fail",
"tenant": "uk",
"timestamp": "2020-01-01T00:00:00Z"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/menu-ingestion-complete');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'correlationId' => '64bef5ee-7265-47f8-9aee-28bc74f00b13',
'fault' => [
'errors' => [
[
'code' => '123',
'description' => 'Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability'
],
[
'code' => '145',
'description' => 'Invalid availability ID: menu-105369-availabilities - availability IDs must be integers'
]
],
'id' => '70e307df-0156-4d3c-ab92-dd57a103350b'
],
'restaurantId' => '123456',
'result' => 'fail',
'tenant' => 'uk',
'timestamp' => '2020-01-01T00:00:00Z'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'correlationId' => '64bef5ee-7265-47f8-9aee-28bc74f00b13',
'fault' => [
'errors' => [
[
'code' => '123',
'description' => 'Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability'
],
[
'code' => '145',
'description' => 'Invalid availability ID: menu-105369-availabilities - availability IDs must be integers'
]
],
'id' => '70e307df-0156-4d3c-ab92-dd57a103350b'
],
'restaurantId' => '123456',
'result' => 'fail',
'tenant' => 'uk',
'timestamp' => '2020-01-01T00:00:00Z'
]));
$request->setRequestUrl('{{baseUrl}}/menu-ingestion-complete');
$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}}/menu-ingestion-complete' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"correlationId": "64bef5ee-7265-47f8-9aee-28bc74f00b13",
"fault": {
"errors": [
{
"code": "123",
"description": "Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"
},
{
"code": "145",
"description": "Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"
}
],
"id": "70e307df-0156-4d3c-ab92-dd57a103350b"
},
"restaurantId": "123456",
"result": "fail",
"tenant": "uk",
"timestamp": "2020-01-01T00:00:00Z"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/menu-ingestion-complete' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"correlationId": "64bef5ee-7265-47f8-9aee-28bc74f00b13",
"fault": {
"errors": [
{
"code": "123",
"description": "Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"
},
{
"code": "145",
"description": "Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"
}
],
"id": "70e307df-0156-4d3c-ab92-dd57a103350b"
},
"restaurantId": "123456",
"result": "fail",
"tenant": "uk",
"timestamp": "2020-01-01T00:00:00Z"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/menu-ingestion-complete", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/menu-ingestion-complete"
payload = {
"correlationId": "64bef5ee-7265-47f8-9aee-28bc74f00b13",
"fault": {
"errors": [
{
"code": "123",
"description": "Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"
},
{
"code": "145",
"description": "Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"
}
],
"id": "70e307df-0156-4d3c-ab92-dd57a103350b"
},
"restaurantId": "123456",
"result": "fail",
"tenant": "uk",
"timestamp": "2020-01-01T00:00:00Z"
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/menu-ingestion-complete"
payload <- "{\n \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\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}}/menu-ingestion-complete")
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 \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\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/menu-ingestion-complete') do |req|
req.body = "{\n \"correlationId\": \"64bef5ee-7265-47f8-9aee-28bc74f00b13\",\n \"fault\": {\n \"errors\": [\n {\n \"code\": \"123\",\n \"description\": \"Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability\"\n },\n {\n \"code\": \"145\",\n \"description\": \"Invalid availability ID: menu-105369-availabilities - availability IDs must be integers\"\n }\n ],\n \"id\": \"70e307df-0156-4d3c-ab92-dd57a103350b\"\n },\n \"restaurantId\": \"123456\",\n \"result\": \"fail\",\n \"tenant\": \"uk\",\n \"timestamp\": \"2020-01-01T00:00:00Z\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/menu-ingestion-complete";
let payload = json!({
"correlationId": "64bef5ee-7265-47f8-9aee-28bc74f00b13",
"fault": json!({
"errors": (
json!({
"code": "123",
"description": "Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"
}),
json!({
"code": "145",
"description": "Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"
})
),
"id": "70e307df-0156-4d3c-ab92-dd57a103350b"
}),
"restaurantId": "123456",
"result": "fail",
"tenant": "uk",
"timestamp": "2020-01-01T00:00:00Z"
});
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}}/menu-ingestion-complete \
--header 'content-type: application/json' \
--data '{
"correlationId": "64bef5ee-7265-47f8-9aee-28bc74f00b13",
"fault": {
"errors": [
{
"code": "123",
"description": "Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"
},
{
"code": "145",
"description": "Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"
}
],
"id": "70e307df-0156-4d3c-ab92-dd57a103350b"
},
"restaurantId": "123456",
"result": "fail",
"tenant": "uk",
"timestamp": "2020-01-01T00:00:00Z"
}'
echo '{
"correlationId": "64bef5ee-7265-47f8-9aee-28bc74f00b13",
"fault": {
"errors": [
{
"code": "123",
"description": "Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"
},
{
"code": "145",
"description": "Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"
}
],
"id": "70e307df-0156-4d3c-ab92-dd57a103350b"
},
"restaurantId": "123456",
"result": "fail",
"tenant": "uk",
"timestamp": "2020-01-01T00:00:00Z"
}' | \
http POST {{baseUrl}}/menu-ingestion-complete \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "correlationId": "64bef5ee-7265-47f8-9aee-28bc74f00b13",\n "fault": {\n "errors": [\n {\n "code": "123",\n "description": "Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"\n },\n {\n "code": "145",\n "description": "Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"\n }\n ],\n "id": "70e307df-0156-4d3c-ab92-dd57a103350b"\n },\n "restaurantId": "123456",\n "result": "fail",\n "tenant": "uk",\n "timestamp": "2020-01-01T00:00:00Z"\n}' \
--output-document \
- {{baseUrl}}/menu-ingestion-complete
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"correlationId": "64bef5ee-7265-47f8-9aee-28bc74f00b13",
"fault": [
"errors": [
[
"code": "123",
"description": "Invalid variation: 15237d6c-c866-55da-9e61-b4f59dcab9ae - variations must be associated with at least one availability"
],
[
"code": "145",
"description": "Invalid availability ID: menu-105369-availabilities - availability IDs must be integers"
]
],
"id": "70e307df-0156-4d3c-ab92-dd57a103350b"
],
"restaurantId": "123456",
"result": "fail",
"tenant": "uk",
"timestamp": "2020-01-01T00:00:00Z"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/menu-ingestion-complete")! 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
Order time updated
{{baseUrl}}/order-time-updated
BODY json
{
"dayOfWeek": "",
"lowerBoundMinutes": 0,
"restaurantId": "",
"serviceType": "",
"upperBoundMinutes": 0
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/order-time-updated");
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 \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/order-time-updated" {:content-type :json
:form-params {:dayOfWeek "Monday"
:lowerBoundMinutes 35
:restaurantId "123456"
:serviceType "Delivery"
:upperBoundMinutes 50}})
require "http/client"
url = "{{baseUrl}}/order-time-updated"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\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}}/order-time-updated"),
Content = new StringContent("{\n \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\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}}/order-time-updated");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/order-time-updated"
payload := strings.NewReader("{\n \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\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/order-time-updated HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 138
{
"dayOfWeek": "Monday",
"lowerBoundMinutes": 35,
"restaurantId": "123456",
"serviceType": "Delivery",
"upperBoundMinutes": 50
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/order-time-updated")
.setHeader("content-type", "application/json")
.setBody("{\n \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/order-time-updated"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\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 \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/order-time-updated")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/order-time-updated")
.header("content-type", "application/json")
.body("{\n \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\n}")
.asString();
const data = JSON.stringify({
dayOfWeek: 'Monday',
lowerBoundMinutes: 35,
restaurantId: '123456',
serviceType: 'Delivery',
upperBoundMinutes: 50
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/order-time-updated');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/order-time-updated',
headers: {'content-type': 'application/json'},
data: {
dayOfWeek: 'Monday',
lowerBoundMinutes: 35,
restaurantId: '123456',
serviceType: 'Delivery',
upperBoundMinutes: 50
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/order-time-updated';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"dayOfWeek":"Monday","lowerBoundMinutes":35,"restaurantId":"123456","serviceType":"Delivery","upperBoundMinutes":50}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/order-time-updated',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "dayOfWeek": "Monday",\n "lowerBoundMinutes": 35,\n "restaurantId": "123456",\n "serviceType": "Delivery",\n "upperBoundMinutes": 50\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\n}")
val request = Request.Builder()
.url("{{baseUrl}}/order-time-updated")
.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/order-time-updated',
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({
dayOfWeek: 'Monday',
lowerBoundMinutes: 35,
restaurantId: '123456',
serviceType: 'Delivery',
upperBoundMinutes: 50
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/order-time-updated',
headers: {'content-type': 'application/json'},
body: {
dayOfWeek: 'Monday',
lowerBoundMinutes: 35,
restaurantId: '123456',
serviceType: 'Delivery',
upperBoundMinutes: 50
},
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}}/order-time-updated');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
dayOfWeek: 'Monday',
lowerBoundMinutes: 35,
restaurantId: '123456',
serviceType: 'Delivery',
upperBoundMinutes: 50
});
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}}/order-time-updated',
headers: {'content-type': 'application/json'},
data: {
dayOfWeek: 'Monday',
lowerBoundMinutes: 35,
restaurantId: '123456',
serviceType: 'Delivery',
upperBoundMinutes: 50
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/order-time-updated';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"dayOfWeek":"Monday","lowerBoundMinutes":35,"restaurantId":"123456","serviceType":"Delivery","upperBoundMinutes":50}'
};
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 = @{ @"dayOfWeek": @"Monday",
@"lowerBoundMinutes": @35,
@"restaurantId": @"123456",
@"serviceType": @"Delivery",
@"upperBoundMinutes": @50 };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/order-time-updated"]
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}}/order-time-updated" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/order-time-updated",
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([
'dayOfWeek' => 'Monday',
'lowerBoundMinutes' => 35,
'restaurantId' => '123456',
'serviceType' => 'Delivery',
'upperBoundMinutes' => 50
]),
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}}/order-time-updated', [
'body' => '{
"dayOfWeek": "Monday",
"lowerBoundMinutes": 35,
"restaurantId": "123456",
"serviceType": "Delivery",
"upperBoundMinutes": 50
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/order-time-updated');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'dayOfWeek' => 'Monday',
'lowerBoundMinutes' => 35,
'restaurantId' => '123456',
'serviceType' => 'Delivery',
'upperBoundMinutes' => 50
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'dayOfWeek' => 'Monday',
'lowerBoundMinutes' => 35,
'restaurantId' => '123456',
'serviceType' => 'Delivery',
'upperBoundMinutes' => 50
]));
$request->setRequestUrl('{{baseUrl}}/order-time-updated');
$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}}/order-time-updated' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"dayOfWeek": "Monday",
"lowerBoundMinutes": 35,
"restaurantId": "123456",
"serviceType": "Delivery",
"upperBoundMinutes": 50
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/order-time-updated' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"dayOfWeek": "Monday",
"lowerBoundMinutes": 35,
"restaurantId": "123456",
"serviceType": "Delivery",
"upperBoundMinutes": 50
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/order-time-updated", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/order-time-updated"
payload = {
"dayOfWeek": "Monday",
"lowerBoundMinutes": 35,
"restaurantId": "123456",
"serviceType": "Delivery",
"upperBoundMinutes": 50
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/order-time-updated"
payload <- "{\n \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\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}}/order-time-updated")
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 \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\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/order-time-updated') do |req|
req.body = "{\n \"dayOfWeek\": \"Monday\",\n \"lowerBoundMinutes\": 35,\n \"restaurantId\": \"123456\",\n \"serviceType\": \"Delivery\",\n \"upperBoundMinutes\": 50\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/order-time-updated";
let payload = json!({
"dayOfWeek": "Monday",
"lowerBoundMinutes": 35,
"restaurantId": "123456",
"serviceType": "Delivery",
"upperBoundMinutes": 50
});
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}}/order-time-updated \
--header 'content-type: application/json' \
--data '{
"dayOfWeek": "Monday",
"lowerBoundMinutes": 35,
"restaurantId": "123456",
"serviceType": "Delivery",
"upperBoundMinutes": 50
}'
echo '{
"dayOfWeek": "Monday",
"lowerBoundMinutes": 35,
"restaurantId": "123456",
"serviceType": "Delivery",
"upperBoundMinutes": 50
}' | \
http POST {{baseUrl}}/order-time-updated \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "dayOfWeek": "Monday",\n "lowerBoundMinutes": 35,\n "restaurantId": "123456",\n "serviceType": "Delivery",\n "upperBoundMinutes": 50\n}' \
--output-document \
- {{baseUrl}}/order-time-updated
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"dayOfWeek": "Monday",
"lowerBoundMinutes": 35,
"restaurantId": "123456",
"serviceType": "Delivery",
"upperBoundMinutes": 50
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/order-time-updated")! 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 Compensation requests
{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation
HEADERS
Authorization
QUERY PARAMS
tenant
orderId
BODY json
{
"Comments": "",
"ReasonCode": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: ");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation" {:headers {:authorization ""}
:content-type :json
:form-params {:Comments ""
:ReasonCode ""}})
require "http/client"
url = "{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation"
headers = HTTP::Headers{
"authorization" => ""
"content-type" => "application/json"
}
reqBody = "{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\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/:tenant/:orderId/restaurantqueries/compensation"),
Headers =
{
{ "authorization", "" },
},
Content = new StringContent("{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\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/:tenant/:orderId/restaurantqueries/compensation");
var request = new RestRequest("", Method.Post);
request.AddHeader("authorization", "");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation"
payload := strings.NewReader("{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("authorization", "")
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/:tenant/:orderId/restaurantqueries/compensation HTTP/1.1
Authorization:
Content-Type: application/json
Host: example.com
Content-Length: 40
{
"Comments": "",
"ReasonCode": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation")
.setHeader("authorization", "")
.setHeader("content-type", "application/json")
.setBody("{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation"))
.header("authorization", "")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\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 \"Comments\": \"\",\n \"ReasonCode\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation")
.post(body)
.addHeader("authorization", "")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation")
.header("authorization", "")
.header("content-type", "application/json")
.body("{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\n}")
.asString();
const data = JSON.stringify({
Comments: '',
ReasonCode: ''
});
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/:tenant/:orderId/restaurantqueries/compensation');
xhr.setRequestHeader('authorization', '');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation',
headers: {authorization: '', 'content-type': 'application/json'},
data: {Comments: '', ReasonCode: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation';
const options = {
method: 'POST',
headers: {authorization: '', 'content-type': 'application/json'},
body: '{"Comments":"","ReasonCode":""}'
};
try {
const response = await 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/:tenant/:orderId/restaurantqueries/compensation',
method: 'POST',
headers: {
authorization: '',
'content-type': 'application/json'
},
processData: false,
data: '{\n "Comments": "",\n "ReasonCode": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation")
.post(body)
.addHeader("authorization", "")
.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/:tenant/:orderId/restaurantqueries/compensation',
headers: {
authorization: '',
'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({Comments: '', ReasonCode: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation',
headers: {authorization: '', 'content-type': 'application/json'},
body: {Comments: '', ReasonCode: ''},
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/:tenant/:orderId/restaurantqueries/compensation');
req.headers({
authorization: '',
'content-type': 'application/json'
});
req.type('json');
req.send({
Comments: '',
ReasonCode: ''
});
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/:tenant/:orderId/restaurantqueries/compensation',
headers: {authorization: '', 'content-type': 'application/json'},
data: {Comments: '', ReasonCode: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation';
const options = {
method: 'POST',
headers: {authorization: '', 'content-type': 'application/json'},
body: '{"Comments":"","ReasonCode":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"authorization": @"",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"Comments": @"",
@"ReasonCode": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation"]
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/:tenant/:orderId/restaurantqueries/compensation" in
let headers = Header.add_list (Header.init ()) [
("authorization", "");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation",
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([
'Comments' => '',
'ReasonCode' => ''
]),
CURLOPT_HTTPHEADER => [
"authorization: ",
"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/:tenant/:orderId/restaurantqueries/compensation', [
'body' => '{
"Comments": "",
"ReasonCode": ""
}',
'headers' => [
'authorization' => '',
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'authorization' => '',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'Comments' => '',
'ReasonCode' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'Comments' => '',
'ReasonCode' => ''
]));
$request->setRequestUrl('{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'authorization' => '',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("authorization", "")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Comments": "",
"ReasonCode": ""
}'
$headers=@{}
$headers.Add("authorization", "")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"Comments": "",
"ReasonCode": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\n}"
headers = {
'authorization': "",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/orders/:tenant/:orderId/restaurantqueries/compensation", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation"
payload = {
"Comments": "",
"ReasonCode": ""
}
headers = {
"authorization": "",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation"
payload <- "{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('authorization' = ''), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["authorization"] = ''
request["content-type"] = 'application/json'
request.body = "{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\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/:tenant/:orderId/restaurantqueries/compensation') do |req|
req.headers['authorization'] = ''
req.body = "{\n \"Comments\": \"\",\n \"ReasonCode\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation";
let payload = json!({
"Comments": "",
"ReasonCode": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("authorization", "".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation \
--header 'authorization: ' \
--header 'content-type: application/json' \
--data '{
"Comments": "",
"ReasonCode": ""
}'
echo '{
"Comments": "",
"ReasonCode": ""
}' | \
http POST {{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation \
authorization:'' \
content-type:application/json
wget --quiet \
--method POST \
--header 'authorization: ' \
--header 'content-type: application/json' \
--body-data '{\n "Comments": "",\n "ReasonCode": ""\n}' \
--output-document \
- {{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation
import Foundation
let headers = [
"authorization": "",
"content-type": "application/json"
]
let parameters = [
"Comments": "",
"ReasonCode": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/orders/:tenant/:orderId/restaurantqueries/compensation")! 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
{
"errors": [
{
"description": "The value provided in the field ReasonCode is invalid",
"errorCode": "InvalidReasonCode"
},
{
"description": "Comments field is too long, max 1000",
"errorCode": "CommentsTooLong"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Invalid credentials",
"errorCode": "Unauthorized"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "The credentials provided doesn't have permissions to perform the request",
"errorCode": "Forbidden"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Resource not found",
"errorCode": "NotFound"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "This order is not eligible for compensation",
"errorCode": "OrderNotEligible"
},
{
"description": "A compensation request has already been requested for this order",
"errorCode": "CompensationAlreadyExists"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
POST
Order Eligible For Restaurant Compensation
{{baseUrl}}/order-eligible-for-restaurant-compensation
BODY json
{
"IsEligible": false,
"OrderId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/order-eligible-for-restaurant-compensation");
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 \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/order-eligible-for-restaurant-compensation" {:content-type :json
:form-params {:IsEligible true
:OrderId "c9639af6-04a3-4376-bb4b-5e95cc8b80eb"}})
require "http/client"
url = "{{baseUrl}}/order-eligible-for-restaurant-compensation"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\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}}/order-eligible-for-restaurant-compensation"),
Content = new StringContent("{\n \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\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}}/order-eligible-for-restaurant-compensation");
var request = new RestRequest("", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/order-eligible-for-restaurant-compensation"
payload := strings.NewReader("{\n \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\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/order-eligible-for-restaurant-compensation HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 77
{
"IsEligible": true,
"OrderId": "c9639af6-04a3-4376-bb4b-5e95cc8b80eb"
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/order-eligible-for-restaurant-compensation")
.setHeader("content-type", "application/json")
.setBody("{\n \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/order-eligible-for-restaurant-compensation"))
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\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 \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/order-eligible-for-restaurant-compensation")
.post(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/order-eligible-for-restaurant-compensation")
.header("content-type", "application/json")
.body("{\n \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\n}")
.asString();
const data = JSON.stringify({
IsEligible: true,
OrderId: 'c9639af6-04a3-4376-bb4b-5e95cc8b80eb'
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/order-eligible-for-restaurant-compensation');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/order-eligible-for-restaurant-compensation',
headers: {'content-type': 'application/json'},
data: {IsEligible: true, OrderId: 'c9639af6-04a3-4376-bb4b-5e95cc8b80eb'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/order-eligible-for-restaurant-compensation';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"IsEligible":true,"OrderId":"c9639af6-04a3-4376-bb4b-5e95cc8b80eb"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/order-eligible-for-restaurant-compensation',
method: 'POST',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "IsEligible": true,\n "OrderId": "c9639af6-04a3-4376-bb4b-5e95cc8b80eb"\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/order-eligible-for-restaurant-compensation")
.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/order-eligible-for-restaurant-compensation',
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({IsEligible: true, OrderId: 'c9639af6-04a3-4376-bb4b-5e95cc8b80eb'}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/order-eligible-for-restaurant-compensation',
headers: {'content-type': 'application/json'},
body: {IsEligible: true, OrderId: 'c9639af6-04a3-4376-bb4b-5e95cc8b80eb'},
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}}/order-eligible-for-restaurant-compensation');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
IsEligible: true,
OrderId: 'c9639af6-04a3-4376-bb4b-5e95cc8b80eb'
});
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}}/order-eligible-for-restaurant-compensation',
headers: {'content-type': 'application/json'},
data: {IsEligible: true, OrderId: 'c9639af6-04a3-4376-bb4b-5e95cc8b80eb'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/order-eligible-for-restaurant-compensation';
const options = {
method: 'POST',
headers: {'content-type': 'application/json'},
body: '{"IsEligible":true,"OrderId":"c9639af6-04a3-4376-bb4b-5e95cc8b80eb"}'
};
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 = @{ @"IsEligible": @YES,
@"OrderId": @"c9639af6-04a3-4376-bb4b-5e95cc8b80eb" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/order-eligible-for-restaurant-compensation"]
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}}/order-eligible-for-restaurant-compensation" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/order-eligible-for-restaurant-compensation",
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([
'IsEligible' => null,
'OrderId' => 'c9639af6-04a3-4376-bb4b-5e95cc8b80eb'
]),
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}}/order-eligible-for-restaurant-compensation', [
'body' => '{
"IsEligible": true,
"OrderId": "c9639af6-04a3-4376-bb4b-5e95cc8b80eb"
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/order-eligible-for-restaurant-compensation');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'IsEligible' => null,
'OrderId' => 'c9639af6-04a3-4376-bb4b-5e95cc8b80eb'
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'IsEligible' => null,
'OrderId' => 'c9639af6-04a3-4376-bb4b-5e95cc8b80eb'
]));
$request->setRequestUrl('{{baseUrl}}/order-eligible-for-restaurant-compensation');
$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}}/order-eligible-for-restaurant-compensation' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"IsEligible": true,
"OrderId": "c9639af6-04a3-4376-bb4b-5e95cc8b80eb"
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/order-eligible-for-restaurant-compensation' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"IsEligible": true,
"OrderId": "c9639af6-04a3-4376-bb4b-5e95cc8b80eb"
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\n}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/baseUrl/order-eligible-for-restaurant-compensation", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/order-eligible-for-restaurant-compensation"
payload = {
"IsEligible": True,
"OrderId": "c9639af6-04a3-4376-bb4b-5e95cc8b80eb"
}
headers = {"content-type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/order-eligible-for-restaurant-compensation"
payload <- "{\n \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\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}}/order-eligible-for-restaurant-compensation")
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 \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\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/order-eligible-for-restaurant-compensation') do |req|
req.body = "{\n \"IsEligible\": true,\n \"OrderId\": \"c9639af6-04a3-4376-bb4b-5e95cc8b80eb\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/order-eligible-for-restaurant-compensation";
let payload = json!({
"IsEligible": true,
"OrderId": "c9639af6-04a3-4376-bb4b-5e95cc8b80eb"
});
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}}/order-eligible-for-restaurant-compensation \
--header 'content-type: application/json' \
--data '{
"IsEligible": true,
"OrderId": "c9639af6-04a3-4376-bb4b-5e95cc8b80eb"
}'
echo '{
"IsEligible": true,
"OrderId": "c9639af6-04a3-4376-bb4b-5e95cc8b80eb"
}' | \
http POST {{baseUrl}}/order-eligible-for-restaurant-compensation \
content-type:application/json
wget --quiet \
--method POST \
--header 'content-type: application/json' \
--body-data '{\n "IsEligible": true,\n "OrderId": "c9639af6-04a3-4376-bb4b-5e95cc8b80eb"\n}' \
--output-document \
- {{baseUrl}}/order-eligible-for-restaurant-compensation
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
"IsEligible": true,
"OrderId": "c9639af6-04a3-4376-bb4b-5e95cc8b80eb"
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/order-eligible-for-restaurant-compensation")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Create or Update Restaurant Fees
{{baseUrl}}/restaurants/:tenant/:restaurantId/fees
QUERY PARAMS
tenant
restaurantId
BODY json
{
"bagFee": {
"description": "",
"serviceTypes": {
"collection": {
"amount": ""
},
"default": {},
"delivery": {}
}
}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees");
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 \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees" {:content-type :json
:form-params {:bagFee {:description ""
:serviceTypes {:collection {:amount ""}
:default {}
:delivery {}}}}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/restaurants/:tenant/:restaurantId/fees"),
Content = new StringContent("{\n \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\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}}/restaurants/:tenant/:restaurantId/fees");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees"
payload := strings.NewReader("{\n \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/restaurants/:tenant/:restaurantId/fees HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 166
{
"bagFee": {
"description": "",
"serviceTypes": {
"collection": {
"amount": ""
},
"default": {},
"delivery": {}
}
}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees")
.setHeader("content-type", "application/json")
.setBody("{\n \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/fees"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\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 \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/fees")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/restaurants/:tenant/:restaurantId/fees")
.header("content-type", "application/json")
.body("{\n \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}")
.asString();
const data = JSON.stringify({
bagFee: {
description: '',
serviceTypes: {
collection: {
amount: ''
},
default: {},
delivery: {}
}
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees',
headers: {'content-type': 'application/json'},
data: {
bagFee: {
description: '',
serviceTypes: {collection: {amount: ''}, default: {}, delivery: {}}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"bagFee":{"description":"","serviceTypes":{"collection":{"amount":""},"default":{},"delivery":{}}}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "bagFee": {\n "description": "",\n "serviceTypes": {\n "collection": {\n "amount": ""\n },\n "default": {},\n "delivery": {}\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 \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}")
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/fees")
.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/restaurants/:tenant/:restaurantId/fees',
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({
bagFee: {
description: '',
serviceTypes: {collection: {amount: ''}, default: {}, delivery: {}}
}
}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees',
headers: {'content-type': 'application/json'},
body: {
bagFee: {
description: '',
serviceTypes: {collection: {amount: ''}, default: {}, delivery: {}}
}
},
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}}/restaurants/:tenant/:restaurantId/fees');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
bagFee: {
description: '',
serviceTypes: {
collection: {
amount: ''
},
default: {},
delivery: {}
}
}
});
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}}/restaurants/:tenant/:restaurantId/fees',
headers: {'content-type': 'application/json'},
data: {
bagFee: {
description: '',
serviceTypes: {collection: {amount: ''}, default: {}, delivery: {}}
}
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"bagFee":{"description":"","serviceTypes":{"collection":{"amount":""},"default":{},"delivery":{}}}}'
};
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 = @{ @"bagFee": @{ @"description": @"", @"serviceTypes": @{ @"collection": @{ @"amount": @"" }, @"default": @{ }, @"delivery": @{ } } } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/restaurants/:tenant/:restaurantId/fees"]
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}}/restaurants/:tenant/:restaurantId/fees" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/fees",
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([
'bagFee' => [
'description' => '',
'serviceTypes' => [
'collection' => [
'amount' => ''
],
'default' => [
],
'delivery' => [
]
]
]
]),
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}}/restaurants/:tenant/:restaurantId/fees', [
'body' => '{
"bagFee": {
"description": "",
"serviceTypes": {
"collection": {
"amount": ""
},
"default": {},
"delivery": {}
}
}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/fees');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'bagFee' => [
'description' => '',
'serviceTypes' => [
'collection' => [
'amount' => ''
],
'default' => [
],
'delivery' => [
]
]
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'bagFee' => [
'description' => '',
'serviceTypes' => [
'collection' => [
'amount' => ''
],
'default' => [
],
'delivery' => [
]
]
]
]));
$request->setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/fees');
$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}}/restaurants/:tenant/:restaurantId/fees' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"bagFee": {
"description": "",
"serviceTypes": {
"collection": {
"amount": ""
},
"default": {},
"delivery": {}
}
}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"bagFee": {
"description": "",
"serviceTypes": {
"collection": {
"amount": ""
},
"default": {},
"delivery": {}
}
}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/restaurants/:tenant/:restaurantId/fees", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees"
payload = { "bagFee": {
"description": "",
"serviceTypes": {
"collection": { "amount": "" },
"default": {},
"delivery": {}
}
} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees"
payload <- "{\n \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/fees")
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 \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/restaurants/:tenant/:restaurantId/fees') do |req|
req.body = "{\n \"bagFee\": {\n \"description\": \"\",\n \"serviceTypes\": {\n \"collection\": {\n \"amount\": \"\"\n },\n \"default\": {},\n \"delivery\": {}\n }\n }\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees";
let payload = json!({"bagFee": json!({
"description": "",
"serviceTypes": json!({
"collection": json!({"amount": ""}),
"default": json!({}),
"delivery": json!({})
})
})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/restaurants/:tenant/:restaurantId/fees \
--header 'content-type: application/json' \
--data '{
"bagFee": {
"description": "",
"serviceTypes": {
"collection": {
"amount": ""
},
"default": {},
"delivery": {}
}
}
}'
echo '{
"bagFee": {
"description": "",
"serviceTypes": {
"collection": {
"amount": ""
},
"default": {},
"delivery": {}
}
}
}' | \
http PUT {{baseUrl}}/restaurants/:tenant/:restaurantId/fees \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "bagFee": {\n "description": "",\n "serviceTypes": {\n "collection": {\n "amount": ""\n },\n "default": {},\n "delivery": {}\n }\n }\n}' \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/fees
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["bagFee": [
"description": "",
"serviceTypes": [
"collection": ["amount": ""],
"default": [],
"delivery": []
]
]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"bagFee": {
"description": "A charge for bags in delivery",
"serviceTypes": {
"collection": {
"amount": 5
},
"default": {
"amount": 0
},
"delivery": {
"amount": 10
}
}
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "The supplied tenant is not supported",
"errorCode": "UnsupportedTenant"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Authorization required",
"errorCode": "Unauthorized"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "You do not have permission to access this resource",
"errorCode": "Forbidden"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "The requested resource does not exist on this server",
"errorCode": "NotFound"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: ");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu" {:headers {:authorization ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"
headers = HTTP::Headers{
"authorization" => ""
}
response = HTTP::Client.put url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"),
Headers =
{
{ "authorization", "" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu");
var request = new RestRequest("", Method.Put);
request.AddHeader("authorization", "");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("authorization", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/restaurants/:tenant/:restaurantId/menu HTTP/1.1
Authorization:
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu")
.setHeader("authorization", "")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"))
.header("authorization", "")
.method("PUT", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu")
.put(null)
.addHeader("authorization", "")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu")
.header("authorization", "")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu');
xhr.setRequestHeader('authorization', '');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu',
headers: {authorization: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu';
const options = {method: 'PUT', headers: {authorization: ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu',
method: 'PUT',
headers: {
authorization: ''
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu")
.put(null)
.addHeader("authorization", "")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/menu',
headers: {
authorization: ''
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu',
headers: {authorization: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu');
req.headers({
authorization: ''
});
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}}/restaurants/:tenant/:restaurantId/menu',
headers: {authorization: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu';
const options = {method: 'PUT', headers: {authorization: ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"authorization": @"" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu" in
let headers = Header.add (Header.init ()) "authorization" "" in
Client.call ~headers `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/menu",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => [
"authorization: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu', [
'headers' => [
'authorization' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/menu');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'authorization' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/menu');
$request->setRequestMethod('PUT');
$request->setHeaders([
'authorization' => ''
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("authorization", "")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu' -Method PUT -Headers $headers
$headers=@{}
$headers.Add("authorization", "")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu' -Method PUT -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = ""
headers = { 'authorization': "" }
conn.request("PUT", "/baseUrl/restaurants/:tenant/:restaurantId/menu", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"
payload = ""
headers = {"authorization": ""}
response = requests.put(url, data=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"
payload <- ""
response <- VERB("PUT", url, body = payload, add_headers('authorization' = ''), content_type(""))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["authorization"] = ''
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.put('/baseUrl/restaurants/:tenant/:restaurantId/menu') do |req|
req.headers['authorization'] = ''
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("authorization", "".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/restaurants/:tenant/:restaurantId/menu \
--header 'authorization: '
http PUT {{baseUrl}}/restaurants/:tenant/:restaurantId/menu \
authorization:''
wget --quiet \
--method PUT \
--header 'authorization: ' \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/menu
import Foundation
let headers = ["authorization": ""]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as 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
{
"correlationId": "64bef5ee-7265-47f8-9aee-28bc74f00b13"
}
PUT
Create or update service times
{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes
QUERY PARAMS
tenant
restaurantId
BODY json
{
"serviceTimes": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes");
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 \"serviceTimes\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes" {:content-type :json
:form-params {:serviceTimes {}}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "{\n \"serviceTimes\": {}\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}}/restaurants/:tenant/:restaurantId/servicetimes"),
Content = new StringContent("{\n \"serviceTimes\": {}\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}}/restaurants/:tenant/:restaurantId/servicetimes");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"serviceTimes\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes"
payload := strings.NewReader("{\n \"serviceTimes\": {}\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/restaurants/:tenant/:restaurantId/servicetimes HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 24
{
"serviceTimes": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes")
.setHeader("content-type", "application/json")
.setBody("{\n \"serviceTimes\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"serviceTimes\": {}\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 \"serviceTimes\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes")
.header("content-type", "application/json")
.body("{\n \"serviceTimes\": {}\n}")
.asString();
const data = JSON.stringify({
serviceTimes: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes',
headers: {'content-type': 'application/json'},
data: {serviceTimes: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"serviceTimes":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '{\n "serviceTimes": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"serviceTimes\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes")
.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/restaurants/:tenant/:restaurantId/servicetimes',
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({serviceTimes: {}}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes',
headers: {'content-type': 'application/json'},
body: {serviceTimes: {}},
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}}/restaurants/:tenant/:restaurantId/servicetimes');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send({
serviceTimes: {}
});
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}}/restaurants/:tenant/:restaurantId/servicetimes',
headers: {'content-type': 'application/json'},
data: {serviceTimes: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '{"serviceTimes":{}}'
};
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 = @{ @"serviceTimes": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes"]
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}}/restaurants/:tenant/:restaurantId/servicetimes" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "{\n \"serviceTimes\": {}\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes",
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([
'serviceTimes' => [
]
]),
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}}/restaurants/:tenant/:restaurantId/servicetimes', [
'body' => '{
"serviceTimes": {}
}',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'serviceTimes' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'serviceTimes' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes');
$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}}/restaurants/:tenant/:restaurantId/servicetimes' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"serviceTimes": {}
}'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"serviceTimes": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"serviceTimes\": {}\n}"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/restaurants/:tenant/:restaurantId/servicetimes", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes"
payload = { "serviceTimes": {} }
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes"
payload <- "{\n \"serviceTimes\": {}\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}}/restaurants/:tenant/:restaurantId/servicetimes")
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 \"serviceTimes\": {}\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/restaurants/:tenant/:restaurantId/servicetimes') do |req|
req.body = "{\n \"serviceTimes\": {}\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}}/restaurants/:tenant/:restaurantId/servicetimes";
let payload = json!({"serviceTimes": json!({})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes \
--header 'content-type: application/json' \
--data '{
"serviceTimes": {}
}'
echo '{
"serviceTimes": {}
}' | \
http PUT {{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '{\n "serviceTimes": {}\n}' \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes
import Foundation
let headers = ["content-type": "application/json"]
let parameters = ["serviceTimes": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"desiredServiceTimes": {
"friday": {
"collection": [
{
"end": "14:00:00",
"start": "12:00:00"
},
{
"end": "23:00:00",
"start": "17:00:00"
}
],
"delivery": [
{
"end": "13:30:00",
"start": "12:00:00"
},
{
"end": "00:00:00",
"start": "18:00:00"
}
]
},
"monday": {
"collection": [
{
"end": "14:00:00",
"start": "12:00:00"
},
{
"end": "23:00:00",
"start": "17:00:00"
}
],
"delivery": [
{
"end": "13:30:00",
"start": "12:00:00"
},
{
"end": "00:00:00",
"start": "18:00:00"
}
]
},
"saturday": {
"collection": [
{
"end": "23:00:00",
"start": "12:00:00"
}
],
"delivery": [
{
"end": "00:00:00",
"start": "12:00:00"
}
]
},
"sunday": {
"collection": [
{
"end": "23:00:00",
"start": "12:00:00"
}
],
"delivery": [
{
"end": "00:00:00",
"start": "12:00:00"
}
]
},
"thursday": {
"collection": [
{
"end": "14:00:00",
"start": "12:00:00"
},
{
"end": "23:00:00",
"start": "17:00:00"
}
],
"delivery": [
{
"end": "13:30:00",
"start": "12:00:00"
},
{
"end": "00:00:00",
"start": "18:00:00"
}
]
},
"tuesday": {
"collection": [
{
"end": "14:00:00",
"start": "12:00:00"
},
{
"end": "23:00:00",
"start": "17:00:00"
}
],
"delivery": [
{
"end": "13:30:00",
"start": "12:00:00"
},
{
"end": "00:00:00",
"start": "18:00:00"
}
]
},
"wednesday": {
"collection": [
{
"end": "14:00:00",
"start": "12:00:00"
},
{
"end": "23:00:00",
"start": "17:00:00"
}
],
"delivery": [
{
"end": "13:30:00",
"start": "12:00:00"
},
{
"end": "00:00:00",
"start": "18:00:00"
}
]
}
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "The value of \"end\" must be greater than \"start\", or \"00:00:00\"",
"errorCode": "ERR1234"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
GET
Get Restaurant Fees
{{baseUrl}}/restaurants/:tenant/:restaurantId/fees
QUERY PARAMS
tenant
restaurantId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees")
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees"
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}}/restaurants/:tenant/:restaurantId/fees"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/fees");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees"
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/restaurants/:tenant/:restaurantId/fees HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/fees"))
.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}}/restaurants/:tenant/:restaurantId/fees")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/fees")
.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}}/restaurants/:tenant/:restaurantId/fees');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees';
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}}/restaurants/:tenant/:restaurantId/fees',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/fees")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/fees',
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}}/restaurants/:tenant/:restaurantId/fees'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees');
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}}/restaurants/:tenant/:restaurantId/fees'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees';
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}}/restaurants/:tenant/:restaurantId/fees"]
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}}/restaurants/:tenant/:restaurantId/fees" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/fees",
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}}/restaurants/:tenant/:restaurantId/fees');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/fees');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/fees');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/fees' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/fees")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/fees")
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/restaurants/:tenant/:restaurantId/fees') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees";
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}}/restaurants/:tenant/:restaurantId/fees
http GET {{baseUrl}}/restaurants/:tenant/:restaurantId/fees
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/fees
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/fees")! 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
{
"bagFee": {
"description": "A charge for bags in delivery",
"serviceTypes": {
"collection": {
"amount": 5
},
"default": {
"amount": 0
},
"delivery": {
"amount": 10
}
}
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "The supplied tenant is not supported",
"errorCode": "UnsupportedTenant"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Authorization required",
"errorCode": "Unauthorized"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "You do not have permission to access this resource",
"errorCode": "Forbidden"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "The requested resource does not exist on this server",
"errorCode": "NotFound"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
GET
Get all availabilities
{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities
QUERY PARAMS
limit
tenant
restaurantId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities" {:query-params {:limit ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit="
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}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit="
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/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit="))
.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}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=")
.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}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=',
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}}/restaurants/:tenant/:restaurantId/catalogue/availabilities',
qs: {limit: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities');
req.query({
limit: ''
});
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}}/restaurants/:tenant/:restaurantId/catalogue/availabilities',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit="]
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}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=",
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}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'limit' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'limit' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities"
querystring = {"limit":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities"
queryString <- list(limit = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=")
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/restaurants/:tenant/:restaurantId/catalogue/availabilities') do |req|
req.params['limit'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities";
let querystring = [
("limit", ""),
];
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}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit='
http GET '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/availabilities?limit=")! 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
{
"availabilities": [
{
"description": "Menu items available for delivery during weekdays for lunch.",
"id": "1-lunch-delivery",
"name": "Delivery Lunch",
"serviceTypes": [
"delivery"
],
"times": [
{
"daysOfTheWeek": [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
"sunday"
],
"fromDateTime": "11:30:00",
"toDateTime": "14:30:00"
}
]
},
{
"description": "Menu items available for delivery during weekdays for dinner.",
"id": "1-dinner-delivery",
"name": "Delivery Dinner",
"serviceTypes": [
"delivery"
],
"times": [
{
"daysOfTheWeek": [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
"sunday"
],
"fromDateTime": "16:30:00",
"toDateTime": "22:00:00"
}
]
}
],
"paging": {
"cursors": {
"after": "NDMyNzQyODI3OTQw"
}
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Invalid value 0 for parameter limit."
}
],
"faultId": "e21a9947-4352-449f-a4dc-5e69d57b0c5f"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Resource with identifier restaurantId:95224345321 for tenant:uk not found."
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
GET
Get all categories
{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories
QUERY PARAMS
limit
tenant
restaurantId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories" {:query-params {:limit ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit="
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}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit="
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/restaurants/:tenant/:restaurantId/catalogue/categories?limit= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit="))
.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}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=")
.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}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/catalogue/categories?limit=',
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}}/restaurants/:tenant/:restaurantId/catalogue/categories',
qs: {limit: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories');
req.query({
limit: ''
});
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}}/restaurants/:tenant/:restaurantId/catalogue/categories',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit="]
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}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=",
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}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'limit' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'limit' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/catalogue/categories?limit=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories"
querystring = {"limit":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories"
queryString <- list(limit = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=")
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/restaurants/:tenant/:restaurantId/catalogue/categories') do |req|
req.params['limit'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories";
let querystring = [
("limit", ""),
];
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}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit='
http GET '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories?limit=")! 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
{
"categories": [
{
"description": "Sumptuous starters",
"id": "3",
"name": "Starters"
},
{
"description": "Magnificent mains",
"id": "4",
"name": "Mains"
}
],
"paging": {
"cursors": {
"after": "NDMyNzQyODI3OTQw"
}
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Invalid value 0 for parameter limit."
}
],
"faultId": "e21a9947-4352-449f-a4dc-5e69d57b0c5f"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Resource with identifier restaurantId:95224345321 for tenant:uk not found."
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
GET
Get all category item IDs
{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items
QUERY PARAMS
limit
tenant
restaurantId
categoryId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items" {:query-params {:limit ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit="
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}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit="
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/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit="))
.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}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=")
.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}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=',
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}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items',
qs: {limit: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items');
req.query({
limit: ''
});
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}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit="]
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}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=",
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}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'limit' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'limit' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items"
querystring = {"limit":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items"
queryString <- list(limit = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=")
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/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items') do |req|
req.params['limit'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items";
let querystring = [
("limit", ""),
];
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}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit='
http GET '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/categories/:categoryId/items?limit=")! 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
{
"itemIds": [
"65143901",
"65143902",
"65143903",
"65143904",
"65143905"
],
"paging": {
"cursors": {
"after": "NDMyNzQyODI3OTQw"
}
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Invalid value 0 for parameter limit."
}
],
"faultId": "e21a9947-4352-449f-a4dc-5e69d57b0c5f"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Resource with identifier restaurantId:95224345321 for tenant:uk not found."
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
GET
Get all deal item variations for a deal group
{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations
QUERY PARAMS
limit
tenant
restaurantId
itemId
dealGroupId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations" {:query-params {:limit ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit="
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit="
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/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit="))
.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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=")
.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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=',
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations',
qs: {limit: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations');
req.query({
limit: ''
});
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit="]
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=",
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'limit' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'limit' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations"
querystring = {"limit":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations"
queryString <- list(limit = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=")
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/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations') do |req|
req.params['limit'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations";
let querystring = [
("limit", ""),
];
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit='
http GET '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups/:dealGroupId/dealitemvariations?limit=")! 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
{
"dealItemVariations": [
{
"additionPrice": 50,
"dealItemVariationId": "8548153",
"maxChoices": 1,
"minChoices": 0
},
{
"additionPrice": 100,
"dealItemVariationId": "8548153",
"maxChoices": 2,
"minChoices": 1
}
],
"paging": {
"cursors": {
"after": "NDMyNzQyODI3OTQw"
}
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Invalid value 0 for parameter limit."
}
],
"faultId": "e21a9947-4352-449f-a4dc-5e69d57b0c5f"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Resource with identifier restaurantId:95224345321 for tenant:uk for itemId:534685 and dealGroupId:463847 not found."
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups" {:query-params {:limit ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit="
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit="
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/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit="))
.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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=")
.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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=',
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups',
qs: {limit: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups');
req.query({
limit: ''
});
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit="]
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=",
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'limit' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'limit' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups"
querystring = {"limit":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups"
queryString <- list(limit = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=")
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/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups') do |req|
req.params['limit'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups";
let querystring = [
("limit", ""),
];
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit='
http GET '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/dealgroups?limit=")! 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
{
"dealGroups": [
{
"id": "23435309-1",
"name": "Choose your base",
"numberOfChoices": 1
},
{
"id": "23435309-2",
"name": "Choose your halves",
"numberOfChoices": 2
}
],
"paging": {
"cursors": {
"after": "NDMyNzQyODI3OTQw"
}
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Invalid value 0 for parameter limit."
}
],
"faultId": "e21a9947-4352-449f-a4dc-5e69d57b0c5f"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Resource with identifier restaurantId:95224345321 for tenant:uk and itemId:534685 not found."
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups" {:query-params {:limit ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit="
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit="
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/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit="))
.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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=")
.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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=',
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups',
qs: {limit: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups');
req.query({
limit: ''
});
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit="]
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=",
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'limit' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'limit' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups"
querystring = {"limit":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups"
queryString <- list(limit = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=")
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/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups') do |req|
req.params['limit'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups";
let querystring = [
("limit", ""),
];
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit='
http GET '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/modifiergroups?limit=")! 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
{
"modifierGroups": [
{
"id": "8547130-req-1",
"maxChoices": 1,
"minChoices": 1,
"modifiers": [
{
"additionPrice": 0,
"id": "854500",
"maxChoices": 1,
"minChoices": 0,
"name": "Classic Crust"
},
{
"additionPrice": 200,
"id": "854600",
"maxChoices": 1,
"minChoices": 0,
"name": "Stuffed Crust"
}
],
"name": "Choose your crust"
},
{
"id": "8547130-opt-1",
"maxChoices": 10,
"minChoices": 0,
"modifiers": [
{
"additionPrice": 50,
"id": "1000",
"maxChoices": 2,
"minChoices": 0,
"name": "Mozzarella Cheese"
},
{
"additionPrice": 50,
"id": "1001",
"maxChoices": 1,
"minChoices": 0,
"name": "Ham"
},
{
"additionPrice": 50,
"id": "1002",
"maxChoices": 1,
"minChoices": 0,
"name": "Red Onion"
},
{
"additionPrice": 50,
"id": "1003",
"maxChoices": 1,
"minChoices": 0,
"name": "Pepperoni"
},
{
"additionPrice": 50,
"id": "1004",
"maxChoices": 1,
"minChoices": 0,
"name": "Olives"
}
],
"name": "Any extra toppings?"
}
],
"paging": {
"cursors": {
"after": "NDMyNzQyODI3OTQw"
}
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Invalid value 0 for parameter limit."
}
],
"faultId": "e21a9947-4352-449f-a4dc-5e69d57b0c5f"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Resource with identifier restaurantId:95224345321 for tenant:uk and itemId:534685 not found."
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations" {:query-params {:limit ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit="
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit="
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/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit="))
.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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=")
.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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=',
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations',
qs: {limit: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations');
req.query({
limit: ''
});
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit="]
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=",
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'limit' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'limit' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations"
querystring = {"limit":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations"
queryString <- list(limit = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=")
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/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations') do |req|
req.params['limit'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations";
let querystring = [
("limit", ""),
];
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}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit='
http GET '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items/:itemId/variations?limit=")! 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
{
"paging": {
"cursors": {
"after": "NDMyNzQyODI3OTQw"
}
},
"variations": [
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 500,
"dealGroupsIds": [],
"dealOnly": true,
"id": "8547121",
"kitchenNumber": "100",
"modifierGroupsIds": [
"8547130-opt-1"
],
"name": "Half",
"type": "variation"
},
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 1000,
"dealGroupsIds": [],
"dealOnly": false,
"id": "8547130",
"kitchenNumber": "100",
"modifierGroupsIds": [
"8547130-req-1",
"8547130-opt-1"
],
"name": "12 inch",
"type": "variation"
},
{
"availabilityIds": [
"1-lunch-delivery-weekday",
"2-lunch-collection-weekday",
"3-dinner-delivery-weekday",
"4-dinner-collection-weekday"
],
"basePrice": 1200,
"dealGroupsIds": [],
"dealOnly": true,
"id": "8543123",
"kitchenNumber": "200",
"modifierGroupsIds": [
"8547130-req-1",
"8547130-opt-1"
],
"name": "14 inch",
"type": "variation"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Invalid value 0 for parameter limit."
}
],
"faultId": "e21a9947-4352-449f-a4dc-5e69d57b0c5f"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Resource with identifier restaurantId:95224345321 for tenant:uk and itemId:534685 not found."
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items" {:query-params {:limit ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit="
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}}/restaurants/:tenant/:restaurantId/catalogue/items?limit="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit="
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/restaurants/:tenant/:restaurantId/catalogue/items?limit= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit="))
.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}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=")
.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}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/catalogue/items?limit=',
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}}/restaurants/:tenant/:restaurantId/catalogue/items',
qs: {limit: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items');
req.query({
limit: ''
});
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}}/restaurants/:tenant/:restaurantId/catalogue/items',
params: {limit: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=';
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}}/restaurants/:tenant/:restaurantId/catalogue/items?limit="]
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}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=",
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}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'limit' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'limit' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/catalogue/items?limit=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items"
querystring = {"limit":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items"
queryString <- list(limit = "")
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=")
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/restaurants/:tenant/:restaurantId/catalogue/items') do |req|
req.params['limit'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items";
let querystring = [
("limit", ""),
];
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}}/restaurants/:tenant/:restaurantId/catalogue/items?limit='
http GET '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue/items?limit=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"items": [
{
"description": "",
"id": "65143901",
"labels": [],
"name": "Flat Bread and Dips (Pick any 2 Dips)",
"requireOtherProducts": false,
"type": "menuItem"
},
{
"description": "",
"id": "8547130",
"labels": [],
"name": "Margherita",
"requireOtherProducts": true,
"type": "menuItem"
}
],
"paging": {
"cursors": {
"after": "NDMyNzQyODI3OTQw"
}
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Invalid value 0 for parameter limit."
}
],
"faultId": "e21a9947-4352-449f-a4dc-5e69d57b0c5f"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Resource with identifier restaurantId:95224345321 for tenant:uk not found."
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
GET
Get product catalogue
{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue
QUERY PARAMS
tenant
restaurantId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue")
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue"
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}}/restaurants/:tenant/:restaurantId/catalogue"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue"
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/restaurants/:tenant/:restaurantId/catalogue HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue"))
.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}}/restaurants/:tenant/:restaurantId/catalogue")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue")
.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}}/restaurants/:tenant/:restaurantId/catalogue');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue';
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}}/restaurants/:tenant/:restaurantId/catalogue',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/catalogue',
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}}/restaurants/:tenant/:restaurantId/catalogue'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue');
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}}/restaurants/:tenant/:restaurantId/catalogue'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue';
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}}/restaurants/:tenant/:restaurantId/catalogue"]
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}}/restaurants/:tenant/:restaurantId/catalogue" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue",
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}}/restaurants/:tenant/:restaurantId/catalogue');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/catalogue")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue")
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/restaurants/:tenant/:restaurantId/catalogue') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue";
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}}/restaurants/:tenant/:restaurantId/catalogue
http GET {{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/catalogue")! 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
{
"currency": "GBP",
"description": "My excellent menu",
"name": "My Restaurant",
"restaurantId": "100059"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Resource with identifier restaurantId:95224345321 for tenant:uk not found."
}
],
"faultId": "b39ae4c1-142f-4308-838d-1f01815e1cf1"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
GET
Get restaurants by location
{{baseUrl}}/restaurants/bylatlong
HEADERS
Authorization
QUERY PARAMS
latitude
longitude
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: ");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/bylatlong" {:headers {:authorization ""}
:query-params {:latitude ""
:longitude ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/bylatlong?latitude=&longitude="
headers = HTTP::Headers{
"authorization" => ""
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/restaurants/bylatlong?latitude=&longitude="),
Headers =
{
{ "authorization", "" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=");
var request = new RestRequest("", Method.Get);
request.AddHeader("authorization", "");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/bylatlong?latitude=&longitude="
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/restaurants/bylatlong?latitude=&longitude= HTTP/1.1
Authorization:
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=")
.setHeader("authorization", "")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/bylatlong?latitude=&longitude="))
.header("authorization", "")
.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}}/restaurants/bylatlong?latitude=&longitude=")
.get()
.addHeader("authorization", "")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=")
.header("authorization", "")
.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}}/restaurants/bylatlong?latitude=&longitude=');
xhr.setRequestHeader('authorization', '');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/bylatlong',
params: {latitude: '', longitude: ''},
headers: {authorization: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=';
const options = {method: 'GET', headers: {authorization: ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=',
method: 'GET',
headers: {
authorization: ''
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=")
.get()
.addHeader("authorization", "")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/bylatlong?latitude=&longitude=',
headers: {
authorization: ''
}
};
const req = http.request(options, function (res) {
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}}/restaurants/bylatlong',
qs: {latitude: '', longitude: ''},
headers: {authorization: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/bylatlong');
req.query({
latitude: '',
longitude: ''
});
req.headers({
authorization: ''
});
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}}/restaurants/bylatlong',
params: {latitude: '', longitude: ''},
headers: {authorization: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=';
const options = {method: 'GET', headers: {authorization: ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"authorization": @"" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/restaurants/bylatlong?latitude=&longitude="]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=" in
let headers = Header.add (Header.init ()) "authorization" "" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"authorization: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=', [
'headers' => [
'authorization' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/bylatlong');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'latitude' => '',
'longitude' => ''
]);
$request->setHeaders([
'authorization' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/bylatlong');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'latitude' => '',
'longitude' => ''
]));
$request->setHeaders([
'authorization' => ''
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("authorization", "")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=' -Method GET -Headers $headers
$headers=@{}
$headers.Add("authorization", "")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'authorization': "" }
conn.request("GET", "/baseUrl/restaurants/bylatlong?latitude=&longitude=", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/bylatlong"
querystring = {"latitude":"","longitude":""}
headers = {"authorization": ""}
response = requests.get(url, headers=headers, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/bylatlong"
queryString <- list(
latitude = "",
longitude = ""
)
response <- VERB("GET", url, query = queryString, add_headers('authorization' = ''), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = ''
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/restaurants/bylatlong') do |req|
req.headers['authorization'] = ''
req.params['latitude'] = ''
req.params['longitude'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/bylatlong";
let querystring = [
("latitude", ""),
("longitude", ""),
];
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("authorization", "".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=' \
--header 'authorization: '
http GET '{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=' \
authorization:''
wget --quiet \
--method GET \
--header 'authorization: ' \
--output-document \
- '{{baseUrl}}/restaurants/bylatlong?latitude=&longitude='
import Foundation
let headers = ["authorization": ""]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/bylatlong?latitude=&longitude=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as 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
{
"Message": "The request is invalid.",
"ModelState": {
"Longitude": [
"The value 'nan' is not valid for Longitude."
]
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"message": "No API key found in request"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"ExceptionMessage": "Object reference not set to an instance of an object.",
"ExceptionType": "System.NullReferenceException",
"Message": "An error has occurred.",
"StackTrace": " at JE.SearchOrchestrator.Controllers.Filters.CacheControlFilter.OnActionExecuted(HttpActionExecutedContext actionExecutedContext) in \\\\Mac\\Home\\Documents\\GitHub\\SearchOrchestrator\\src\\JE.SearchOrchestrator\\Controllers\\Filters\\CacheControlFilter.cs:line 18\r\n at System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)\r\n--- End of stack"
}
GET
Get restaurants by postcode
{{baseUrl}}/restaurants/bypostcode/:postcode
QUERY PARAMS
postcode
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/bypostcode/:postcode");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/bypostcode/:postcode")
require "http/client"
url = "{{baseUrl}}/restaurants/bypostcode/:postcode"
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}}/restaurants/bypostcode/:postcode"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/bypostcode/:postcode");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/bypostcode/:postcode"
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/restaurants/bypostcode/:postcode HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/bypostcode/:postcode")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/bypostcode/:postcode"))
.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}}/restaurants/bypostcode/:postcode")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/bypostcode/:postcode")
.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}}/restaurants/bypostcode/:postcode');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/bypostcode/:postcode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/bypostcode/:postcode';
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}}/restaurants/bypostcode/:postcode',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/bypostcode/:postcode")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/bypostcode/:postcode',
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}}/restaurants/bypostcode/:postcode'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/bypostcode/:postcode');
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/bypostcode/:postcode'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/bypostcode/:postcode';
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}}/restaurants/bypostcode/:postcode"]
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}}/restaurants/bypostcode/:postcode" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/bypostcode/:postcode",
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}}/restaurants/bypostcode/:postcode');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/bypostcode/:postcode');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/bypostcode/:postcode');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/bypostcode/:postcode' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/bypostcode/:postcode' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/bypostcode/:postcode")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/bypostcode/:postcode"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/bypostcode/:postcode"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/bypostcode/:postcode")
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/restaurants/bypostcode/:postcode') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/bypostcode/:postcode";
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}}/restaurants/bypostcode/:postcode
http GET {{baseUrl}}/restaurants/bypostcode/:postcode
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/restaurants/bypostcode/:postcode
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/bypostcode/:postcode")! 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
{
"Message": "The request is invalid.",
"ModelState": {
"Postcode": [
"Invalid Postcode."
]
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"message": "No API key found in request"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"ExceptionMessage": "Object reference not set to an instance of an object.",
"ExceptionType": "System.NullReferenceException",
"Message": "An error has occurred.",
"StackTrace": " at JE.SearchOrchestrator.Controllers.Filters.CacheControlFilter.OnActionExecuted(HttpActionExecutedContext actionExecutedContext) in \\\\Mac\\Home\\Documents\\GitHub\\SearchOrchestrator\\src\\JE.SearchOrchestrator\\Controllers\\Filters\\CacheControlFilter.cs:line 18\r\n at System.Web.Http.Filters.ActionFilterAttribute.OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)\r\n--- End of stack"
}
GET
Get service times
{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes
QUERY PARAMS
tenant
restaurantId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes")
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes"
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}}/restaurants/:tenant/:restaurantId/servicetimes"),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes"
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/restaurants/:tenant/:restaurantId/servicetimes HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes"))
.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}}/restaurants/:tenant/:restaurantId/servicetimes")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes")
.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}}/restaurants/:tenant/:restaurantId/servicetimes');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes';
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}}/restaurants/:tenant/:restaurantId/servicetimes',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/servicetimes',
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}}/restaurants/:tenant/:restaurantId/servicetimes'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes');
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}}/restaurants/:tenant/:restaurantId/servicetimes'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes';
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}}/restaurants/:tenant/:restaurantId/servicetimes"]
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}}/restaurants/:tenant/:restaurantId/servicetimes" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes",
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}}/restaurants/:tenant/:restaurantId/servicetimes');
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes');
$request->setMethod(HTTP_METH_GET);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes');
$request->setRequestMethod('GET');
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/servicetimes")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes"
response = requests.get(url)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes"
response <- VERB("GET", url, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes")
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/restaurants/:tenant/:restaurantId/servicetimes') do |req|
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes";
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}}/restaurants/:tenant/:restaurantId/servicetimes
http GET {{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes
wget --quiet \
--method GET \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/servicetimes")! 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
{
"desiredServiceTimes": {
"friday": {
"collection": [
{
"end": "14:00:00",
"start": "12:00:00"
},
{
"end": "23:00:00",
"start": "17:00:00"
}
],
"delivery": [
{
"end": "13:30:00",
"start": "12:00:00"
},
{
"end": "00:00:00",
"start": "18:00:00"
}
]
},
"monday": {
"collection": [
{
"end": "14:00:00",
"start": "12:00:00"
},
{
"end": "23:00:00",
"start": "17:00:00"
}
],
"delivery": [
{
"end": "13:30:00",
"start": "12:00:00"
},
{
"end": "00:00:00",
"start": "18:00:00"
}
]
},
"saturday": {
"collection": [
{
"end": "23:00:00",
"start": "12:00:00"
}
],
"delivery": [
{
"end": "00:00:00",
"start": "12:00:00"
}
]
},
"sunday": {
"collection": [
{
"end": "23:00:00",
"start": "12:00:00"
}
],
"delivery": [
{
"end": "00:00:00",
"start": "12:00:00"
}
]
},
"thursday": {
"collection": [
{
"end": "14:00:00",
"start": "12:00:00"
},
{
"end": "23:00:00",
"start": "17:00:00"
}
],
"delivery": [
{
"end": "13:30:00",
"start": "12:00:00"
},
{
"end": "00:00:00",
"start": "18:00:00"
}
]
},
"tuesday": {
"collection": [
{
"end": "14:00:00",
"start": "12:00:00"
},
{
"end": "23:00:00",
"start": "17:00:00"
}
],
"delivery": [
{
"end": "13:30:00",
"start": "12:00:00"
},
{
"end": "00:00:00",
"start": "18:00:00"
}
]
},
"wednesday": {
"collection": [
{
"end": "14:00:00",
"start": "12:00:00"
},
{
"end": "23:00:00",
"start": "17:00:00"
}
],
"delivery": [
{
"end": "13:30:00",
"start": "12:00:00"
},
{
"end": "00:00:00",
"start": "18:00:00"
}
]
}
}
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Order not found",
"errorCode": "ERR1234"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "authorization: ");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu" {:headers {:authorization ""}})
require "http/client"
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"
headers = HTTP::Headers{
"authorization" => ""
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"),
Headers =
{
{ "authorization", "" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu");
var request = new RestRequest("", Method.Get);
request.AddHeader("authorization", "");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("authorization", "")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/restaurants/:tenant/:restaurantId/menu HTTP/1.1
Authorization:
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu")
.setHeader("authorization", "")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"))
.header("authorization", "")
.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}}/restaurants/:tenant/:restaurantId/menu")
.get()
.addHeader("authorization", "")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu")
.header("authorization", "")
.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}}/restaurants/:tenant/:restaurantId/menu');
xhr.setRequestHeader('authorization', '');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu',
headers: {authorization: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu';
const options = {method: 'GET', headers: {authorization: ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu',
method: 'GET',
headers: {
authorization: ''
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu")
.get()
.addHeader("authorization", "")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/restaurants/:tenant/:restaurantId/menu',
headers: {
authorization: ''
}
};
const req = http.request(options, function (res) {
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}}/restaurants/:tenant/:restaurantId/menu',
headers: {authorization: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu');
req.headers({
authorization: ''
});
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}}/restaurants/:tenant/:restaurantId/menu',
headers: {authorization: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu';
const options = {method: 'GET', headers: {authorization: ''}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"authorization": @"" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu" in
let headers = Header.add (Header.init ()) "authorization" "" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/:tenant/:restaurantId/menu",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"authorization: "
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu', [
'headers' => [
'authorization' => '',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/menu');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'authorization' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/restaurants/:tenant/:restaurantId/menu');
$request->setRequestMethod('GET');
$request->setHeaders([
'authorization' => ''
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("authorization", "")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu' -Method GET -Headers $headers
$headers=@{}
$headers.Add("authorization", "")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/:tenant/:restaurantId/menu' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'authorization': "" }
conn.request("GET", "/baseUrl/restaurants/:tenant/:restaurantId/menu", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"
headers = {"authorization": ""}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu"
response <- VERB("GET", url, add_headers('authorization' = ''), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/restaurants/:tenant/:restaurantId/menu")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["authorization"] = ''
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/restaurants/:tenant/:restaurantId/menu') do |req|
req.headers['authorization'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("authorization", "".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/restaurants/:tenant/:restaurantId/menu \
--header 'authorization: '
http GET {{baseUrl}}/restaurants/:tenant/:restaurantId/menu \
authorization:''
wget --quiet \
--method GET \
--header 'authorization: ' \
--output-document \
- {{baseUrl}}/restaurants/:tenant/:restaurantId/menu
import Foundation
let headers = ["authorization": ""]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/:tenant/:restaurantId/menu")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as 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
{
"categories": [
{
"description": "",
"id": "3",
"itemIds": [
"65143901"
],
"name": "Starters"
},
{
"description": "",
"id": "4",
"itemIds": [
"23435309",
"33445308"
],
"name": "Deals"
},
{
"description": "",
"id": "5",
"itemIds": [
"8547130",
"8547140"
],
"name": "Pizzas"
},
{
"description": "",
"id": "6",
"itemIds": [
"6537130",
"6537140"
],
"name": "Drinks"
}
],
"currency": "GBP",
"description": "My excellent menu",
"items": [
{
"dealGroups": [
{
"dealItemVariations": [
{
"additionPrice": 0,
"dealItemVariationId": "1577341",
"maxChoices": 1,
"minChoices": 0
}
],
"id": "23435309-1",
"name": "Choose your base",
"numberOfChoices": 1
},
{
"dealItemVariations": [
{
"additionPrice": 0,
"dealItemVariationId": "8547121",
"maxChoices": 1,
"minChoices": 0
},
{
"additionPrice": 0,
"dealItemVariationId": "3547157",
"maxChoices": 1,
"minChoices": 0
},
{
"additionPrice": 50,
"dealItemVariationId": "8548153",
"maxChoices": 1,
"minChoices": 0
}
],
"id": "23435309-2",
"name": "Choose your halves",
"numberOfChoices": 2
}
],
"description": "Choose each half.",
"id": "23435309",
"labels": [],
"modifierGroups": [],
"name": "Half-and-half Pizza",
"type": "deal",
"variations": [
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery"
],
"basePrice": 3099,
"dealGroupsIds": [
"23435309-1",
"23435309-2"
],
"dealOnly": false,
"id": "23435309",
"modifierGroupsIds": [],
"name": "",
"type": "noVariation"
}
]
},
{
"dealGroups": [
{
"dealItemVariations": [
{
"additionPrice": 0,
"dealItemVariationId": "9750011",
"maxChoices": 1,
"minChoices": 0
},
{
"additionPrice": 0,
"dealItemVariationId": "9750021",
"maxChoices": 1,
"minChoices": 0
},
{
"additionPrice": 0,
"dealItemVariationId": "23435309",
"maxChoices": 1,
"minChoices": 0
}
],
"id": "33445308-1",
"name": "Choose your pizza",
"numberOfChoices": 1
},
{
"dealItemVariations": [
{
"additionPrice": 13,
"dealItemVariationId": "6537130",
"maxChoices": 1,
"minChoices": 0
},
{
"additionPrice": 0,
"dealItemVariationId": "6537140",
"maxChoices": 1,
"minChoices": 0
},
{
"additionPrice": 0,
"dealItemVariationId": "7739164",
"maxChoices": 1,
"minChoices": 0
}
],
"id": "33445308-2",
"name": "Choose your drink",
"numberOfChoices": 1
}
],
"description": "Choose a 14 inch Pizza (including half-and-half) and any drink. Note: Alcohol is only available for collection.",
"id": "33445308",
"labels": [],
"modifierGroups": [],
"name": "14 inch Pizza & A Drink For 1",
"type": "deal",
"variations": [
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery"
],
"basePrice": 3099,
"dealGroupsIds": [
"33445308-1",
"33445308-2"
],
"dealOnly": false,
"id": "33445308",
"modifierGroupsIds": [],
"name": "",
"type": "noVariation"
}
]
},
{
"dealGroups": [],
"description": "",
"id": "65143901",
"labels": [],
"modifierGroups": [
{
"id": "65143901-req-1",
"maxChoices": 1,
"minChoices": 1,
"modifiers": [
{
"additionPrice": 0,
"id": "834502",
"maxChoices": 1,
"minChoices": 0,
"name": "Pitta Bread"
},
{
"additionPrice": 0,
"id": "835700",
"maxChoices": 1,
"minChoices": 0,
"name": "Sourdough"
},
{
"additionPrice": 50,
"id": "835601",
"maxChoices": 1,
"minChoices": 0,
"name": "Wholemeal"
}
],
"name": "Choose your bread"
},
{
"id": "65143901-req-2",
"maxChoices": 2,
"minChoices": 2,
"modifiers": [
{
"additionPrice": 0,
"id": "835340",
"maxChoices": 2,
"minChoices": 0,
"name": "Tzatziki"
},
{
"additionPrice": 0,
"id": "835341",
"maxChoices": 2,
"minChoices": 0,
"name": "Taramasalata"
},
{
"additionPrice": 0,
"id": "825344",
"maxChoices": 2,
"minChoices": 0,
"name": "Hummus"
},
{
"additionPrice": 0,
"id": "825346",
"maxChoices": 2,
"minChoices": 0,
"name": "Onion"
}
],
"name": "Choose your dips"
}
],
"name": "Flat Bread and Dips (Pick any 2 Dips)",
"requireOtherProducts": false,
"type": "menuItem",
"variations": [
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 650,
"dealGroupsIds": [],
"dealOnly": false,
"id": "65143901",
"kitchenNumber": "90",
"modifierGroupsIds": [
"65143901-req-1",
"65143901-req-2"
],
"name": "",
"type": "noVariation"
}
]
},
{
"dealGroups": [],
"description": "",
"id": "1577341",
"labels": [],
"modifierGroups": [
{
"id": "1577341-req-1",
"maxChoices": 1,
"minChoices": 1,
"modifiers": [
{
"additionPrice": 0,
"id": "854500",
"maxChoices": 1,
"minChoices": 0,
"name": "Classic Crust"
},
{
"additionPrice": 200,
"id": "854600",
"maxChoices": 1,
"minChoices": 0,
"name": "Stuffed Crust"
}
],
"name": "Crust"
}
],
"name": "Base",
"requireOtherProducts": true,
"type": "menuItem",
"variations": [
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 200,
"dealGroupsIds": [],
"dealOnly": true,
"id": "1577341",
"modifierGroupsIds": [
"1577341-req-1"
],
"name": "",
"type": "noVariation"
}
]
},
{
"dealGroups": [],
"description": "",
"id": "8547130",
"labels": [],
"modifierGroups": [
{
"id": "8547130-req-1",
"maxChoices": 1,
"minChoices": 1,
"modifiers": [
{
"additionPrice": 0,
"id": "854500",
"maxChoices": 1,
"minChoices": 0,
"name": "Classic Crust"
},
{
"additionPrice": 200,
"id": "854600",
"maxChoices": 1,
"minChoices": 0,
"name": "Stuffed Crust"
}
],
"name": "Choose your crust"
},
{
"id": "8547130-opt-1",
"maxChoices": 10,
"minChoices": 0,
"modifiers": [
{
"additionPrice": 50,
"id": "1000",
"maxChoices": 2,
"minChoices": 0,
"name": "Mozzarella Cheese"
},
{
"additionPrice": 50,
"id": "1001",
"maxChoices": 1,
"minChoices": 0,
"name": "Ham"
},
{
"additionPrice": 50,
"id": "1002",
"maxChoices": 1,
"minChoices": 0,
"name": "Red Onion"
},
{
"additionPrice": 50,
"id": "1003",
"maxChoices": 1,
"minChoices": 0,
"name": "Pepperoni"
},
{
"additionPrice": 50,
"id": "1004",
"maxChoices": 1,
"minChoices": 0,
"name": "Olives"
}
],
"name": "Any extra toppings?"
}
],
"name": "Margherita",
"requireOtherProducts": true,
"type": "menuItem",
"variations": [
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 500,
"dealGroupsIds": [],
"dealOnly": true,
"id": "8547121",
"kitchenNumber": "100",
"modifierGroupsIds": [
"8547130-opt-1"
],
"name": "Half",
"type": "variation"
},
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 1000,
"dealGroupsIds": [],
"dealOnly": false,
"id": "8547130",
"kitchenNumber": "100",
"modifierGroupsIds": [
"8547130-req-1",
"8547130-opt-1"
],
"name": "12 inch",
"type": "variation"
},
{
"availabilityIds": [
"1-lunch-delivery-weekday",
"2-lunch-collection-weekday",
"3-dinner-delivery-weekday",
"4-dinner-collection-weekday"
],
"basePrice": 1200,
"dealGroupsIds": [],
"dealOnly": true,
"id": "8543123",
"kitchenNumber": "200",
"modifierGroupsIds": [
"8547130-req-1",
"8547130-opt-1"
],
"name": "14 inch",
"type": "variation"
}
]
},
{
"dealGroups": [],
"description": "",
"id": "8547140",
"labels": [],
"modifierGroups": [
{
"id": "8547140-req-1",
"maxChoices": 1,
"minChoices": 1,
"modifiers": [
{
"additionPrice": 0,
"id": "854500",
"maxChoices": 1,
"minChoices": 0,
"name": "Classic Crust"
},
{
"additionPrice": 200,
"id": "854600",
"maxChoices": 1,
"minChoices": 0,
"name": "Stuffed Crust"
}
],
"name": "Choose your crust"
},
{
"id": "8547140-opt-1",
"maxChoices": 10,
"minChoices": 0,
"modifiers": [
{
"additionPrice": 50,
"id": "1000",
"maxChoices": 2,
"minChoices": 0,
"name": "Mozzarella Cheese"
},
{
"additionPrice": 50,
"id": "1001",
"maxChoices": 2,
"minChoices": 0,
"name": "Ham"
},
{
"additionPrice": 50,
"id": "1002",
"maxChoices": 2,
"minChoices": 0,
"name": "Red Onion"
},
{
"additionPrice": 50,
"id": "1003",
"maxChoices": 4,
"minChoices": 2,
"name": "Pepperoni"
},
{
"additionPrice": 50,
"id": "1004",
"maxChoices": 2,
"minChoices": 0,
"name": "Olives"
}
],
"name": "Any extra toppings?"
},
{
"id": "9755052-req-1",
"maxChoices": 1,
"minChoices": 1,
"modifiers": [
{
"additionPrice": 0,
"id": "854500",
"maxChoices": 1,
"minChoices": 0,
"name": "Classic Crust"
},
{
"additionPrice": 250,
"id": "854600",
"maxChoices": 1,
"minChoices": 0,
"name": "Stuffed Crust"
}
],
"name": "Choose your crust"
},
{
"id": "9755052-opt-1",
"maxChoices": 10,
"minChoices": 0,
"modifiers": [
{
"additionPrice": 70,
"id": "1000",
"maxChoices": 2,
"minChoices": 0,
"name": "Mozzarella Cheese"
},
{
"additionPrice": 70,
"id": "1001",
"maxChoices": 2,
"minChoices": 0,
"name": "Ham"
},
{
"additionPrice": 70,
"id": "1002",
"maxChoices": 2,
"minChoices": 0,
"name": "Red Onion"
},
{
"additionPrice": 70,
"id": "1003",
"maxChoices": 2,
"minChoices": 0,
"name": "Pepperoni"
},
{
"additionPrice": 70,
"id": "1004",
"maxChoices": 2,
"minChoices": 0,
"name": "Olives"
}
],
"name": "Any extra toppings?"
}
],
"name": "Double Pepperoni",
"requireOtherProducts": false,
"type": "menuItem",
"variations": [
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 500,
"dealGroupsIds": [],
"dealOnly": true,
"id": "8548153",
"kitchenNumber": "100",
"modifierGroupsIds": [
"8547140-opt-1"
],
"name": "Half",
"type": "variation"
},
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 1000,
"dealGroupsIds": [],
"dealOnly": false,
"id": "8547140",
"kitchenNumber": "100",
"modifierGroupsIds": [
"8547140-req-1",
"8547140-opt-1"
],
"name": "12 inch",
"type": "variation"
},
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 1200,
"dealGroupsIds": [],
"dealOnly": true,
"id": "9750021",
"kitchenNumber": "200",
"modifierGroupsIds": [
"8547140-req-1",
"8547140-opt-1"
],
"name": "14 inch",
"type": "variation"
},
{
"availabilityIds": [
"2-lunch-collection",
"4-dinner-collection"
],
"basePrice": 1200,
"dealGroupsIds": [],
"dealOnly": false,
"id": "9755052",
"kitchenNumber": "200",
"modifierGroupsIds": [
"9755052-req-1",
"9755052-opt-1"
],
"name": "18 inch",
"type": "variation"
}
]
},
{
"dealGroups": [],
"description": "",
"id": "3547157",
"labels": [
"vegetarian"
],
"modifierGroups": [
{
"id": "8547140-opt-1",
"maxChoices": 10,
"minChoices": 0,
"modifiers": [
{
"additionPrice": 50,
"id": "1000",
"maxChoices": 2,
"minChoices": 0,
"name": "Mozzarella Cheese"
},
{
"additionPrice": 50,
"id": "1001",
"maxChoices": 2,
"minChoices": 0,
"name": "Ham"
},
{
"additionPrice": 50,
"id": "1002",
"maxChoices": 2,
"minChoices": 1,
"name": "Red Onion"
},
{
"additionPrice": 50,
"id": "1003",
"maxChoices": 2,
"minChoices": 0,
"name": "Pepperoni"
},
{
"additionPrice": 50,
"id": "1004",
"maxChoices": 2,
"minChoices": 1,
"name": "Olives"
}
],
"name": "Any extra toppings?"
}
],
"name": "Vegetarian",
"requireOtherProducts": false,
"type": "menuItem",
"variations": [
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 500,
"dealGroupsIds": [],
"dealOnly": true,
"id": "3547157",
"kitchenNumber": "121",
"modifierGroupsIds": [
"8547140-opt-1"
],
"name": "",
"type": "noVariation"
}
]
},
{
"dealGroups": [],
"description": "",
"id": "6537130",
"labels": [],
"modifierGroups": [],
"name": "Coca-Cola",
"requireOtherProducts": true,
"type": "menuItem",
"variations": [
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 100,
"dealGroupsIds": [],
"dealOnly": false,
"id": "6537130",
"kitchenNumber": "300",
"modifierGroupsIds": [],
"name": "0.33L",
"type": "variation"
},
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 300,
"dealGroupsIds": [],
"dealOnly": false,
"id": "9750011",
"kitchenNumber": "400",
"modifierGroupsIds": [],
"name": "1.5L",
"type": "variation"
}
]
},
{
"dealGroups": [],
"description": "",
"id": "6537140",
"labels": [],
"modifierGroups": [],
"name": "Diet Coke",
"requireOtherProducts": true,
"type": "menuItem",
"variations": [
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 100,
"dealGroupsIds": [],
"dealOnly": false,
"id": "6537140",
"kitchenNumber": "300",
"modifierGroupsIds": [],
"name": "0.33L",
"type": "variation"
},
{
"availabilityIds": [
"1-lunch-delivery",
"2-lunch-collection",
"3-dinner-delivery",
"4-dinner-collection"
],
"basePrice": 300,
"dealGroupsIds": [],
"dealOnly": false,
"id": "9750312",
"kitchenNumber": "400",
"modifierGroupsIds": [],
"name": "1.5L",
"type": "variation"
}
]
},
{
"dealGroups": [],
"description": "",
"id": "7739164",
"labels": [],
"modifierGroups": [],
"name": "Bottle of Lager",
"requireOtherProducts": true,
"type": "menuItem",
"variations": [
{
"availabilityIds": [
"2-lunch-collection",
"4-dinner-collection"
],
"basePrice": 300,
"dealGroupsIds": [],
"dealOnly": false,
"id": "7739164",
"kitchenNumber": "700",
"modifierGroupsIds": [],
"name": "",
"type": "noVariation"
}
]
}
],
"name": "My Restaurant",
"restaurantId": "100059"
}
PUT
Set ETA for pickup
{{baseUrl}}/restaurants/driver/eta
BODY json
[
{
"etaAtRestaurant": "",
"restaurantId": ""
}
]
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/restaurants/driver/eta");
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 {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\n }\n]");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/restaurants/driver/eta" {:content-type :json
:form-params [{:etaAtRestaurant ""
:restaurantId ""}]})
require "http/client"
url = "{{baseUrl}}/restaurants/driver/eta"
headers = HTTP::Headers{
"content-type" => "application/json"
}
reqBody = "[\n {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\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}}/restaurants/driver/eta"),
Content = new StringContent("[\n {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\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}}/restaurants/driver/eta");
var request = new RestRequest("", Method.Put);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "[\n {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\n }\n]", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/restaurants/driver/eta"
payload := strings.NewReader("[\n {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\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/restaurants/driver/eta HTTP/1.1
Content-Type: application/json
Host: example.com
Content-Length: 61
[
{
"etaAtRestaurant": "",
"restaurantId": ""
}
]
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/restaurants/driver/eta")
.setHeader("content-type", "application/json")
.setBody("[\n {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\n }\n]")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/restaurants/driver/eta"))
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("[\n {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\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 {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\n }\n]");
Request request = new Request.Builder()
.url("{{baseUrl}}/restaurants/driver/eta")
.put(body)
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/restaurants/driver/eta")
.header("content-type", "application/json")
.body("[\n {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\n }\n]")
.asString();
const data = JSON.stringify([
{
etaAtRestaurant: '',
restaurantId: ''
}
]);
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/restaurants/driver/eta');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/driver/eta',
headers: {'content-type': 'application/json'},
data: [{etaAtRestaurant: '', restaurantId: ''}]
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/restaurants/driver/eta';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '[{"etaAtRestaurant":"","restaurantId":""}]'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/restaurants/driver/eta',
method: 'PUT',
headers: {
'content-type': 'application/json'
},
processData: false,
data: '[\n {\n "etaAtRestaurant": "",\n "restaurantId": ""\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 {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\n }\n]")
val request = Request.Builder()
.url("{{baseUrl}}/restaurants/driver/eta")
.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/restaurants/driver/eta',
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([{etaAtRestaurant: '', restaurantId: ''}]));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/restaurants/driver/eta',
headers: {'content-type': 'application/json'},
body: [{etaAtRestaurant: '', restaurantId: ''}],
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}}/restaurants/driver/eta');
req.headers({
'content-type': 'application/json'
});
req.type('json');
req.send([
{
etaAtRestaurant: '',
restaurantId: ''
}
]);
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}}/restaurants/driver/eta',
headers: {'content-type': 'application/json'},
data: [{etaAtRestaurant: '', restaurantId: ''}]
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/restaurants/driver/eta';
const options = {
method: 'PUT',
headers: {'content-type': 'application/json'},
body: '[{"etaAtRestaurant":"","restaurantId":""}]'
};
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 = @[ @{ @"etaAtRestaurant": @"", @"restaurantId": @"" } ];
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/restaurants/driver/eta"]
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}}/restaurants/driver/eta" in
let headers = Header.add (Header.init ()) "content-type" "application/json" in
let body = Cohttp_lwt_body.of_string "[\n {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\n }\n]" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/restaurants/driver/eta",
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([
[
'etaAtRestaurant' => '',
'restaurantId' => ''
]
]),
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}}/restaurants/driver/eta', [
'body' => '[
{
"etaAtRestaurant": "",
"restaurantId": ""
}
]',
'headers' => [
'content-type' => 'application/json',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/restaurants/driver/eta');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
[
'etaAtRestaurant' => '',
'restaurantId' => ''
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
[
'etaAtRestaurant' => '',
'restaurantId' => ''
]
]));
$request->setRequestUrl('{{baseUrl}}/restaurants/driver/eta');
$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}}/restaurants/driver/eta' -Method PUT -Headers $headers -ContentType 'application/json' -Body '[
{
"etaAtRestaurant": "",
"restaurantId": ""
}
]'
$headers=@{}
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/restaurants/driver/eta' -Method PUT -Headers $headers -ContentType 'application/json' -Body '[
{
"etaAtRestaurant": "",
"restaurantId": ""
}
]'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "[\n {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\n }\n]"
headers = { 'content-type': "application/json" }
conn.request("PUT", "/baseUrl/restaurants/driver/eta", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/restaurants/driver/eta"
payload = [
{
"etaAtRestaurant": "",
"restaurantId": ""
}
]
headers = {"content-type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/restaurants/driver/eta"
payload <- "[\n {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\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}}/restaurants/driver/eta")
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 {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\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/restaurants/driver/eta') do |req|
req.body = "[\n {\n \"etaAtRestaurant\": \"\",\n \"restaurantId\": \"\"\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}}/restaurants/driver/eta";
let payload = (
json!({
"etaAtRestaurant": "",
"restaurantId": ""
})
);
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}}/restaurants/driver/eta \
--header 'content-type: application/json' \
--data '[
{
"etaAtRestaurant": "",
"restaurantId": ""
}
]'
echo '[
{
"etaAtRestaurant": "",
"restaurantId": ""
}
]' | \
http PUT {{baseUrl}}/restaurants/driver/eta \
content-type:application/json
wget --quiet \
--method PUT \
--header 'content-type: application/json' \
--body-data '[\n {\n "etaAtRestaurant": "",\n "restaurantId": ""\n }\n]' \
--output-document \
- {{baseUrl}}/restaurants/driver/eta
import Foundation
let headers = ["content-type": "application/json"]
let parameters = [
[
"etaAtRestaurant": "",
"restaurantId": ""
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/restaurants/driver/eta")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"ignoredRestaurantIds": [
"123",
"456"
]
}
GET
Get auto-completed search terms
{{baseUrl}}/search/autocomplete/:tenant
QUERY PARAMS
searchTerm
latlong
tenant
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/search/autocomplete/:tenant" {:query-params {:searchTerm ""
:latlong ""}})
require "http/client"
url = "{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong="
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}}/search/autocomplete/:tenant?searchTerm=&latlong="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong="
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/search/autocomplete/:tenant?searchTerm=&latlong= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong="))
.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}}/search/autocomplete/:tenant?searchTerm=&latlong=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong=")
.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}}/search/autocomplete/:tenant?searchTerm=&latlong=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/search/autocomplete/:tenant',
params: {searchTerm: '', latlong: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong=';
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}}/search/autocomplete/:tenant?searchTerm=&latlong=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/search/autocomplete/:tenant?searchTerm=&latlong=',
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}}/search/autocomplete/:tenant',
qs: {searchTerm: '', latlong: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/search/autocomplete/:tenant');
req.query({
searchTerm: '',
latlong: ''
});
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}}/search/autocomplete/:tenant',
params: {searchTerm: '', latlong: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong=';
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}}/search/autocomplete/:tenant?searchTerm=&latlong="]
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}}/search/autocomplete/:tenant?searchTerm=&latlong=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong=",
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}}/search/autocomplete/:tenant?searchTerm=&latlong=');
echo $response->getBody();
setUrl('{{baseUrl}}/search/autocomplete/:tenant');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'searchTerm' => '',
'latlong' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/search/autocomplete/:tenant');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'searchTerm' => '',
'latlong' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/search/autocomplete/:tenant?searchTerm=&latlong=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/search/autocomplete/:tenant"
querystring = {"searchTerm":"","latlong":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/search/autocomplete/:tenant"
queryString <- list(
searchTerm = "",
latlong = ""
)
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong=")
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/search/autocomplete/:tenant') do |req|
req.params['searchTerm'] = ''
req.params['latlong'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/search/autocomplete/:tenant";
let querystring = [
("searchTerm", ""),
("latlong", ""),
];
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}}/search/autocomplete/:tenant?searchTerm=&latlong='
http GET '{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/search/autocomplete/:tenant?searchTerm=&latlong=")! 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
{
"terms": [
{
"classification": "Restaurant",
"term": "Pizza Palace"
},
{
"classification": "Cuisine",
"term": "Pizza"
},
{
"classification": "Dish",
"term": "Large Hawaiian"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Validation failed on one or more fields",
"errorCode": 400,
"fields": [
"latlong"
]
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"errorCode": "401"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
GET
Search restaurants
{{baseUrl}}/search/restaurants/:tenant
QUERY PARAMS
searchTerm
latlong
tenant
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong=");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/search/restaurants/:tenant" {:query-params {:searchTerm ""
:latlong ""}})
require "http/client"
url = "{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong="
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}}/search/restaurants/:tenant?searchTerm=&latlong="),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong=");
var request = new RestRequest("", Method.Get);
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong="
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/search/restaurants/:tenant?searchTerm=&latlong= HTTP/1.1
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong=")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong="))
.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}}/search/restaurants/:tenant?searchTerm=&latlong=")
.get()
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong=")
.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}}/search/restaurants/:tenant?searchTerm=&latlong=');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/search/restaurants/:tenant',
params: {searchTerm: '', latlong: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong=';
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}}/search/restaurants/:tenant?searchTerm=&latlong=',
method: 'GET',
headers: {}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong=")
.get()
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/search/restaurants/:tenant?searchTerm=&latlong=',
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}}/search/restaurants/:tenant',
qs: {searchTerm: '', latlong: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/search/restaurants/:tenant');
req.query({
searchTerm: '',
latlong: ''
});
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}}/search/restaurants/:tenant',
params: {searchTerm: '', latlong: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong=';
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}}/search/restaurants/:tenant?searchTerm=&latlong="]
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}}/search/restaurants/:tenant?searchTerm=&latlong=" in
Client.call `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong=",
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}}/search/restaurants/:tenant?searchTerm=&latlong=');
echo $response->getBody();
setUrl('{{baseUrl}}/search/restaurants/:tenant');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'searchTerm' => '',
'latlong' => ''
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/search/restaurants/:tenant');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'searchTerm' => '',
'latlong' => ''
]));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$response = Invoke-WebRequest -Uri '{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong=' -Method GET
$response = Invoke-RestMethod -Uri '{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong=' -Method GET
import http.client
conn = http.client.HTTPSConnection("example.com")
conn.request("GET", "/baseUrl/search/restaurants/:tenant?searchTerm=&latlong=")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/search/restaurants/:tenant"
querystring = {"searchTerm":"","latlong":""}
response = requests.get(url, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/search/restaurants/:tenant"
queryString <- list(
searchTerm = "",
latlong = ""
)
response <- VERB("GET", url, query = queryString, content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong=")
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/search/restaurants/:tenant') do |req|
req.params['searchTerm'] = ''
req.params['latlong'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/search/restaurants/:tenant";
let querystring = [
("searchTerm", ""),
("latlong", ""),
];
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}}/search/restaurants/:tenant?searchTerm=&latlong='
http GET '{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong='
wget --quiet \
--method GET \
--output-document \
- '{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong='
import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/search/restaurants/:tenant?searchTerm=&latlong=")! 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
{
"restaurants": [
{
"isSponsored": true,
"products": [
{
"fullName": "Chicken Korma",
"price": 799,
"productId": "289347"
},
{
"fullName": "Chicken Madras",
"price": 699,
"productId": "563454"
}
],
"restaurantId": "110230"
},
{
"isSponsored": false,
"products": [
{
"fullName": "BBQ Chicken Pizza",
"price": 1099,
"productId": "67832"
},
{
"fullName": "Chicken Burger",
"price": 899,
"productId": "23567"
}
],
"restaurantId": "229390"
}
]
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Validation failed on one or more fields",
"errorCode": 400,
"fields": [
"latlong"
]
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"errorCode": "401"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"errorCode": "422"
}
],
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"errors": [
{
"description": "Internal Server Error"
}
],
"faultId": "25bbe062-c53d-4fbc-9d6c-3df6127b94fd",
"traceId": "H3TKh4QSJUSwVBCBqEtkKw=="
}
RESPONSE HEADERS
Content-Type
application/json
RESPONSE BODY json
{
"faultId": "72d7036d-990a-4f84-9efa-ef5f40f6044b",
"traceId": "0HLOCKDKQPKIU"
}