Chilkat Online Tools

PureBasic / PandaDoc API Reference / Change Document Status (manually)

Back to Collection Items

IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
IncludeFile "CkHttpRequest.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

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

    CkHttpRequest::setCkHttpVerb(req, "PATCH")
    CkHttpRequest::setCkPath(req, "/public/v1/documents/{{document_id}}/status")
    CkHttpRequest::setCkContentType(req, "multipart/form-data")
    success = CkHttpRequest::ckAddFileForUpload2(req,"file"," path to file","application/octet-stream")

    CkHttpRequest::ckAddHeader(req,"Authorization","API-Key {{api_key}}")
    CkHttpRequest::ckAddHeader(req,"Expect","100-continue")

    resp.i = CkHttp::ckSynchronousRequest(http,"api.pandadoc.com",443,1,req)
    If CkHttp::ckLastMethodSuccess(http) = 0
        Debug CkHttp::ckLastErrorText(http)
        CkHttp::ckDispose(http)
        CkHttpRequest::ckDispose(req)
        ProcedureReturn
    EndIf

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



    CkHttp::ckDispose(http)
    CkHttpRequest::ckDispose(req)


    ProcedureReturn
EndProcedure

Curl Command

curl -X PATCH
	-H "Authorization: Bearer {{access_token}}"
	-H "Authorization: API-Key {{api_key}}"
	--form 'file=@"/path/to/file"'
https://api.pandadoc.com/public/v1/documents/{{document_id}}/status

Postman Collection Item JSON

{
  "name": "Change Document Status (manually)",
  "request": {
    "method": "PATCH",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{access_token}}",
        "type": "text",
        "disabled": true
      },
      {
        "key": "Authorization",
        "value": "API-Key {{api_key}}",
        "type": "text"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "file",
          "type": "file",
          "src": [
          ]
        },
        {
          "key": "data",
          "value": "{\n    \"status\": 2,\n    \"note\": \"A private note\",\n    \"notify_recipients\": false\n}",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "https://api.pandadoc.com/public/v1/documents/{{document_id}}/status",
      "protocol": "https",
      "host": [
        "api",
        "pandadoc",
        "com"
      ],
      "path": [
        "public",
        "v1",
        "documents",
        "{{document_id}}",
        "status"
      ]
    }
  },
  "response": [
  ]
}