Chilkat Online Tools

PureBasic / Coupa Postman Collection - OAuth - Master / Submit for approval

Back to Collection Items

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

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

    resp.i = CkHttp::ckQuickRequest(http,"PUT","https://domain.com/contracts/:id/submit_for_approval?fields=[" + Chr(34) + "id" + Chr(34) + "," + Chr(34) + "status" + Chr(34) + "]")
    If CkHttp::ckLastMethodSuccess(http) = 0
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        ProcedureReturn
    EndIf

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



    CkHttp::ckDispose(http)


    ProcedureReturn
EndProcedure

Curl Command

curl -X PUT
	-H "Authorization: Bearer <access_token>"
https://domain.com/contracts/:id/submit_for_approval?fields=["id","status"]

Postman Collection Item JSON

{
  "name": "Submit for approval",
  "request": {
    "method": "PUT",
    "header": [
    ],
    "url": {
      "raw": "{{URL}}/contracts/:id/submit_for_approval?fields=[\"id\",\"status\"]",
      "host": [
        "{{URL}}"
      ],
      "path": [
        "contracts",
        ":id",
        "submit_for_approval"
      ],
      "query": [
        {
          "key": "fields",
          "value": "[\"id\",\"status\"]"
        }
      ],
      "variable": [
        {
          "key": "id",
          "value": "375"
        }
      ]
    }
  },
  "response": [
  ]
}