Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Json
oleobject loo_SbRequestBody
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
// 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"
// }
// }
// }
loo_Json = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("status","processing")
loo_Json.UpdateString("partnerStatus","Order Accepted")
loo_Json.UpdateString("referenceNumber","ORDER_REFERENCE_NUMBER")
loo_Json.UpdateString("~"respondingParty ~".name","COMPANY_NAME")
loo_Json.UpdateString("~"respondingParty ~".address","COMPANY_STREET_ADDRESS")
loo_Json.UpdateString("~"respondingParty ~".city","COMPANY_CITY")
loo_Json.UpdateString("~"respondingParty ~".state","COMPANY_STATE")
loo_Json.UpdateString("~"respondingParty ~".postalCode","COMPANY_ZIP_CODE")
loo_Json.UpdateString("~"respondingParty ~".pointOfContact.name","CONTACT_NAME")
loo_Json.UpdateString("~"respondingParty ~".pointOfContact.role","CONTACT_ROLE")
loo_Json.UpdateString("~"respondingParty ~".pointOfContact.phone","CONTACT_PHONE_NUMBER")
loo_Json.UpdateString("~"respondingParty ~".pointOfContact.email","CONTACT_EMAIL")
// Adds the "Authorization: Bearer {{partner_token}}" header.
loo_Http.AuthToken = "{{partner_token}}"
loo_Http.SetRequestHeader("Content-Type","application/json")
loo_SbRequestBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Json.EmitSb(loo_SbRequestBody)
loo_Resp = loo_Http.PTextSb("PATCH","https://domain.com/",loo_SbRequestBody,"utf-8","application/json",0,0)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Json
destroy loo_SbRequestBody
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_Json
destroy loo_SbRequestBody
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": [
]
}