Chilkat Online Tools

autoit / Coupa Postman Collection - OAuth - Master / Get Supplier - using Status

Back to Collection Items

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

$oHttp = ObjCreate("Chilkat.Http")
Local $bSuccess

$oQueryParams = ObjCreate("Chilkat.JsonObject")
$oQueryParams.UpdateString("status","active")
$oQueryParams.UpdateString("fields","[""id"",""number"",""status""]")

; Adds the "Authorization: Bearer <access_token>" header.
$oHttp.AuthToken = "<access_token>"

Local $oResp = $oHttp.QuickRequestParams("GET","https://domain.com/suppliers/",$oQueryParams)
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite($oResp.StatusCode & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)

Curl Command

curl -G -d "status=active"
	-d "fields=%5B%22id%22,%22number%22,%22status%22%5D"
	-H "Authorization: Bearer <access_token>"
https://domain.com/suppliers/

Postman Collection Item JSON

{
  "name": "Get Supplier - using Status",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{URL}}/suppliers/?status=active&fields=[\"id\",\"number\",\"status\"]",
      "host": [
        "{{URL}}"
      ],
      "path": [
        "suppliers",
        ""
      ],
      "query": [
        {
          "key": "status",
          "value": "active"
        },
        {
          "key": "fields",
          "value": "[\"id\",\"number\",\"status\"]"
        }
      ]
    }
  },
  "response": [
  ]
}