Chilkat Online Tools

C / PandaDoc API Reference / Get Access Code

Back to Collection Items

#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkHttpResponse.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    BOOL success;
    HCkJsonObject queryParams;
    HCkHttpResponse resp;

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

    http = CkHttp_Create();

    queryParams = CkJsonObject_Create();
    CkJsonObject_UpdateString(queryParams,"client_id","{{client_id}}");
    CkJsonObject_UpdateString(queryParams,"redirect_uri","{{redirect_uri}}");
    CkJsonObject_UpdateString(queryParams,"scope","read write");
    CkJsonObject_UpdateString(queryParams,"response_type","code");

    resp = CkHttp_QuickRequestParams(http,"GET","https://app.pandadoc.com/oauth2/authorize",queryParams);
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        CkJsonObject_Dispose(queryParams);
        return;
    }

    printf("%d\n",CkHttpResponse_getStatusCode(resp));
    printf("%s\n",CkHttpResponse_bodyStr(resp));
    CkHttpResponse_Dispose(resp);


    CkHttp_Dispose(http);
    CkJsonObject_Dispose(queryParams);

    }

Curl Command

curl -G -d "client_id=%7B%7Bclient_id%7D%7D"
	-d "redirect_uri=%7B%7Bredirect_uri%7D%7D"
	-d "scope=read%20write"
	-d "response_type=code"
https://app.pandadoc.com/oauth2/authorize

Postman Collection Item JSON

{
  "name": "Get Access Code",
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "https://app.pandadoc.com/oauth2/authorize?client_id={{client_id}}&redirect_uri={{redirect_uri}}&scope=read+write&response_type=code",
      "protocol": "https",
      "host": [
        "app",
        "pandadoc",
        "com"
      ],
      "path": [
        "oauth2",
        "authorize"
      ],
      "query": [
        {
          "key": "client_id",
          "value": "{{client_id}}"
        },
        {
          "key": "redirect_uri",
          "value": "{{redirect_uri}}"
        },
        {
          "key": "scope",
          "value": "read+write"
        },
        {
          "key": "response_type",
          "value": "code"
        }
      ]
    },
    "description": "Provide values to variables: client_id, redirect_url ([Postman environments](https://www.getpostman.com/docs/postman/environments_and_globals/manage_environments) is great for it).\n\nTest this link in a web browser.\n\nYou can get the URL by going to \"Code\" - \"cURL\".\n\nFor details go to [https://developers.pandadoc.com/v1/reference#authorize-a-user](https://developers.pandadoc.com/v1/reference#authorize-a-user).\n\nFor details of authentication process go to [https://developers.pandadoc.com/v1/reference#authentication-process](https://developers.pandadoc.com/v1/reference#authentication-process)."
  },
  "response": [
  ]
}