Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loJson
LOCAL loSbRequestBody
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcStrVal
LOCAL lcV_Type
LOCAL lcCreated
LOCAL lcDescription
LOCAL lcName
LOCAL lcPublic_id
LOCAL lnPrivate_widget_share
LOCAL lnEnabled
LOCAL lcSaml_autocreate_access_role
LOCAL lnSaml_autocreate_users_domainsEnabled
LOCAL lnSaml_can_be_enabled
LOCAL lcSaml_idp_endpoint
LOCAL lnSaml_idp_initiated_loginEnabled
LOCAL lnSaml_idp_metadata_uploaded
LOCAL lcSaml_login_url
LOCAL lnSaml_strict_modeEnabled
LOCAL lcSubscriptionType
LOCAL lnTrial
LOCAL i
LOCAL lnCount_i
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
* Use this online tool to generate code from sample JSON: Generate Code to Create JSON
* The following JSON is sent in the request body.
* {
* "billing": {
* "type": "parent_billing"
* },
* "created": "2019-09-26T17:28:28Z",
* "description": "some description",
* "name": "New child org",
* "public_id": "abcdef12345",
* "settings": {
* "private_widget_share": false,
* "saml": {
* "enabled": false
* },
* "saml_autocreate_access_role": "ro",
* "saml_autocreate_users_domains": {
* "domains": [
* "example.com",
* "example.com"
* ],
* "enabled": false
* },
* "saml_can_be_enabled": false,
* "saml_idp_endpoint": "https://my.saml.endpoint",
* "saml_idp_initiated_login": {
* "enabled": false
* },
* "saml_idp_metadata_uploaded": false,
* "saml_login_url": "https://my.saml.login.url",
* "saml_strict_mode": {
* "enabled": false
* }
* },
* "subscription": {
* "type": "pro"
* },
* "trial": false
* }
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJson = CreateObject('Chilkat.JsonObject')
loJson.UpdateString("billing.type","parent_billing")
loJson.UpdateString("created","2019-09-26T17:28:28Z")
loJson.UpdateString("description","some description")
loJson.UpdateString("name","New child org")
loJson.UpdateString("public_id","abcdef12345")
loJson.UpdateBool("settings.private_widget_share",0)
loJson.UpdateBool("settings.saml.enabled",0)
loJson.UpdateString("settings.saml_autocreate_access_role","ro")
loJson.UpdateString("settings.saml_autocreate_users_domains.domains[0]","example.com")
loJson.UpdateString("settings.saml_autocreate_users_domains.domains[1]","example.com")
loJson.UpdateBool("settings.saml_autocreate_users_domains.enabled",0)
loJson.UpdateBool("settings.saml_can_be_enabled",0)
loJson.UpdateString("settings.saml_idp_endpoint","https://my.saml.endpoint")
loJson.UpdateBool("settings.saml_idp_initiated_login.enabled",0)
loJson.UpdateBool("settings.saml_idp_metadata_uploaded",0)
loJson.UpdateString("settings.saml_login_url","https://my.saml.login.url")
loJson.UpdateBool("settings.saml_strict_mode.enabled",0)
loJson.UpdateString("subscription.type","pro")
loJson.UpdateBool("trial",0)
loHttp.SetRequestHeader("Content-Type","application/json")
loHttp.SetRequestHeader("Accept","application/json")
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbRequestBody = CreateObject('Chilkat.StringBuilder')
loJson.EmitSb(loSbRequestBody)
loResp = loHttp.PTextSb("PUT","https://api.app.ddog-gov.com/api/v1/org/:public_id",loSbRequestBody,"utf-8","application/json",0,0)
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loJson
RELEASE loSbRequestBody
CANCEL
ENDIF
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.StringBuilder')
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbResponseBody)
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0
? "Response Body:"
? loJResp.Emit()
lnRespStatusCode = loResp.StatusCode
? "Response Status Code = " + STR(lnRespStatusCode)
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loResp.Header
? "Failed."
RELEASE loResp
RELEASE loHttp
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
RELEASE loResp
* Sample JSON response:
* (Sample code for parsing the JSON response is shown below)
* {
* "org": {
* "billing": {
* "type": "parent_billing"
* },
* "created": "2019-09-26T17:28:28Z",
* "description": "some description",
* "name": "New child org",
* "public_id": "abcdef12345",
* "settings": {
* "private_widget_share": false,
* "saml": {
* "enabled": false
* },
* "saml_autocreate_access_role": "ro",
* "saml_autocreate_users_domains": {
* "domains": [
* "example.com",
* "example.com"
* ],
* "enabled": false
* },
* "saml_can_be_enabled": false,
* "saml_idp_endpoint": "https://my.saml.endpoint",
* "saml_idp_initiated_login": {
* "enabled": false
* },
* "saml_idp_metadata_uploaded": false,
* "saml_login_url": "https://my.saml.login.url",
* "saml_strict_mode": {
* "enabled": false
* }
* },
* "subscription": {
* "type": "pro"
* },
* "trial": false
* }
* }
* Sample code for parsing the JSON response...
* Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
lcV_Type = loJResp.StringOf("org.billing.type")
lcCreated = loJResp.StringOf("org.created")
lcDescription = loJResp.StringOf("org.description")
lcName = loJResp.StringOf("org.name")
lcPublic_id = loJResp.StringOf("org.public_id")
lnPrivate_widget_share = loJResp.BoolOf("org.settings.private_widget_share")
lnEnabled = loJResp.BoolOf("org.settings.saml.enabled")
lcSaml_autocreate_access_role = loJResp.StringOf("org.settings.saml_autocreate_access_role")
lnSaml_autocreate_users_domainsEnabled = loJResp.BoolOf("org.settings.saml_autocreate_users_domains.enabled")
lnSaml_can_be_enabled = loJResp.BoolOf("org.settings.saml_can_be_enabled")
lcSaml_idp_endpoint = loJResp.StringOf("org.settings.saml_idp_endpoint")
lnSaml_idp_initiated_loginEnabled = loJResp.BoolOf("org.settings.saml_idp_initiated_login.enabled")
lnSaml_idp_metadata_uploaded = loJResp.BoolOf("org.settings.saml_idp_metadata_uploaded")
lcSaml_login_url = loJResp.StringOf("org.settings.saml_login_url")
lnSaml_strict_modeEnabled = loJResp.BoolOf("org.settings.saml_strict_mode.enabled")
lcSubscriptionType = loJResp.StringOf("org.subscription.type")
lnTrial = loJResp.BoolOf("org.trial")
i = 0
lnCount_i = loJResp.SizeOfArray("org.settings.saml_autocreate_users_domains.domains")
DO WHILE i < lnCount_i
loJResp.I = i
lcStrVal = loJResp.StringOf("org.settings.saml_autocreate_users_domains.domains[i]")
i = i + 1
ENDDO
RELEASE loHttp
RELEASE loJson
RELEASE loSbRequestBody
RELEASE loSbResponseBody
RELEASE loJResp
Curl Command
curl -X PUT
-H "Content-Type: application/json"
-H "Accept: application/json"
-d '{
"billing": {
"type": "parent_billing"
},
"created": "2019-09-26T17:28:28Z",
"description": "some description",
"name": "New child org",
"public_id": "abcdef12345",
"settings": {
"private_widget_share": false,
"saml": {
"enabled": false
},
"saml_autocreate_access_role": "ro",
"saml_autocreate_users_domains": {
"domains": [
"example.com",
"example.com"
],
"enabled": false
},
"saml_can_be_enabled": false,
"saml_idp_endpoint": "https://my.saml.endpoint",
"saml_idp_initiated_login": {
"enabled": false
},
"saml_idp_metadata_uploaded": false,
"saml_login_url": "https://my.saml.login.url",
"saml_strict_mode": {
"enabled": false
}
},
"subscription": {
"type": "pro"
},
"trial": false
}'
https://api.app.ddog-gov.com/api/v1/org/:public_id
Postman Collection Item JSON
{
"name": "Update your organization",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"billing\": {\n \"type\": \"parent_billing\"\n },\n \"created\": \"2019-09-26T17:28:28Z\",\n \"description\": \"some description\",\n \"name\": \"New child org\",\n \"public_id\": \"abcdef12345\",\n \"settings\": {\n \"private_widget_share\": false,\n \"saml\": {\n \"enabled\": false\n },\n \"saml_autocreate_access_role\": \"ro\",\n \"saml_autocreate_users_domains\": {\n \"domains\": [\n \"example.com\",\n \"example.com\"\n ],\n \"enabled\": false\n },\n \"saml_can_be_enabled\": false,\n \"saml_idp_endpoint\": \"https://my.saml.endpoint\",\n \"saml_idp_initiated_login\": {\n \"enabled\": false\n },\n \"saml_idp_metadata_uploaded\": false,\n \"saml_login_url\": \"https://my.saml.login.url\",\n \"saml_strict_mode\": {\n \"enabled\": false\n }\n },\n \"subscription\": {\n \"type\": \"pro\"\n },\n \"trial\": false\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/org/:public_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"org",
":public_id"
],
"variable": [
{
"key": "public_id",
"value": "abc123"
}
]
},
"description": "Update your organization."
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"billing\": {\n \"type\": \"parent_billing\"\n },\n \"created\": \"2019-09-26T17:28:28Z\",\n \"description\": \"some description\",\n \"name\": \"New child org\",\n \"public_id\": \"abcdef12345\",\n \"settings\": {\n \"private_widget_share\": false,\n \"saml\": {\n \"enabled\": false\n },\n \"saml_autocreate_access_role\": \"ro\",\n \"saml_autocreate_users_domains\": {\n \"domains\": [\n \"example.com\",\n \"example.com\"\n ],\n \"enabled\": false\n },\n \"saml_can_be_enabled\": false,\n \"saml_idp_endpoint\": \"https://my.saml.endpoint\",\n \"saml_idp_initiated_login\": {\n \"enabled\": false\n },\n \"saml_idp_metadata_uploaded\": false,\n \"saml_login_url\": \"https://my.saml.login.url\",\n \"saml_strict_mode\": {\n \"enabled\": false\n }\n },\n \"subscription\": {\n \"type\": \"pro\"\n },\n \"trial\": false\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/org/:public_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"org",
":public_id"
],
"variable": [
{
"key": "public_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"org\": {\n \"billing\": {\n \"type\": \"parent_billing\"\n },\n \"created\": \"2019-09-26T17:28:28Z\",\n \"description\": \"some description\",\n \"name\": \"New child org\",\n \"public_id\": \"abcdef12345\",\n \"settings\": {\n \"private_widget_share\": false,\n \"saml\": {\n \"enabled\": false\n },\n \"saml_autocreate_access_role\": \"ro\",\n \"saml_autocreate_users_domains\": {\n \"domains\": [\n \"example.com\",\n \"example.com\"\n ],\n \"enabled\": false\n },\n \"saml_can_be_enabled\": false,\n \"saml_idp_endpoint\": \"https://my.saml.endpoint\",\n \"saml_idp_initiated_login\": {\n \"enabled\": false\n },\n \"saml_idp_metadata_uploaded\": false,\n \"saml_login_url\": \"https://my.saml.login.url\",\n \"saml_strict_mode\": {\n \"enabled\": false\n }\n },\n \"subscription\": {\n \"type\": \"pro\"\n },\n \"trial\": false\n }\n}"
},
{
"name": "Bad Request",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"billing\": {\n \"type\": \"parent_billing\"\n },\n \"created\": \"2019-09-26T17:28:28Z\",\n \"description\": \"some description\",\n \"name\": \"New child org\",\n \"public_id\": \"abcdef12345\",\n \"settings\": {\n \"private_widget_share\": false,\n \"saml\": {\n \"enabled\": false\n },\n \"saml_autocreate_access_role\": \"ro\",\n \"saml_autocreate_users_domains\": {\n \"domains\": [\n \"example.com\",\n \"example.com\"\n ],\n \"enabled\": false\n },\n \"saml_can_be_enabled\": false,\n \"saml_idp_endpoint\": \"https://my.saml.endpoint\",\n \"saml_idp_initiated_login\": {\n \"enabled\": false\n },\n \"saml_idp_metadata_uploaded\": false,\n \"saml_login_url\": \"https://my.saml.login.url\",\n \"saml_strict_mode\": {\n \"enabled\": false\n }\n },\n \"subscription\": {\n \"type\": \"pro\"\n },\n \"trial\": false\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/org/:public_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"org",
":public_id"
],
"variable": [
{
"key": "public_id"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
},
{
"name": "Forbidden",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"billing\": {\n \"type\": \"parent_billing\"\n },\n \"created\": \"2019-09-26T17:28:28Z\",\n \"description\": \"some description\",\n \"name\": \"New child org\",\n \"public_id\": \"abcdef12345\",\n \"settings\": {\n \"private_widget_share\": false,\n \"saml\": {\n \"enabled\": false\n },\n \"saml_autocreate_access_role\": \"ro\",\n \"saml_autocreate_users_domains\": {\n \"domains\": [\n \"example.com\",\n \"example.com\"\n ],\n \"enabled\": false\n },\n \"saml_can_be_enabled\": false,\n \"saml_idp_endpoint\": \"https://my.saml.endpoint\",\n \"saml_idp_initiated_login\": {\n \"enabled\": false\n },\n \"saml_idp_metadata_uploaded\": false,\n \"saml_login_url\": \"https://my.saml.login.url\",\n \"saml_strict_mode\": {\n \"enabled\": false\n }\n },\n \"subscription\": {\n \"type\": \"pro\"\n },\n \"trial\": false\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/org/:public_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"org",
":public_id"
],
"variable": [
{
"key": "public_id"
}
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
},
{
"name": "Too many requests",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"billing\": {\n \"type\": \"parent_billing\"\n },\n \"created\": \"2019-09-26T17:28:28Z\",\n \"description\": \"some description\",\n \"name\": \"New child org\",\n \"public_id\": \"abcdef12345\",\n \"settings\": {\n \"private_widget_share\": false,\n \"saml\": {\n \"enabled\": false\n },\n \"saml_autocreate_access_role\": \"ro\",\n \"saml_autocreate_users_domains\": {\n \"domains\": [\n \"example.com\",\n \"example.com\"\n ],\n \"enabled\": false\n },\n \"saml_can_be_enabled\": false,\n \"saml_idp_endpoint\": \"https://my.saml.endpoint\",\n \"saml_idp_initiated_login\": {\n \"enabled\": false\n },\n \"saml_idp_metadata_uploaded\": false,\n \"saml_login_url\": \"https://my.saml.login.url\",\n \"saml_strict_mode\": {\n \"enabled\": false\n }\n },\n \"subscription\": {\n \"type\": \"pro\"\n },\n \"trial\": false\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v1/org/:public_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v1",
"org",
":public_id"
],
"variable": [
{
"key": "public_id"
}
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"Bad Request\",\n \"Bad Request\"\n ]\n}"
}
]
}