Back to Collection Items
func chilkatTest() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()!
var success: Bool
// 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": "completed",
// "partnerStatus": "Inspection Scheduled",
// "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"
// }
// },
// "loanFormat": "application/vnd.plm-2.0.0+json",
// "loan": {
// "propertyAppraisedValueAmount": "1000000"
// },
// "resources": [
// {
// "id": "{{partner_resource_id}}",
// "name": "{{partner_resource_name}}",
// "mimeType": "{{partner_resource_mimeType}}"
// }
// ]
// }
let json = CkoJsonObject()!
json.update("status", value: "completed")
json.update("partnerStatus", value: "Inspection Scheduled")
json.update("referenceNumber", value: "ORDER_REFERENCE_NUMBER")
json.update("\"respondingParty \".name", value: "COMPANY_NAME")
json.update("\"respondingParty \".address", value: "COMPANY_STREET_ADDRESS")
json.update("\"respondingParty \".city", value: "COMPANY_CITY")
json.update("\"respondingParty \".state", value: "COMPANY_STATE")
json.update("\"respondingParty \".postalCode", value: "COMPANY_ZIP_CODE")
json.update("\"respondingParty \".pointOfContact.name", value: "CONTACT_NAME")
json.update("\"respondingParty \".pointOfContact.role", value: "CONTACT_ROLE")
json.update("\"respondingParty \".pointOfContact.phone", value: "CONTACT_PHONE_NUMBER")
json.update("\"respondingParty \".pointOfContact.email", value: "CONTACT_EMAIL")
json.update("loanFormat", value: "application/vnd.plm-2.0.0+json")
json.update("loan.propertyAppraisedValueAmount", value: "1000000")
json.update("resources[0].id", value: "{{partner_resource_id}}")
json.update("resources[0].name", value: "{{partner_resource_name}}")
json.update("resources[0].mimeType", value: "{{partner_resource_mimeType}}")
http.setRequestHeader("Content-Type", value: "application/json")
// Adds the "Authorization: Bearer {{partner_token}}" header.
http.authToken = "{{partner_token}}"
let sbRequestBody = CkoStringBuilder()!
json.emitSb(sbRequestBody)
var resp: CkoHttpResponse? = http.pTextSb("PATCH", url: "https://domain.com/", textData: sbRequestBody, charset: "utf-8", contentType: "application/json", md5: false, gzip: false)
if http.lastMethodSuccess == false {
print("\(http.lastErrorText!)")
return
}
print("\(resp!.statusCode.intValue)")
print("\(resp!.bodyStr!)")
resp = nil
}
Curl Command
curl -X PATCH
-H "Content-Type: application/json"
-H "Authorization: Bearer {{partner_token}}"
-d '{
"status": "completed",
"partnerStatus": "Inspection Scheduled",
"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"
}
},
"loanFormat": "application/vnd.plm-2.0.0+json",
"loan": {
"propertyAppraisedValueAmount": "1000000"
},
"resources": [
{
"id": "{{partner_resource_id}}",
"name": "{{partner_resource_name}}",
"mimeType": "{{partner_resource_mimeType}}"
}
]
}'
https://domain.com/
Postman Collection Item JSON
{
"name": "[Partner] Send Completed Response",
"_postman_id": "476af59a-fb96-4126-8f16-4a59f0f324e1",
"request": {
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
},
{
"key": "Authorization",
"value": "Bearer {{partner_token}}",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"status\": \"completed\",\n \"partnerStatus\": \"Inspection Scheduled\",\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 \"loanFormat\": \"application/vnd.plm-2.0.0+json\",\n \"loan\": {\n \"propertyAppraisedValueAmount\": \"1000000\"\n },\n \"resources\": [\n {\n \t\"id\": \"{{partner_resource_id}}\",\n \t\"name\": \"{{partner_resource_name}}\",\n \t\"mimeType\": \"{{partner_resource_mimeType}}\"\n }\n ]\n}"
},
"url": "{{api_host}}/partner/v2/transactions/{{transaction_id}}/response"
},
"response": [
]
}