Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
DECLARE @queryParams int
-- Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.JsonObject', @queryParams OUT
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'client_id', '{{client_id}}'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'redirect_uri', '{{redirect_uri}}'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'scope', 'read write'
EXEC sp_OAMethod @queryParams, 'UpdateString', @success OUT, 'response_type', 'code'
DECLARE @resp int
EXEC sp_OAMethod @http, 'QuickRequestParams', @resp OUT, 'GET', 'https://app.pandadoc.com/oauth2/authorize', @queryParams
EXEC sp_OAGetProperty @http, 'LastMethodSuccess', @iTmp0 OUT
IF @iTmp0 = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
RETURN
END
EXEC sp_OAGetProperty @resp, 'StatusCode', @iTmp0 OUT
PRINT @iTmp0
EXEC sp_OAGetProperty @resp, 'BodyStr', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @resp
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @queryParams
END
GO
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": [
]
}