Chilkat Online Tools

PureBasic / Coupa Postman Collection - OAuth - Master / Retrieve all SIM Records

Back to Collection Items

IncludeFile "CkJsonObject.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"

Procedure ChilkatExample()

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

    http.i = CkHttp::ckCreate()
    If http.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    success.i

    queryParams.i = CkJsonObject::ckCreate()
    If queryParams.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    CkJsonObject::ckUpdateString(queryParams,"fields","[" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "status" + Chr(34) + "," + Chr(34) + "lasy_exported_at" + Chr(34) + "," + Chr(34) + "name" + Chr(34) + "," + Chr(34) + "display_name" + Chr(34) + "," + Chr(34) + "supplier_id" + Chr(34) + "," + Chr(34) + "supplier_number" + Chr(34) + "," + Chr(34) + "federal_tax_num" + Chr(34) + "," + Chr(34) + "duns_number" + Chr(34) + "," + Chr(34) + "user_id" + Chr(34) + "," + Chr(34) + "po_email" + Chr(34) + ",{" + Chr(34) + "custom_fields" + Chr(34) + ": {}},{" + Chr(34) + "created_by" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "login" + Chr(34) + "," + Chr(34) + "email" + Chr(34) + "]},{" + Chr(34) + "updated_by" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "login" + Chr(34) + "," + Chr(34) + "email" + Chr(34) + "]},{" + Chr(34) + "supplier_information_addresses" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "kind" + Chr(34) + "," + Chr(34) + "location_code" + Chr(34) + "," + Chr(34) + "address_name" + Chr(34) + "," + Chr(34) + "street_address" + Chr(34) + "," + Chr(34) + "street_address2" + Chr(34) + "," + Chr(34) + "city" + Chr(34) + "," + Chr(34) + "postal_code" + Chr(34) + "," + Chr(34) + "state" + Chr(34) + ",{" + Chr(34) + "country" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "code" + Chr(34) + "," + Chr(34) + "name" + Chr(34) + "]},{" + Chr(34) + "custom_fields" + Chr(34) + ": {}}]},{" + Chr(34) + "supplier_information_contacts" + Chr(34) + ": [" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "supplier_information_id" + Chr(34) + "," + Chr(34) + "kind" + Chr(34) + "," + Chr(34) + "name_given" + Chr(34) + "," + Chr(34) + "name_family" + Chr(34) + "," + Chr(34) + "email" + Chr(34) + "]}]")

    ; Adds the "Authorization: Bearer <access_token>" header.
    CkHttp::setCkAuthToken(http, "<access_token>")

    resp.i = CkHttp::ckQuickRequestParams(http,"GET","https://domain.com/supplier_information",queryParams)
    If CkHttp::ckLastMethodSuccess(http) = 0
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        CkJsonObject::ckDispose(queryParams)
        ProcedureReturn
    EndIf

    Debug Str(CkHttpResponse::ckStatusCode(resp))
    Debug CkHttpResponse::ckBodyStr(resp)
    CkHttpResponse::ckDispose(resp)



    CkHttp::ckDispose(http)
    CkJsonObject::ckDispose(queryParams)


    ProcedureReturn
EndProcedure

Curl Command

curl -G -d "fields=%5B%22id%22,%22status%22,%22lasy_exported_at%22,%22name%22,%22display_name%22,%22supplier_id%22,%22supplier_number%22,%22federal_tax_num%22,%22duns_number%22,%22user_id%22,%22po_email%22,%7B%22custom_fields%22%3A%20%7B%7D%7D,%7B%22created_by%22%3A%20%5B%22id%22,%22login%22,%22email%22%5D%7D,%7B%22updated_by%22%3A%20%5B%22id%22,%22login%22,%22email%22%5D%7D,%7B%22supplier_information_addresses%22%3A%20%5B%22id%22,%22kind%22,%22location_code%22,%22address_name%22,%22street_address%22,%22street_address2%22,%22city%22,%22postal_code%22,%22state%22,%7B%22country%22%3A%20%5B%22id%22,%22code%22,%22name%22%5D%7D,%7B%22custom_fields%22%3A%20%7B%7D%7D%5D%7D,%7B%22supplier_information_contacts%22%3A%20%5B%22id%22,%22supplier_information_id%22,%22kind%22,%22name_given%22,%22name_family%22,%22email%22%5D%7D%5D"
	-H "Authorization: Bearer <access_token>"
https://domain.com/supplier_information

Postman Collection Item JSON

{
  "name": "Retrieve all SIM Records",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{URL}}/supplier_information?fields=[\"id\",\"status\",\"lasy_exported_at\",\"name\",\"display_name\",\"supplier_id\",\"supplier_number\",\"federal_tax_num\",\"duns_number\",\"user_id\",\"po_email\",{\"custom_fields\": {}},{\"created_by\": [\"id\",\"login\",\"email\"]},{\"updated_by\": [\"id\",\"login\",\"email\"]},{\"supplier_information_addresses\": [\"id\",\"kind\",\"location_code\",\"address_name\",\"street_address\",\"street_address2\",\"city\",\"postal_code\",\"state\",{\"country\": [\"id\",\"code\",\"name\"]},{\"custom_fields\": {}}]},{\"supplier_information_contacts\": [\"id\",\"supplier_information_id\",\"kind\",\"name_given\",\"name_family\",\"email\"]}]",
      "host": [
        "{{URL}}"
      ],
      "path": [
        "supplier_information"
      ],
      "query": [
        {
          "key": "fields",
          "value": "[\"id\",\"status\",\"lasy_exported_at\",\"name\",\"display_name\",\"supplier_id\",\"supplier_number\",\"federal_tax_num\",\"duns_number\",\"user_id\",\"po_email\",{\"custom_fields\": {}},{\"created_by\": [\"id\",\"login\",\"email\"]},{\"updated_by\": [\"id\",\"login\",\"email\"]},{\"supplier_information_addresses\": [\"id\",\"kind\",\"location_code\",\"address_name\",\"street_address\",\"street_address2\",\"city\",\"postal_code\",\"state\",{\"country\": [\"id\",\"code\",\"name\"]},{\"custom_fields\": {}}]},{\"supplier_information_contacts\": [\"id\",\"supplier_information_id\",\"kind\",\"name_given\",\"name_family\",\"email\"]}]"
        }
      ]
    }
  },
  "response": [
  ]
}