Back to Collection Items
#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkStringBuilderW.h>
#include <C_CkHttpResponseW.h>
void ChilkatSample(void)
{
HCkHttpW http;
BOOL success;
HCkJsonObjectW json;
HCkStringBuilderW sbRequestBody;
HCkHttpResponseW resp;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "name": "",
// "client_secret": "",
// "logo_uri": "",
// "callbacks": [
// ""
// ],
// "allowed_origins": [
// ""
// ],
// "client_aliases": [
// ""
// ],
// "allowed_clients": [
// ""
// ],
// "allowed_logout_urls": [
// ""
// ],
// "jwt_configuration": {
// "lifetime_in_seconds": 0,
// "secret_encoded": true,
// "scopes": {},
// "alg": ""
// },
// "encryption_key": {
// "pub": "",
// "cert": "",
// "subject": ""
// },
// "sso": true,
// "custom_login_page_on": true,
// "token_endpoint_auth_method": "",
// "app_type": "",
// "is_first_party": true,
// "custom_login_page": "",
// "custom_login_page_preview": "",
// "form_template": "",
// "addons": {
// "aws": {},
// "azure_blob": {},
// "azure_sb": {},
// "rms": {},
// "mscrm": {},
// "slack": {},
// "box": {},
// "cloudbees": {},
// "concur": {},
// "dropbox": {},
// "echosign": {},
// "egnyte": {},
// "firebase": {},
// "newrelic": {},
// "office365": {},
// "salesforce": {},
// "salesforce_api": {},
// "salesforce_sandbox_api": {},
// "samlp": {},
// "layer": {},
// "sap_api": {},
// "sharepoint": {},
// "springcm": {},
// "wams": {},
// "wsfed": {},
// "zendesk": {},
// "zoom": {}
// },
// "resource_servers": [
// {
// "identifier": "",
// "scopes": [
// ""
// ]
// }
// ],
// "client_metadata": {},
// "mobile": {
// "android": {},
// "ios": {}
// }
// }
json = CkJsonObjectW_Create();
CkJsonObjectW_UpdateString(json,L"name",L"");
CkJsonObjectW_UpdateString(json,L"client_secret",L"");
CkJsonObjectW_UpdateString(json,L"logo_uri",L"");
CkJsonObjectW_UpdateString(json,L"callbacks[0]",L"");
CkJsonObjectW_UpdateString(json,L"allowed_origins[0]",L"");
CkJsonObjectW_UpdateString(json,L"client_aliases[0]",L"");
CkJsonObjectW_UpdateString(json,L"allowed_clients[0]",L"");
CkJsonObjectW_UpdateString(json,L"allowed_logout_urls[0]",L"");
CkJsonObjectW_UpdateInt(json,L"jwt_configuration.lifetime_in_seconds",0);
CkJsonObjectW_UpdateBool(json,L"jwt_configuration.secret_encoded",TRUE);
CkJsonObjectW_UpdateNewObject(json,L"jwt_configuration.scopes");
CkJsonObjectW_UpdateString(json,L"jwt_configuration.alg",L"");
CkJsonObjectW_UpdateString(json,L"encryption_key.pub",L"");
CkJsonObjectW_UpdateString(json,L"encryption_key.cert",L"");
CkJsonObjectW_UpdateString(json,L"encryption_key.subject",L"");
CkJsonObjectW_UpdateBool(json,L"sso",TRUE);
CkJsonObjectW_UpdateBool(json,L"custom_login_page_on",TRUE);
CkJsonObjectW_UpdateString(json,L"token_endpoint_auth_method",L"");
CkJsonObjectW_UpdateString(json,L"app_type",L"");
CkJsonObjectW_UpdateBool(json,L"is_first_party",TRUE);
CkJsonObjectW_UpdateString(json,L"custom_login_page",L"");
CkJsonObjectW_UpdateString(json,L"custom_login_page_preview",L"");
CkJsonObjectW_UpdateString(json,L"form_template",L"");
CkJsonObjectW_UpdateNewObject(json,L"addons.aws");
CkJsonObjectW_UpdateNewObject(json,L"addons.azure_blob");
CkJsonObjectW_UpdateNewObject(json,L"addons.azure_sb");
CkJsonObjectW_UpdateNewObject(json,L"addons.rms");
CkJsonObjectW_UpdateNewObject(json,L"addons.mscrm");
CkJsonObjectW_UpdateNewObject(json,L"addons.slack");
CkJsonObjectW_UpdateNewObject(json,L"addons.box");
CkJsonObjectW_UpdateNewObject(json,L"addons.cloudbees");
CkJsonObjectW_UpdateNewObject(json,L"addons.concur");
CkJsonObjectW_UpdateNewObject(json,L"addons.dropbox");
CkJsonObjectW_UpdateNewObject(json,L"addons.echosign");
CkJsonObjectW_UpdateNewObject(json,L"addons.egnyte");
CkJsonObjectW_UpdateNewObject(json,L"addons.firebase");
CkJsonObjectW_UpdateNewObject(json,L"addons.newrelic");
CkJsonObjectW_UpdateNewObject(json,L"addons.office365");
CkJsonObjectW_UpdateNewObject(json,L"addons.salesforce");
CkJsonObjectW_UpdateNewObject(json,L"addons.salesforce_api");
CkJsonObjectW_UpdateNewObject(json,L"addons.salesforce_sandbox_api");
CkJsonObjectW_UpdateNewObject(json,L"addons.samlp");
CkJsonObjectW_UpdateNewObject(json,L"addons.layer");
CkJsonObjectW_UpdateNewObject(json,L"addons.sap_api");
CkJsonObjectW_UpdateNewObject(json,L"addons.sharepoint");
CkJsonObjectW_UpdateNewObject(json,L"addons.springcm");
CkJsonObjectW_UpdateNewObject(json,L"addons.wams");
CkJsonObjectW_UpdateNewObject(json,L"addons.wsfed");
CkJsonObjectW_UpdateNewObject(json,L"addons.zendesk");
CkJsonObjectW_UpdateNewObject(json,L"addons.zoom");
CkJsonObjectW_UpdateString(json,L"resource_servers[0].identifier",L"");
CkJsonObjectW_UpdateString(json,L"resource_servers[0].scopes[0]",L"");
CkJsonObjectW_UpdateNewObject(json,L"client_metadata");
CkJsonObjectW_UpdateNewObject(json,L"mobile.android");
CkJsonObjectW_UpdateNewObject(json,L"mobile.ios");
// Adds the "Authorization: Bearer {{auth0_token}}" header.
CkHttpW_putAuthToken(http,L"{{auth0_token}}");
CkHttpW_SetRequestHeader(http,L"Content-Type",L"application/json");
sbRequestBody = CkStringBuilderW_Create();
CkJsonObjectW_EmitSb(json,sbRequestBody);
resp = CkHttpW_PTextSb(http,L"PATCH",L"https://{{auth0_domain}}/api/v2/clients/:id",sbRequestBody,L"utf-8",L"application/json",FALSE,FALSE);
if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
return;
}
wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
CkHttpResponseW_Dispose(resp);
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
}
Curl Command
curl -X PATCH
-H "Authorization: Bearer {{auth0_token}}"
-H "Content-Type: application/json"
-d '{
"name": "",
"client_secret": "",
"logo_uri": "",
"callbacks": [
""
],
"allowed_origins": [
""
],
"client_aliases": [
""
],
"allowed_clients": [
""
],
"allowed_logout_urls": [
""
],
"jwt_configuration": {
"lifetime_in_seconds": 0,
"secret_encoded": true,
"scopes": {},
"alg": ""
},
"encryption_key": {
"pub": "",
"cert": "",
"subject": ""
},
"sso": true,
"custom_login_page_on": true,
"token_endpoint_auth_method": "",
"app_type": "",
"is_first_party": true,
"custom_login_page": "",
"custom_login_page_preview": "",
"form_template": "",
"addons": {
"aws": {},
"azure_blob": {},
"azure_sb": {},
"rms": {},
"mscrm": {},
"slack": {},
"box": {},
"cloudbees": {},
"concur": {},
"dropbox": {},
"echosign": {},
"egnyte": {},
"firebase": {},
"newrelic": {},
"office365": {},
"salesforce": {},
"salesforce_api": {},
"salesforce_sandbox_api": {},
"samlp": {},
"layer": {},
"sap_api": {},
"sharepoint": {},
"springcm": {},
"wams": {},
"wsfed": {},
"zendesk": {},
"zoom": {}
},
"resource_servers": [
{
"identifier": "",
"scopes": [
""
]
}
],
"client_metadata": {},
"mobile": {
"android": {},
"ios": {}
}
}'
https://{{auth0_domain}}/api/v2/clients/:id
Postman Collection Item JSON
{
"name": "Update a client",
"request": {
"method": "PATCH",
"header": [
{
"key": "Authorization",
"value": "Bearer {{auth0_token}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"name\": \"\",\r\n \"client_secret\": \"\",\r\n \"logo_uri\": \"\",\r\n \"callbacks\": [\r\n \"\"\r\n ],\r\n \"allowed_origins\": [\r\n \"\"\r\n ],\r\n \"client_aliases\": [\r\n \"\"\r\n ],\r\n \"allowed_clients\": [\r\n \"\"\r\n ],\r\n \"allowed_logout_urls\": [\r\n \"\"\r\n ],\r\n \"jwt_configuration\": {\r\n \"lifetime_in_seconds\": 0,\r\n \"secret_encoded\": true,\r\n \"scopes\": {},\r\n \"alg\": \"\"\r\n },\r\n \"encryption_key\": {\r\n \"pub\": \"\",\r\n \"cert\": \"\",\r\n \"subject\": \"\"\r\n },\r\n \"sso\": true,\r\n \"custom_login_page_on\": true,\r\n \"token_endpoint_auth_method\": \"\",\r\n \"app_type\": \"\",\r\n \"is_first_party\": true,\r\n \"custom_login_page\": \"\",\r\n \"custom_login_page_preview\": \"\",\r\n \"form_template\": \"\",\r\n \"addons\": {\r\n \"aws\": {},\r\n \"azure_blob\": {},\r\n \"azure_sb\": {},\r\n \"rms\": {},\r\n \"mscrm\": {},\r\n \"slack\": {},\r\n \"box\": {},\r\n \"cloudbees\": {},\r\n \"concur\": {},\r\n \"dropbox\": {},\r\n \"echosign\": {},\r\n \"egnyte\": {},\r\n \"firebase\": {},\r\n \"newrelic\": {},\r\n \"office365\": {},\r\n \"salesforce\": {},\r\n \"salesforce_api\": {},\r\n \"salesforce_sandbox_api\": {},\r\n \"samlp\": {},\r\n \"layer\": {},\r\n \"sap_api\": {},\r\n \"sharepoint\": {},\r\n \"springcm\": {},\r\n \"wams\": {},\r\n \"wsfed\": {},\r\n \"zendesk\": {},\r\n \"zoom\": {}\r\n },\r\n \"resource_servers\": [\r\n {\r\n \"identifier\": \"\",\r\n \"scopes\": [\r\n \"\"\r\n ]\r\n }\r\n ],\r\n \"client_metadata\": {},\r\n \"mobile\": {\r\n \"android\": {},\r\n \"ios\": {}\r\n }\r\n}"
},
"url": {
"raw": "https://{{auth0_domain}}/api/v2/clients/:id",
"protocol": "https",
"host": [
"{{auth0_domain}}"
],
"path": [
"api",
"v2",
"clients",
":id"
],
"variable": [
{
"key": "id",
"type": "any"
}
]
},
"description": "<strong>Important:</strong> The <code>client_secret</code> and <code>encryption_key</code> attributes can only be updated with the <code>update:client_keys</code> scope."
},
"response": [
]
}