unicodeCpp / Support API / Bulk Update Default Custom Ticket Status
Back to Collection Items
#include <CkHttpW.h>
#include <CkJsonObjectW.h>
#include <CkStringBuilderW.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;
http.put_BasicAuth(true);
http.put_Login(L"login");
http.put_Password(L"password");
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "ids": "<string>"
// }
CkJsonObjectW json;
json.UpdateString(L"ids",L"<string>");
http.SetRequestHeader(L"Content-Type",L"application/json");
http.SetRequestHeader(L"Accept",L"application/json");
CkStringBuilderW sbRequestBody;
json.EmitSb(sbRequestBody);
CkHttpResponseW *resp = http.PTextSb(L"PUT",L"https://example.zendesk.com/api/v2/custom_status/default",sbRequestBody,L"utf-8",L"application/json",false,false);
if (http.get_LastMethodSuccess() == false) {
wprintf(L"%s\n",http.lastErrorText());
return;
}
CkStringBuilderW sbResponseBody;
resp->GetBodySb(sbResponseBody);
CkJsonObjectW jResp;
jResp.LoadSb(sbResponseBody);
jResp.put_EmitCompact(false);
wprintf(L"Response Body:\n");
wprintf(L"%s\n",jResp.emit());
int respStatusCode = resp->get_StatusCode();
wprintf(L"Response Status Code = %d\n",respStatusCode);
if (respStatusCode >= 400) {
wprintf(L"Response Header:\n");
wprintf(L"%s\n",resp->header());
wprintf(L"Failed.\n");
delete resp;
return;
}
delete resp;
}
Curl Command
curl -u login:password -X PUT
-H "Content-Type: application/json"
-H "Accept: application/json"
-d '{
"ids": "<string>"
}'
https://example.zendesk.com/api/v2/custom_status/default
Postman Collection Item JSON
{
"name": "Bulk Update Default Custom Ticket Status",
"request": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Accept",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ids\": \"<string>\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v2/custom_status/default",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"custom_status",
"default"
]
},
"description": "Updates the default values for many custom ticket statuses at once.\n\n#### Allowed For\n\n* Admins\n"
},
"response": [
{
"name": "Updated",
"originalRequest": {
"method": "PUT",
"header": [
{
"key": "Content-Type",
"value": "application/json"
},
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"ids\": \"<string>\"\n}",
"options": {
"raw": {
"headerFamily": "json",
"language": "json"
}
}
},
"url": {
"raw": "{{baseUrl}}/api/v2/custom_status/default",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"custom_status",
"default"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{}"
}
]
}