Chilkat Online Tools

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

Back to Collection Items

#include <CkHttpW.h>
#include <CkHttpRequestW.h>
#include <CkHttpResponseW.h>

void ChilkatSample(void)
    {
    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkHttpW http;
    bool success;

    CkHttpRequestW req;
    req.put_HttpVerb(L"PATCH");
    req.put_Path(L"/public/v1/documents/{{document_id}}/status");
    req.put_ContentType(L"multipart/form-data");
    success = req.AddFileForUpload2(L"file",L" path to file",L"application/octet-stream");

    req.AddHeader(L"Authorization",L"API-Key {{api_key}}");
    req.AddHeader(L"Expect",L"100-continue");

    CkHttpResponseW *resp = http.SynchronousRequest(L"api.pandadoc.com",443,true,req);
    if (http.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",http.lastErrorText());
        return;
    }

    wprintf(L"%d\n",resp->get_StatusCode());
    wprintf(L"%s\n",resp->bodyStr());
    delete resp;
    }

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": [
  ]
}