Chilkat Online Tools

TCL / Broker API / client_id

Back to Collection Items

load ./chilkat.dll

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

set http [new_CkHttp]

CkHttp_put_BasicAuth $http 1
CkHttp_put_Login $http "{{api_key}}"
CkHttp_put_Password $http "{{api_secret}}"

# Use this online tool to generate code from sample JSON: Generate Code to Create JSON

# The following JSON is sent in the request body.

# {
#   "response_type": "token",
#   "redirect_uri": "www.example.com/oauth_redirect",
#   "scope": "general"
# }

set json [new_CkJsonObject]

CkJsonObject_UpdateString $json "response_type" "token"
CkJsonObject_UpdateString $json "redirect_uri" "www.example.com/oauth_redirect"
CkJsonObject_UpdateString $json "scope" "general"

set sbRequestBody [new_CkStringBuilder]

CkJsonObject_EmitSb $json $sbRequestBody

# resp is a CkHttpResponse
set resp [CkHttp_PTextSb $http "GET" "https:///v1/oauth/clients/:client_id" $sbRequestBody "utf-8" "application/json" 0 0]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkJsonObject $json
    delete_CkStringBuilder $sbRequestBody
    exit
}

puts [CkHttpResponse_get_StatusCode $resp]
puts [CkHttpResponse_bodyStr $resp]
delete_CkHttpResponse $resp


delete_CkHttp $http
delete_CkJsonObject $json
delete_CkStringBuilder $sbRequestBody

Curl Command

curl -X GET
	-u '{{api_key}}:{{api_secret}}'
	-d '{
  "response_type": "token",
  "redirect_uri": "www.example.com/oauth_redirect",
  "scope": "general"
}'
https:///v1/oauth/clients/:client_id

Postman Collection Item JSON

{
  "name": "client_id",
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "method": "GET",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n  \"response_type\": \"token\",\n  \"redirect_uri\": \"www.example.com/oauth_redirect\",\n  \"scope\": \"general\"\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "/v1/oauth/clients/:client_id",
      "path": [
        "v1",
        "oauth",
        "clients",
        ":client_id"
      ],
      "variable": [
        {
          "key": "client_id",
          "value": null
        }
      ]
    },
    "description": "| Attribute         | Type   | Notes                                  |\n| ----------------- | ------ | -------------------------------------- |\n| `response_type`   | string | ENUM: `code` or `token`                |\n| `redirect_uri`    | string | Redirect URI of the OAuth flow         |\n| `scope`           | string | Requested scopes by the OAuth flow     |"
  },
  "response": [
  ]
}