Chilkat Online Tools

Foxpro / APPIA API / FETCH ESCROWS

Back to Collection Items

LOCAL loHttp
LOCAL lnSuccess
LOCAL loJson
LOCAL loSbRequestBody
LOCAL loResp

* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.

loHttp = CreateObject('Chilkat_9_5_0.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.

* {
*   "trans_amount": 3000,
*   "trans_name": "mobile phone",
*   "details": "buying and selling"
* }

loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.UpdateInt("trans_amount",3000)
loJson.UpdateString("trans_name","mobile phone")
loJson.UpdateString("details","buying and selling")

* Adds the "Authorization: Bearer <access_token>" header.
loHttp.AuthToken = "<access_token>"

loSbRequestBody = CreateObject('Chilkat_9_5_0.StringBuilder')
loJson.EmitSb(loSbRequestBody)

loResp = loHttp.PTextSb("GET","https://domain.com/escrow/",loSbRequestBody,"utf-8","application/json",0,0)
IF (loHttp.LastMethodSuccess = 0) THEN
    ? loHttp.LastErrorText
    RELEASE loHttp
    RELEASE loJson
    RELEASE loSbRequestBody
    CANCEL
ENDIF

? STR(loResp.StatusCode)
? loResp.BodyStr
RELEASE loResp

RELEASE loHttp
RELEASE loJson
RELEASE loSbRequestBody

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
	-d '{
    "trans_amount": 3000,
    "trans_name": "mobile phone",
    "details": "buying and selling"
}'
https://domain.com/escrow/

Postman Collection Item JSON

{
  "name": "FETCH ESCROWS",
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{auth}}",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"trans_amount\": 3000,\n    \"trans_name\": \"mobile phone\",\n    \"details\": \"buying and selling\"\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{url}}/escrow/",
      "host": [
        "{{url}}"
      ],
      "path": [
        "escrow",
        ""
      ]
    }
  },
  "response": [
  ]
}