Back to Collection Items
var os = require('os');
if (os.platform() == 'win32') {
if (os.arch() == 'ia32') {
var chilkat = require('@chilkat/ck-node21-win-ia32');
} else {
var chilkat = require('@chilkat/ck-node21-win64');
}
} else if (os.platform() == 'linux') {
if (os.arch() == 'arm') {
var chilkat = require('@chilkat/ck-node21-arm');
} else if (os.arch() == 'x86') {
var chilkat = require('@chilkat/ck-node21-linux32');
} else {
var chilkat = require('@chilkat/ck-node21-linux64');
}
} else if (os.platform() == 'darwin') {
if (os.arch() == 'arm64') {
var chilkat = require('@chilkat/ck-node21-mac-m1');
} else {
var chilkat = require('@chilkat/ck-node21-macosx');
}
}
function chilkatExample() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
var http = new chilkat.Http();
var success;
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "status": "processing",
// "partnerStatus": "Order Accepted",
// "referenceNumber": "ORDER_REFERENCE_NUMBER",
// "respondingParty ": {
// "name": "COMPANY_NAME",
// "address": "COMPANY_STREET_ADDRESS",
// "city": "COMPANY_CITY",
// "state": "COMPANY_STATE",
// "postalCode": "COMPANY_ZIP_CODE",
// "pointOfContact": {
// "name": "CONTACT_NAME",
// "role": "CONTACT_ROLE",
// "phone": "CONTACT_PHONE_NUMBER",
// "email": "CONTACT_EMAIL"
// }
// }
// }
var json = new chilkat.JsonObject();
json.UpdateString("status","processing");
json.UpdateString("partnerStatus","Order Accepted");
json.UpdateString("referenceNumber","ORDER_REFERENCE_NUMBER");
json.UpdateString("\"respondingParty \".name","COMPANY_NAME");
json.UpdateString("\"respondingParty \".address","COMPANY_STREET_ADDRESS");
json.UpdateString("\"respondingParty \".city","COMPANY_CITY");
json.UpdateString("\"respondingParty \".state","COMPANY_STATE");
json.UpdateString("\"respondingParty \".postalCode","COMPANY_ZIP_CODE");
json.UpdateString("\"respondingParty \".pointOfContact.name","CONTACT_NAME");
json.UpdateString("\"respondingParty \".pointOfContact.role","CONTACT_ROLE");
json.UpdateString("\"respondingParty \".pointOfContact.phone","CONTACT_PHONE_NUMBER");
json.UpdateString("\"respondingParty \".pointOfContact.email","CONTACT_EMAIL");
// Adds the "Authorization: Bearer {{partner_token}}" header.
http.AuthToken = "{{partner_token}}";
http.SetRequestHeader("Content-Type","application/json");
var sbRequestBody = new chilkat.StringBuilder();
json.EmitSb(sbRequestBody);
// resp: HttpResponse
var resp = http.PTextSb("PATCH","https://domain.com/",sbRequestBody,"utf-8","application/json",false,false);
if (http.LastMethodSuccess == false) {
console.log(http.LastErrorText);
return;
}
console.log(resp.StatusCode);
console.log(resp.BodyStr);
}
chilkatExample();
Curl Command
curl -X PATCH
-H "Authorization: Bearer {{partner_token}}"
-H "Content-Type: application/json"
-d '{
"status": "processing",
"partnerStatus": "Order Accepted",
"referenceNumber": "ORDER_REFERENCE_NUMBER",
"respondingParty ": {
"name": "COMPANY_NAME",
"address": "COMPANY_STREET_ADDRESS",
"city": "COMPANY_CITY",
"state": "COMPANY_STATE",
"postalCode": "COMPANY_ZIP_CODE",
"pointOfContact": {
"name": "CONTACT_NAME",
"role": "CONTACT_ROLE",
"phone": "CONTACT_PHONE_NUMBER",
"email": "CONTACT_EMAIL"
}
}
}'
https://domain.com/
Postman Collection Item JSON
{
"name": "[Partner] Send Acknowledgment Response",
"_postman_id": "1165b237-e991-481e-bd7b-f05d17b2de2f",
"request": {
"method": "PATCH",
"header": [
{
"key": "Authorization",
"value": "Bearer {{partner_token}}",
"type": "text"
},
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"status\": \"processing\",\n \"partnerStatus\": \"Order Accepted\",\n \"referenceNumber\": \"ORDER_REFERENCE_NUMBER\",\n \"respondingParty \": {\n \"name\": \"COMPANY_NAME\",\n \"address\": \"COMPANY_STREET_ADDRESS\",\n \"city\": \"COMPANY_CITY\",\n \"state\": \"COMPANY_STATE\",\n \"postalCode\": \"COMPANY_ZIP_CODE\",\n \"pointOfContact\": {\n \"name\": \"CONTACT_NAME\",\n \"role\": \"CONTACT_ROLE\",\n \"phone\": \"CONTACT_PHONE_NUMBER\",\n \"email\": \"CONTACT_EMAIL\"\n }\n }\n}"
},
"url": "{{api_host}}/partner/v2/transactions/{{transaction_id}}/response"
},
"response": [
]
}