Open API - Request Quote

API Endpoint:

URL: https://api.routeit.cloud/konnektive/v2/post/json/request_quote
Protocol: HTTPS
Method: POST
Authentication: API Key and Secret via header
Content Type: application/json

All API calls must include this header to authorize the request.
Replace YOUR-KEY-HERE with your API key and YOUR-SECRET-HERE with your secret.
Header Key Header Value
api_key YOUR-KEY-HERE
secret YOUR-SECRET-HERE
Content-Type application/json

Body:

The body must be sent in JSON format.
{
    "order_base_value": "67.50",
	"order_base_total": "67.50",
	"order_currency_code": "USD",
	"order_type": "PRODUCT",
	"total_items": "2",
	"items": [{
		"item_id": "test_item_123",
		"item_qty": "2",
		"item_name": "Widget Number 4",
		"item_cost_per_unit": "33.75",
		"item_value_per_unit": "33.75"
	}]
}
                
Body Key Body Value Required Description
order_base_value integer, double or float greater than zero and greater than or equal to order_base_total YES Total cart replacement value, minus shipping, handling and tax.
order_base_total integer, double or float greater than or equal to zero YES Total cart price being charged to buyer, minus shipping, handling and tax. This is the amount the customer is paying after discounts, not the replacement value.
order_currency_code supported ISO Alpha-3(three letters) currency code as a string YES Currency used for the order. Supported currency codes can be pulled from our Currency Codes API.
order_type supported order type as string YES Type of order. Supported order types can be pulled from our Order Types API.
total_items integer greater than zero YES Total number of items in the cart.
items item array YES An array of all items in the cart.
item_sku string no Item SKU.
item_id string YES The merchants' unique product identifier. Used for claim reference.
item_qty integer greater than zero YES Total number of this product in the cart.
item_name string YES Display name of the product, as the customer would see it. Used for claim reference.
item_desc string no Product description as the customer would see it. Used for claim reference. Max 255 characters.
item_value_per_unit integer, double or float greater than zero and greater than or equal to item_cost_per_unit YES Replacement value per item.
item_cost_per_unit integer, double or float greater than or equal to zero YES Product price being charged to buyer per item. This is the amount the customer is paying for one item after discounts, not the replacement value.
custom_a1 string no Custom field that accepts any text string. Max 255 characters.
custom_a2 string no Custom field that accepts any text string. Max 255 characters.
custom_a3 string no Custom field that accepts any text string. Max 255 characters.
custom_a4 string no Custom field that accepts any text string. Max 255 characters.

Postman:

Code Examples:

The following are examples for reference and may require library dependencies not described here. An understanding of REST services, JSON, and web security is required to develop service clients.
Javascript - Jquery AJAX
var settings = {
  "async": true,
  "crossDomain": true,
  "url": "https://api.routeit.cloud/open_api/v1/post/json/request_quote",
  "method": "POST",
  "headers": {
    "api_key": "YOUR-KEY-HERE",
    "secret": "YOUR-SECRET-HERE",
    "content-type": "application/json",
    "cache-control": "no-cache"
  },
  "processData": false,
  "data": "{\n\t\"order_base_value\": \"67.50\",\n\t\"order_base_total\": \"67.50\",\n\t\"order_currency_code\": \"USD\",\n\t\"order_type\": \"PRODUCT\",\n\t\"total_items\": \"2\",\n\t\"items\": [{\n\t\t\"item_id\": \"test_item_WN4\",\n\t\t\"item_qty\": \"2\",\n\t\t\"item_name\": \"Widget Number 4\",\n\t\t\"item_cost_per_unit\": \"33.75\",\n\t\t\"item_value_per_unit\": \"33.75\"\n\t}]\n}"
}

$.ajax(settings).done(function (response) {
  console.log(response);
});
                            
Javascript - XHR
var data = JSON.stringify({
  "order_base_value": "67.50",
  "order_base_total": "67.50",
  "order_currency_code": "USD",
  "order_type": "PRODUCT",
  "total_items": "2",
  "items": [
    {
      "item_id": "test_item_WN4",
      "item_qty": "2",
      "item_name": "Widget Number 4",
      "item_cost_per_unit": "33.75",
      "item_value_per_unit": "33.75"
    }
  ]
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://api.routeit.cloud/open_api/v1/post/json/request_quote");
xhr.setRequestHeader("api_key", "YOUR-KEY-HERE");
xhr.setRequestHeader("secret", "YOUR-SECRET-HERE");
xhr.setRequestHeader("content-type", "application/json");
xhr.setRequestHeader("cache-control", "no-cache");

xhr.send(data);
                            
Node JS - Native
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "api.routeit.cloud",
  "port": null,
  "path": "/open_api/v1/post/json/request_quote",
  "headers": {
    "api_key": "YOUR-KEY-HERE",
    "secret": "YOUR-SECRET-HERE",
    "content-type": "application/json",
    "cache-control": "no-cache"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ order_base_value: '67.50',
  order_base_total: '67.50',
  order_currency_code: 'USD',
  order_type: 'PRODUCT',
  total_items: '2',
  items:
   [ { item_id: 'test_item_WN4',
       item_qty: '2',
       item_name: 'Widget Number 4',
       item_cost_per_unit: '33.75',
       item_value_per_unit: '33.75' } ] }));
req.end();
                            
Node JS - Request
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.routeit.cloud/open_api/v1/post/json/request_quote',
  headers:
   { 'cache-control': 'no-cache',
     'content-type': 'application/json',
     secret: 'YOUR-SECRET-HERE',
     api_key: 'YOUR-KEY-HERE' },
  body:
   { order_base_value: '67.50',
     order_base_total: '67.50',
     order_currency_code: 'USD',
     order_type: 'PRODUCT',
     total_items: '2',
     items:
      [ { item_id: 'test_item_WN4',
          item_qty: '2',
          item_name: 'Widget Number 4',
          item_cost_per_unit: '33.75',
          item_value_per_unit: '33.75' } ] },
  json: true };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});
                            
Node JS - Unirest
var unirest = require("unirest");

var req = unirest("POST", "https://api.routeit.cloud/open_api/v1/post/json/request_quote");

req.headers({
  "cache-control": "no-cache",
  "content-type": "application/json",
  "secret": "YOUR-SECRET-HERE",
  "api_key": "YOUR-KEY-HERE"
});

req.type("json");
req.send({
  "order_base_value": "67.50",
  "order_base_total": "67.50",
  "order_currency_code": "USD",
  "order_type": "PRODUCT",
  "total_items": "2",
  "items": [
    {
      "item_id": "test_item_WN4",
      "item_qty": "2",
      "item_name": "Widget Number 4",
      "item_cost_per_unit": "33.75",
      "item_value_per_unit": "33.75"
    }
  ]
});

req.end(function (res) {
  if (res.error) throw new Error(res.error);

  console.log(res.body);
});
                            
Java - OK HTTP
OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"order_base_value\": \"67.50\",\n\t\"order_base_total\": \"67.50\",\n\t\"order_currency_code\": \"USD\",\n\t\"order_type\": \"PRODUCT\",\n\t\"total_items\": \"2\",\n\t\"items\": [{\n\t\t\"item_id\": \"test_item_WN4\",\n\t\t\"item_qty\": \"2\",\n\t\t\"item_name\": \"Widget Number 4\",\n\t\t\"item_cost_per_unit\": \"33.75\",\n\t\t\"item_value_per_unit\": \"33.75\"\n\t}]\n}");
Request request = new Request.Builder()
  .url("https://api.routeit.cloud/open_api/v1/post/json/request_quote")
  .post(body)
  .addHeader("api_key", "YOUR-KEY-HERE")
  .addHeader("secret", "YOUR-SECRET-HERE")
  .addHeader("content-type", "application/json")
  .addHeader("cache-control", "no-cache")
  .build();

Response response = client.newCall(request).execute();
                            
Java - Unirest
HttpResponse<String> response = Unirest.post("https://api.routeit.cloud/open_api/v1/post/json/request_quote")
  .header("api_key", "YOUR-KEY-HERE")
  .header("secret", "YOUR-SECRET-HERE")
  .header("content-type", "application/json")
  .header("cache-control", "no-cache")
  .body("{\n\t\"order_base_value\": \"67.50\",\n\t\"order_base_total\": \"67.50\",\n\t\"order_currency_code\": \"USD\",\n\t\"order_type\": \"PRODUCT\",\n\t\"total_items\": \"2\",\n\t\"items\": [{\n\t\t\"item_id\": \"test_item_WN4\",\n\t\t\"item_qty\": \"2\",\n\t\t\"item_name\": \"Widget Number 4\",\n\t\t\"item_cost_per_unit\": \"33.75\",\n\t\t\"item_value_per_unit\": \"33.75\"\n\t}]\n}")
  .asString();
                        
C# (ReSharp)
var client = new RestClient("https://api.routeit.cloud/open_api/v1/post/json/request_quote");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/json");
request.AddHeader("secret", "YOUR-SECRET-HERE");
request.AddHeader("api_key", "YOUR-KEY-HERE");
request.AddParameter("application/json", "{\n\t\"order_base_value\": \"67.50\",\n\t\"order_base_total\": \"67.50\",\n\t\"order_currency_code\": \"USD\",\n\t\"order_type\": \"PRODUCT\",\n\t\"total_items\": \"2\",\n\t\"items\": [{\n\t\t\"item_id\": \"test_item_WN4\",\n\t\t\"item_qty\": \"2\",\n\t\t\"item_name\": \"Widget Number 4\",\n\t\t\"item_cost_per_unit\": \"33.75\",\n\t\t\"item_value_per_unit\": \"33.75\"\n\t}]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
                        
Go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.routeit.cloud/open_api/v1/post/json/request_quote"

	payload := strings.NewReader("{\n\t\"order_base_value\": \"67.50\",\n\t\"order_base_total\": \"67.50\",\n\t\"order_currency_code\": \"USD\",\n\t\"order_type\": \"PRODUCT\",\n\t\"total_items\": \"2\",\n\t\"items\": [{\n\t\t\"item_id\": \"test_item_WN4\",\n\t\t\"item_qty\": \"2\",\n\t\t\"item_name\": \"Widget Number 4\",\n\t\t\"item_cost_per_unit\": \"33.75\",\n\t\t\"item_value_per_unit\": \"33.75\"\n\t}]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("api_key", "YOUR-KEY-HERE")
	req.Header.Add("secret", "YOUR-SECRET-HERE")
	req.Header.Add("content-type", "application/json")
	req.Header.Add("cache-control", "no-cache")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
                        
Python - http.client (Python 3)
import http.client

conn = http.client.HTTPSConnection("api.routeit.cloud")

payload = "{\n\t\"order_base_value\": \"67.50\",\n\t\"order_base_total\": \"67.50\",\n\t\"order_currency_code\": \"USD\",\n\t\"order_type\": \"PRODUCT\",\n\t\"total_items\": \"2\",\n\t\"items\": [{\n\t\t\"item_id\": \"test_item_WN4\",\n\t\t\"item_qty\": \"2\",\n\t\t\"item_name\": \"Widget Number 4\",\n\t\t\"item_cost_per_unit\": \"33.75\",\n\t\t\"item_value_per_unit\": \"33.75\"\n\t}]\n}"

headers = {
    'api_key': "YOUR-KEY-HERE",
    'secret': "YOUR-SECRET-HERE",
    'content-type': "application/json",
    'cache-control': "no-cache"
    }

conn.request("POST", "/open_api/v1/post/json/request_quote", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
                        
Python - Requests
import requests

url = "https://api.routeit.cloud/open_api/v1/post/json/request_quote"

payload = "{\n\t\"order_base_value\": \"67.50\",\n\t\"order_base_total\": \"67.50\",\n\t\"order_currency_code\": \"USD\",\n\t\"order_type\": \"PRODUCT\",\n\t\"total_items\": \"2\",\n\t\"items\": [{\n\t\t\"item_id\": \"test_item_WN4\",\n\t\t\"item_qty\": \"2\",\n\t\t\"item_name\": \"Widget Number 4\",\n\t\t\"item_cost_per_unit\": \"33.75\",\n\t\t\"item_value_per_unit\": \"33.75\"\n\t}]\n}"
headers = {
    'api_key': "YOUR-KEY-HERE",
    'secret': "YOUR-SECRET-HERE",
    'content-type': "application/json",
    'cache-control': "no-cache"
    }

response = requests.request("POST", url, data=payload, headers=headers)

print(response.text)
                        
Ruby (NET::Http)
require 'uri'
require 'net/http'

url = URI("https://api.routeit.cloud/open_api/v1/post/json/request_quote")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["api_key"] = 'YOUR-KEY-HERE'
request["secret"] = 'YOUR-SECRET-HERE'
request["content-type"] = 'application/json'
request["cache-control"] = 'no-cache'
request.body = "{\n\t\"order_base_value\": \"67.50\",\n\t\"order_base_total\": \"67.50\",\n\t\"order_currency_code\": \"USD\",\n\t\"order_type\": \"PRODUCT\",\n\t\"total_items\": \"2\",\n\t\"items\": [{\n\t\t\"item_id\": \"test_item_WN4\",\n\t\t\"item_qty\": \"2\",\n\t\t\"item_name\": \"Widget Number 4\",\n\t\t\"item_cost_per_unit\": \"33.75\",\n\t\t\"item_value_per_unit\": \"33.75\"\n\t}]\n}"

response = http.request(request)
puts response.read_body
                        
PHP - HttpRequest
<?php

$request = new HttpRequest();
$request->setUrl('https://api.routeit.cloud/open_api/v1/post/json/request_quote');
$request->setMethod(HTTP_METH_POST);

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'content-type' => 'application/json',
  'secret' => 'YOUR-SECRET-HERE',
  'api_key' => 'YOUR-KEY-HERE'
));

$request->setBody('{
	"order_base_value": "67.50",
	"order_base_total": "67.50",
	"order_currency_code": "USD",
	"order_type": "PRODUCT",
	"total_items": "2",
	"items": [{
		"item_id": "test_item_WN4",
		"item_qty": "2",
		"item_name": "Widget Number 4",
		"item_cost_per_unit": "33.75",
		"item_value_per_unit": "33.75"
	}]
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}
                        
PHP - peci_http
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
	"order_base_value": "67.50",
	"order_base_total": "67.50",
	"order_currency_code": "USD",
	"order_type": "PRODUCT",
	"total_items": "2",
	"items": [{
		"item_id": "test_item_WN4",
		"item_qty": "2",
		"item_name": "Widget Number 4",
		"item_cost_per_unit": "33.75",
		"item_value_per_unit": "33.75"
	}]
}');

$request->setRequestUrl('https://api.routeit.cloud/open_api/v1/post/json/request_quote');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'content-type' => 'application/json',
  'secret' => 'YOUR-SECRET-HERE',
  'api_key' => 'YOUR-KEY-HERE'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
                        
PHP - cURL
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.routeit.cloud/open_api/v1/post/json/request_quote",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n\t\"order_base_value\": \"67.50\",\n\t\"order_base_total\": \"67.50\",\n\t\"order_currency_code\": \"USD\",\n\t\"order_type\": \"PRODUCT\",\n\t\"total_items\": \"2\",\n\t\"items\": [{\n\t\t\"item_id\": \"test_item_WN4\",\n\t\t\"item_qty\": \"2\",\n\t\t\"item_name\": \"Widget Number 4\",\n\t\t\"item_cost_per_unit\": \"33.75\",\n\t\t\"item_value_per_unit\": \"33.75\"\n\t}]\n}",
  CURLOPT_HTTPHEADER => array(
    "api_key: YOUR-KEY-HERE",
    "cache-control: no-cache",
    "content-type: application/json",
    "secret: YOUR-SECRET-HERE"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
                        
HTTP
POST /open_api/v1/post/json/request_quote HTTP/1.1
Host: api.routeit.cloud
api_key: YOUR-KEY-HERE
secret: YOUR-SECRET-HERE
Content-Type: application/json
Cache-Control: no-cache

{
	"order_base_value": "67.50",
	"order_base_total": "67.50",
	"order_currency_code": "USD",
	"order_type": "PRODUCT",
	"total_items": "2",
	"items": [{
		"item_id": "test_item_WN4",
		"item_qty": "2",
		"item_name": "Widget Number 4",
		"item_cost_per_unit": "33.75",
		"item_value_per_unit": "33.75"
	}]
}
                        
Shell - wget
wget --quiet \
  --method POST \
  --header 'api_key: YOUR-KEY-HERE' \
  --header 'secret: YOUR-SECRET-HERE' \
  --header 'content-type: application/json' \
  --header 'cache-control: no-cache' \
  --body-data '{\n	"order_base_value": "67.50",\n	"order_base_total": "67.50",\n	"order_currency_code": "USD",\n	"order_type": "PRODUCT",\n	"total_items": "2",\n	"items": [{\n		"item_id": "test_item_WN4",\n		"item_qty": "2",\n		"item_name": "Widget Number 4",\n		"item_cost_per_unit": "33.75",\n		"item_value_per_unit": "33.75"\n	}]\n}' \
  --output-document \
  - https://api.routeit.cloud/open_api/v1/post/json/request_quote
                        
Shell - Httpie
echo '{
	"order_base_value": "67.50",
	"order_base_total": "67.50",
	"order_currency_code": "USD",
	"order_type": "PRODUCT",
	"total_items": "2",
	"items": [{
		"item_id": "test_item_WN4",
		"item_qty": "2",
		"item_name": "Widget Number 4",
		"item_cost_per_unit": "33.75",
		"item_value_per_unit": "33.75"
	}]
}' |  \
  http POST https://api.routeit.cloud/open_api/v1/post/json/request_quote \
  api_key:YOUR-KEY-HERE \
  cache-control:no-cache \
  content-type:application/json \
  secret:YOUR-SECRET-HERE
                        
Shell - cURL
curl --request POST \
  --url https://api.routeit.cloud/open_api/v1/post/json/request_quote \
  --header 'api_key: YOUR-KEY-HERE' \
  --header 'cache-control: no-cache' \
  --header 'content-type: application/json' \
  --header 'secret: YOUR-SECRET-HERE' \
  --data '{\n	"order_base_value": "67.50",\n	"order_base_total": "67.50",\n	"order_currency_code": "USD",\n	"order_type": "PRODUCT",\n	"total_items": "2",\n	"items": [{\n		"item_id": "test_item_WN4",\n		"item_qty": "2",\n		"item_name": "Widget Number 4",\n		"item_cost_per_unit": "33.75",\n		"item_value_per_unit": "33.75"\n	}]\n}'
                        
cURL
curl -X POST -H "api_key: YOUR-KEY-HERE" -H "secret: YOUR-SECRET-HERE" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H '{
	"order_base_value": "67.50",
	"order_base_total": "67.50",
	"order_currency_code": "USD",
	"order_type": "PRODUCT",
	"total_items": "2",
	"items": [{
		"item_id": "test_item_WN4",
		"item_qty": "2",
		"item_name": "Widget Number 4",
		"item_cost_per_unit": "33.75",
		"item_value_per_unit": "33.75"
	}]
}' "https://api.routeit.cloud/open_api/v1/post/json/request_quote"
                        
C (LibCurl)
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.routeit.cloud/open_api/v1/post/json/request_quote");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "cache-control: no-cache");
headers = curl_slist_append(headers, "content-type: application/json");
headers = curl_slist_append(headers, "secret: YOUR-SECRET-HERE");
headers = curl_slist_append(headers, "api_key: YOUR-KEY-HERE");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n\t\"order_base_value\": \"67.50\",\n\t\"order_base_total\": \"67.50\",\n\t\"order_currency_code\": \"USD\",\n\t\"order_type\": \"PRODUCT\",\n\t\"total_items\": \"2\",\n\t\"items\": [{\n\t\t\"item_id\": \"test_item_WN4\",\n\t\t\"item_qty\": \"2\",\n\t\t\"item_name\": \"Widget Number 4\",\n\t\t\"item_cost_per_unit\": \"33.75\",\n\t\t\"item_value_per_unit\": \"33.75\"\n\t}]\n}");

CURLcode ret = curl_easy_perform(hnd);
                        
Objective-C (NSURL)
#import <Foundation/Foundation.h>

NSDictionary *headers = @{ @"api_key": @"YOUR-KEY-HERE",
                           @"secret": @"YOUR-SECRET-HERE",
                           @"content-type": @"application/json",
                           @"cache-control": @"no-cache" };
NSDictionary *parameters = @{ @"order_base_value": @"67.50",
                              @"order_base_total": @"67.50",
                              @"order_currency_code": @"USD",
                              @"order_type": @"PRODUCT",
                              @"total_items": @"2",
                              @"items": @[ @{ @"item_id": @"test_item_WN4", @"item_qty": @"2", @"item_name": @"Widget Number 4", @"item_cost_per_unit": @"33.75", @"item_value_per_unit": @"33.75" } ] };

NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://api.routeit.cloud/open_api/v1/post/json/request_quote"]
                                                       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];
                        
Swift (NSURL)
import Foundation

let headers = [
  "api_key": "YOUR-KEY-HERE",
  "secret": "YOUR-SECRET-HERE",
  "content-type": "application/json",
  "cache-control": "no-cache"
]
let parameters = [
  "order_base_value": "67.50",
  "order_base_total": "67.50",
  "order_currency_code": "USD",
  "order_type": "PRODUCT",
  "total_items": "2",
  "items": [
    [
      "item_id": "test_item_WN4",
      "item_qty": "2",
      "item_name": "Widget Number 4",
      "item_cost_per_unit": "33.75",
      "item_value_per_unit": "33.75"
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.routeit.cloud/open_api/v1/post/json/request_quote")! 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)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
                        
OCaml (Cohttp)
open Cohttp_lwt_unix
open Cohttp
open Lwt

let uri = Uri.of_string "https://api.routeit.cloud/open_api/v1/post/json/request_quote" in
let headers = Header.init ()
  |> fun h -> Header.add h "api_key" "YOUR-KEY-HERE"
  |> fun h -> Header.add h "secret" "YOUR-SECRET-HERE"
  |> fun h -> Header.add h "content-type" "application/json"
  |> fun h -> Header.add h "cache-control" "no-cache"
in
let body = Cohttp_lwt_body.of_string "{\n\t\"order_base_value\": \"67.50\",\n\t\"order_base_total\": \"67.50\",\n\t\"order_currency_code\": \"USD\",\n\t\"order_type\": \"PRODUCT\",\n\t\"total_items\": \"2\",\n\t\"items\": [{\n\t\t\"item_id\": \"test_item_WN4\",\n\t\t\"item_qty\": \"2\",\n\t\t\"item_name\": \"Widget Number 4\",\n\t\t\"item_cost_per_unit\": \"33.75\",\n\t\t\"item_value_per_unit\": \"33.75\"\n\t}]\n}" in

Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
  (* Do stuff with the result *)
                        

Response:

The response returns JSON and consists of the result, error_messages, and data.
{
    "result": "SUCCESS",
    "error_messages": null,
    "data": {
        "route_quote_id": 1,
        "order_base_value": 67.5,
        "order_base_total": 67.5,
        "order_currency_code": "USD",
        "order_type": "PRODUCT",
        "insurance_cost_usd": 2.95,
        "suggested_insurance_price": 3.84,
        "suggested_insurance_currency": "USD",
        "exchange_rate": 1,
        "total_items": 2,
        "items": [{
            "item_sku": null,
            "item_id": "test_item_123",
            "item_qty": 2,
            "item_name": "Widget Number 4",
            "item_desc": null,
            "item_cost_per_unit": 33.75,
            "item_value_per_unit": 33.75
        }],
    "custom_a1": null,
    "custom_a2": null,
    "custom_a3": null,
    "custom_a4": null,
    "ip_address": "192.182.192.205",
    "created": 1480878291796
  }
}
                
Response Body Key Response Body Value Description
result SUCCESS or ERROR Only returns SUCCESS or ERROR.
error_messages null or error messages Returns null if result is SUCCESS or an array of error strings if result is ERROR.
data data envelope or null Returns data envelope if result is SUCCESS or null if result is ERROR.
route_quote_id integer The Route Quote ID. Needed to use the Route Widget and/or call the Insure Order API.
order_base_value float Reiterates the value sent in to confirm acceptance.
order_base_total float Reiterates the value sent in to confirm acceptance.
order_currency_code string Reiterates the value sent in to confirm acceptance.
order_type string Reiterates the value sent in to confirm acceptance.
insurance_cost_usd float Total cost of insurance USD, that Route will charge the merchant to insure this order.
suggested_insurance_price float Suggest amount, in the same currency as the order, the merchant should charge the customer to insure this order.
suggested_insurance_currency ISO Alpha-3(three letters) currency code as a string Currency code of suggested_insurance_price. Should be the same as order_currency_code.
exchange_rate float Exchange rate of USD to order_currency_code at the time of quote.
total_items integer Reiterates the value sent in to confirm acceptance.
items item array Reiterates the array sent in to confirm acceptance.
item_sku string Reiterates the value sent in to confirm acceptance.
item_id string Reiterates the value sent in to confirm acceptance.
item_qty integer Reiterates the value sent in to confirm acceptance.
item_name string Reiterates the value sent in to confirm acceptance.
item_desc string Reiterates the value sent in to confirm acceptance.
item_cost_per_unit float Reiterates the value sent in to confirm acceptance.
item_value_per_unit float Reiterates the value sent in to confirm acceptance.
custom_a1 string Reiterates the value sent in to confirm acceptance.
custom_a2 string Reiterates the value sent in to confirm acceptance.
custom_a3 string Reiterates the value sent in to confirm acceptance.
custom_a4 string Reiterates the value sent in to confirm acceptance.
ip_address string IP address of the server making the request.
created timestamp Timestamp of the request.

Errors:

This API can return the following errors as strings:
This API requires request method POST.
This API call must include a valid partner_key in the header to authenticate.
Invalid api_key or secret.
No billing setup for these keys. Live API requests require valid billing. If this is a test, use the Test API keys.
Missing ALL required parameters.
Parameter order_base_value must be greater than zero.
Parameter order_base_value must be the same as order_base_total or greater than order_base_total.
Parameter order_base_value must be zero or greater.
Missing required parameter order_currency_code.
Missing required parameter order_type.
Missing required parameter total_items.
One or more items missing required parameter item_id.
Required parameter item_id must be one or greater.
One or more items missing required parameter item_name.
Required parameter item_value_per_unit must be zero or greater.
Parameter item_value_per_unit must be the same as item_cost_per_unit or greater than item_cost_per_unit.
Required parameter item_cost_per_unit must be zero or greater.
The sum of item_cost_per_unit does not equal order_base_total.
The sum of item_value_per_unit does not equal order_base_value.
The sum of item_qty does not equal total_items.