In this guide, we're going to take you through how you can list linked orders through the Kodaris API.
Video overview:
Example
// Login to our account
var loginRes = kd.http.fetch({
method: 'POST',
url: 'https://content.kodaris.com/api/user/customer/apiKeyLogin',
version: 2,
body: {
apiKey: 'xxxx'
},
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
});
// keep our session token for future requests
var userSessionApiKey = loginRes.body.data.userSessionApiKey;
// get CRSF token for requests
var tokenRes = kd.http.fetch({
method: 'GET',
url: 'https://content.kodaris.com/api/user/customer/authToken',
version: 2,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'userSessionApiKey': userSessionApiKey
}
});
// keep our token for future requests
var token = tokenRes.body.data;
// get linked orders for order with id=3022
var orderRes = kd.http.fetch({
method: 'GET',
url: 'https://content.kodaris.com/api/account/order/3022/linkedOrders',
version: 2,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'userSessionApiKey': userSessionApiKey,
'X-CSRF-TOKEN': token
}
});
kd.log('orderRes', orderRes);
-> response ->
{
"status" : 200,
"errors" : null,
"body" : {
"success" : true,
"code" : 200,
"messages" : { },
"errors" : { },
"data" : {
"0" : {
"orderID" : 3025,
"organization" : "Big Company",
"firstName" : "Ana",
"lastName" : "Serra",
"email1" : "ana@kodaris.com",
"phone1" : "12345678",
"address1" : "Atlanta, GA, USA",
"address2" : null,
"city" : "Atlanta",
"state" : "GA",
"postalCode" : "12345",
"country" : "US",
"countryName" : "US",
"deliveryOrganization" : "Big Company",
"deliveryFirstName" : "Ana",
"deliveryLastName" : "Serra",
"deliveryEmail1" : "ana@kodaris.com",
"deliveryPhone1" : "12345678",
"deliveryAddress1" : "Atlanta, GA, USA",
"deliveryAddress2" : "",
"deliveryCity" : "Atlanta",
"deliveryState" : "GA",
"deliveryPostalCode" : "12345",
"deliveryCountry" : "US",
"deliveryCountryName" : "US",
"completed" : "2024-05-21 19:10:13:052",
"orderNumber" : 2318,
"status" : "Received",
"notes" : "Ana Serra - 12345678",
"purchaseOrder" : "12345",
"extra5" : "2315-02",
"shippingMethod" : "CPU",
"billingAddressCode" : null,
"deliveryAddressCode" : null,
"trackingNumber" : null,
"customerID" : null,
"companyID" : 473,
"displayPricing" : true,
"subtotal" : 1.84,
"shipping" : 5,
"extraChargeTaxable" : 0,
"extraCharge" : 0,
"tax" : 0,
"total" : 6.84
},
"1" : {
"orderID" : 3026,
"organization" : "Big Company",
"firstName" : "Analia",
"lastName" : "Serra",
"email1" : "analia@kodaris.com",
"phone1" : "12345678",
"address1" : "Austin, TX, USA",
"address2" : null,
"city" : "Austin",
"state" : "TX",
"postalCode" : "12345",
"country" : "US",
"countryName" : "US",
"deliveryOrganization" : "Big Company",
... omitted for brevity