Back to Collection Items
#include <CkHttpW.h>
#include <CkJsonObjectW.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;
// 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": [
// ""
// ],
// "token_endpoint_auth_method": "",
// "app_type": "",
// "is_first_party": true,
// "jwt_configuration": {
// "lifetime_in_seconds": 0,
// "secret_encoded": true,
// "scopes": {},
// "alg": ""
// },
// "encryption_key": {
// "pub": "",
// "cert": ""
// },
// "sso": true,
// "custom_login_page_on": true,
// "custom_login_page": "",
// "custom_login_page_preview": "",
// "form_template": "",
// "is_heroku_app": true,
// "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": {}
// }
// }
CkJsonObjectW json;
json.UpdateString(L"name",L"");
json.UpdateString(L"client_secret",L"");
json.UpdateString(L"logo_uri",L"");
json.UpdateString(L"callbacks[0]",L"");
json.UpdateString(L"allowed_origins[0]",L"");
json.UpdateString(L"client_aliases[0]",L"");
json.UpdateString(L"allowed_clients[0]",L"");
json.UpdateString(L"allowed_logout_urls[0]",L"");
json.UpdateString(L"token_endpoint_auth_method",L"");
json.UpdateString(L"app_type",L"");
json.UpdateBool(L"is_first_party",true);
json.UpdateInt(L"jwt_configuration.lifetime_in_seconds",0);
json.UpdateBool(L"jwt_configuration.secret_encoded",true);
json.UpdateNewObject(L"jwt_configuration.scopes");
json.UpdateString(L"jwt_configuration.alg",L"");
json.UpdateString(L"encryption_key.pub",L"");
json.UpdateString(L"encryption_key.cert",L"");
json.UpdateBool(L"sso",true);
json.UpdateBool(L"custom_login_page_on",true);
json.UpdateString(L"custom_login_page",L"");
json.UpdateString(L"custom_login_page_preview",L"");
json.UpdateString(L"form_template",L"");
json.UpdateBool(L"is_heroku_app",true);
json.UpdateNewObject(L"addons.aws");
json.UpdateNewObject(L"addons.azure_blob");
json.UpdateNewObject(L"addons.azure_sb");
json.UpdateNewObject(L"addons.rms");
json.UpdateNewObject(L"addons.mscrm");
json.UpdateNewObject(L"addons.slack");
json.UpdateNewObject(L"addons.box");
json.UpdateNewObject(L"addons.cloudbees");
json.UpdateNewObject(L"addons.concur");
json.UpdateNewObject(L"addons.dropbox");
json.UpdateNewObject(L"addons.echosign");
json.UpdateNewObject(L"addons.egnyte");
json.UpdateNewObject(L"addons.firebase");
json.UpdateNewObject(L"addons.newrelic");
json.UpdateNewObject(L"addons.office365");
json.UpdateNewObject(L"addons.salesforce");
json.UpdateNewObject(L"addons.salesforce_api");
json.UpdateNewObject(L"addons.salesforce_sandbox_api");
json.UpdateNewObject(L"addons.samlp");
json.UpdateNewObject(L"addons.layer");
json.UpdateNewObject(L"addons.sap_api");
json.UpdateNewObject(L"addons.sharepoint");
json.UpdateNewObject(L"addons.springcm");
json.UpdateNewObject(L"addons.wams");
json.UpdateNewObject(L"addons.wsfed");
json.UpdateNewObject(L"addons.zendesk");
json.UpdateNewObject(L"addons.zoom");
json.UpdateString(L"resource_servers[0].identifier",L"");
json.UpdateString(L"resource_servers[0].scopes[0]",L"");
json.UpdateNewObject(L"client_metadata");
json.UpdateNewObject(L"mobile.android");
json.UpdateNewObject(L"mobile.ios");
// Adds the "Authorization: Bearer {{auth0_token}}" header.
http.put_AuthToken(L"{{auth0_token}}");
http.SetRequestHeader(L"Content-Type",L"application/json");
CkHttpResponseW *resp = http.PostJson3(L"https://{{auth0_domain}}/api/v2/clients",L"application/json",json);
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 POST
-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": [
""
],
"token_endpoint_auth_method": "",
"app_type": "",
"is_first_party": true,
"jwt_configuration": {
"lifetime_in_seconds": 0,
"secret_encoded": true,
"scopes": {},
"alg": ""
},
"encryption_key": {
"pub": "",
"cert": ""
},
"sso": true,
"custom_login_page_on": true,
"custom_login_page": "",
"custom_login_page_preview": "",
"form_template": "",
"is_heroku_app": true,
"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
Postman Collection Item JSON
{
"name": "Create a client",
"request": {
"method": "POST",
"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 \"token_endpoint_auth_method\": \"\",\r\n \"app_type\": \"\",\r\n \"is_first_party\": true,\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 },\r\n \"sso\": true,\r\n \"custom_login_page_on\": true,\r\n \"custom_login_page\": \"\",\r\n \"custom_login_page_preview\": \"\",\r\n \"form_template\": \"\",\r\n \"is_heroku_app\": true,\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",
"protocol": "https",
"host": [
"{{auth0_domain}}"
],
"path": [
"api",
"v2",
"clients"
]
},
"description": "Creates a new client application. The samples on the right show every attribute that can be used."
},
"response": [
]
}