Chilkat Online Tools

Classic ASP / EPC 2.0 - Partner Sandbox - 19.4 November [External] / [Partner] Send Completed Response

Back to Collection Items

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Http")
set http = Server.CreateObject("Chilkat.Http")

' 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}}"
'     }
'   ]
' }

' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set json = Server.CreateObject("Chilkat.JsonObject")
success = json.UpdateString("status","completed")
success = json.UpdateString("partnerStatus","Inspection Scheduled")
success = json.UpdateString("referenceNumber","ORDER_REFERENCE_NUMBER")
success = json.UpdateString("""respondingParty "".name","COMPANY_NAME")
success = json.UpdateString("""respondingParty "".address","COMPANY_STREET_ADDRESS")
success = json.UpdateString("""respondingParty "".city","COMPANY_CITY")
success = json.UpdateString("""respondingParty "".state","COMPANY_STATE")
success = json.UpdateString("""respondingParty "".postalCode","COMPANY_ZIP_CODE")
success = json.UpdateString("""respondingParty "".pointOfContact.name","CONTACT_NAME")
success = json.UpdateString("""respondingParty "".pointOfContact.role","CONTACT_ROLE")
success = json.UpdateString("""respondingParty "".pointOfContact.phone","CONTACT_PHONE_NUMBER")
success = json.UpdateString("""respondingParty "".pointOfContact.email","CONTACT_EMAIL")
success = json.UpdateString("loanFormat","application/vnd.plm-2.0.0+json")
success = json.UpdateString("loan.propertyAppraisedValueAmount","1000000")
success = json.UpdateString("resources[0].id","{{partner_resource_id}}")
success = json.UpdateString("resources[0].name","{{partner_resource_name}}")
success = json.UpdateString("resources[0].mimeType","{{partner_resource_mimeType}}")

http.SetRequestHeader "Content-Type","application/json"
' Adds the "Authorization: Bearer {{partner_token}}" header.
http.AuthToken = "{{partner_token}}"

' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.StringBuilder")
set sbRequestBody = Server.CreateObject("Chilkat.StringBuilder")
success = json.EmitSb(sbRequestBody)

' resp is a Chilkat.HttpResponse
Set resp = http.PTextSb("PATCH","https://domain.com/",sbRequestBody,"utf-8","application/json",0,0)
If (http.LastMethodSuccess = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( http.LastErrorText) & "</pre>"
    Response.End
End If

Response.Write "<pre>" & Server.HTMLEncode( resp.StatusCode) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( resp.BodyStr) & "</pre>"


%>
</body>
</html>

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": [
  ]
}