Back to Collection Items
#include <C_CkHttp.h>
#include <C_CkJsonObject.h>
#include <C_CkStringBuilder.h>
#include <C_CkHttpResponse.h>
void ChilkatSample(void)
{
HCkHttp http;
BOOL success;
HCkJsonObject json;
HCkStringBuilder sbRequestBody;
HCkHttpResponse resp;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttp_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.
// {
// "data": [
// {
// "id": "<string>",
// "type": "apm_retention_filter"
// },
// {
// "id": "<string>",
// "type": "apm_retention_filter"
// }
// ]
// }
json = CkJsonObject_Create();
CkJsonObject_UpdateString(json,"data[0].id","<string>");
CkJsonObject_UpdateString(json,"data[0].type","apm_retention_filter");
CkJsonObject_UpdateString(json,"data[1].id","<string>");
CkJsonObject_UpdateString(json,"data[1].type","apm_retention_filter");
CkHttp_SetRequestHeader(http,"Content-Type","application/json");
CkHttp_SetRequestHeader(http,"Accept","application/json");
sbRequestBody = CkStringBuilder_Create();
CkJsonObject_EmitSb(json,sbRequestBody);
resp = CkHttp_PTextSb(http,"PUT","https://api.app.ddog-gov.com/api/v2/apm/config/retention-filters-execution-order",sbRequestBody,"utf-8","application/json",FALSE,FALSE);
if (CkHttp_getLastMethodSuccess(http) == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
CkJsonObject_Dispose(json);
CkStringBuilder_Dispose(sbRequestBody);
return;
}
printf("%d\n",CkHttpResponse_getStatusCode(resp));
printf("%s\n",CkHttpResponse_bodyStr(resp));
CkHttpResponse_Dispose(resp);
CkHttp_Dispose(http);
CkJsonObject_Dispose(json);
CkStringBuilder_Dispose(sbRequestBody);
}
Curl Command
curl -X PUT
-H "Content-Type: application/json"
-H "Accept: application/json"
-d '{
"data": [
{
"id": "<string>",
"type": "apm_retention_filter"
},
{
"id": "<string>",
"type": "apm_retention_filter"
}
]
}'
https://api.app.ddog-gov.com/api/v2/apm/config/retention-filters-execution-order
Postman Collection Item JSON
{
"name": "Re-order retention filters",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": [\n {\n \"id\": \"<string>\",\n \"type\": \"apm_retention_filter\"\n },\n {\n \"id\": \"<string>\",\n \"type\": \"apm_retention_filter\"\n }\n ]\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v2/apm/config/retention-filters-execution-order",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"apm",
"config",
"retention-filters-execution-order"
]
},
"description": "Re-order the execution order of retention filters."
},
"response": [
{
"name": "OK",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: apikey",
"key": "DD-API-KEY",
"value": "<API Key>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": [\n {\n \"id\": \"<string>\",\n \"type\": \"apm_retention_filter\"\n },\n {\n \"id\": \"<string>\",\n \"type\": \"apm_retention_filter\"\n }\n ]\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v2/apm/config/retention-filters-execution-order",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"apm",
"config",
"retention-filters-execution-order"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "text",
"header": [
],
"cookie": [
],
"body": ""
},
{
"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 \"data\": [\n {\n \"id\": \"<string>\",\n \"type\": \"apm_retention_filter\"\n },\n {\n \"id\": \"<string>\",\n \"type\": \"apm_retention_filter\"\n }\n ]\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v2/apm/config/retention-filters-execution-order",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"apm",
"config",
"retention-filters-execution-order"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"<string>\",\n \"<string>\"\n ]\n}"
},
{
"name": "Not Authorized",
"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 \"data\": [\n {\n \"id\": \"<string>\",\n \"type\": \"apm_retention_filter\"\n },\n {\n \"id\": \"<string>\",\n \"type\": \"apm_retention_filter\"\n }\n ]\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v2/apm/config/retention-filters-execution-order",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"apm",
"config",
"retention-filters-execution-order"
]
}
},
"status": "Forbidden",
"code": 403,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"<string>\",\n \"<string>\"\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 \"data\": [\n {\n \"id\": \"<string>\",\n \"type\": \"apm_retention_filter\"\n },\n {\n \"id\": \"<string>\",\n \"type\": \"apm_retention_filter\"\n }\n ]\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v2/apm/config/retention-filters-execution-order",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"apm",
"config",
"retention-filters-execution-order"
]
}
},
"status": "Too Many Requests",
"code": 429,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"errors\": [\n \"<string>\",\n \"<string>\"\n ]\n}"
}
]
}