C / Support API / Clone an already existing ticket form
Back to Collection Items
#include <C_CkHttp.h>
#include <C_CkHttpResponse.h>
#include <C_CkStringBuilder.h>
#include <C_CkJsonObject.h>
void ChilkatSample(void)
{
HCkHttp http;
BOOL success;
HCkHttpResponse resp;
HCkStringBuilder sbResponseBody;
HCkJsonObject jResp;
int respStatusCode;
const char *aliqua6;
const char *Lorem_d;
int mollit_cf;
const char *ullamco_f7;
const char *consequate_;
int consectetur_00;
const char *laborum50;
BOOL irure__c;
const char *Excepteur_38;
const char *sunt_8;
const char *nulla_48;
const char *ullamco_f6;
const char *strVal;
const char *Name;
const char *Active;
const char *Created_at;
const char *Default;
const char *Display_name;
const char *End_user_visible;
const char *Id;
const char *In_all_brands;
const char *Position;
const char *Raw_display_name;
const char *Raw_name;
const char *Updated_at;
const char *v_Url;
int i;
int count_i;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttp_Create();
CkHttp_putBasicAuth(http,TRUE);
CkHttp_putLogin(http,"login");
CkHttp_putPassword(http,"password");
CkHttp_SetRequestHeader(http,"Accept","application/json");
resp = CkHttp_QuickRequest(http,"POST","https://example.zendesk.com/api/v2/ticket_forms/:ticket_form_id/clone");
if (CkHttp_getLastMethodSuccess(http) == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
CkHttp_Dispose(http);
return;
}
sbResponseBody = CkStringBuilder_Create();
CkHttpResponse_GetBodySb(resp,sbResponseBody);
jResp = CkJsonObject_Create();
CkJsonObject_LoadSb(jResp,sbResponseBody);
CkJsonObject_putEmitCompact(jResp,FALSE);
printf("Response Body:\n");
printf("%s\n",CkJsonObject_emit(jResp));
respStatusCode = CkHttpResponse_getStatusCode(resp);
printf("Response Status Code = %d\n",respStatusCode);
if (respStatusCode >= 400) {
printf("Response Header:\n");
printf("%s\n",CkHttpResponse_header(resp));
printf("Failed.\n");
CkHttpResponse_Dispose(resp);
CkHttp_Dispose(http);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);
return;
}
CkHttpResponse_Dispose(resp);
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "ticket_form": {
// "name": "<string>",
// "active": "<boolean>",
// "agent_conditions": [
// {
// "aliqua6": "proident deserunt",
// "Lorem_d": "cillum dolor Excepteur ut",
// "mollit_cf": -33059877,
// "ullamco_f7": "dolore occaeca"
// },
// {
// "consequate_": 29214347.18513973,
// "consectetur_00": 83697330,
// "laborum50": "cillum Ut"
// }
// ],
// "created_at": "<dateTime>",
// "default": "<boolean>",
// "display_name": "<string>",
// "end_user_conditions": [
// {
// "irure__c": false,
// "Excepteur_38": -15203265.607602075,
// "sunt_8": "culpa laboris Ut"
// },
// {
// "nulla_48": "quis esse",
// "ullamco_f6": -25516091.19614251
// }
// ],
// "end_user_visible": "<boolean>",
// "id": "<integer>",
// "in_all_brands": "<boolean>",
// "position": "<integer>",
// "raw_display_name": "<string>",
// "raw_name": "<string>",
// "restricted_brand_ids": [
// "<integer>",
// "<integer>"
// ],
// "ticket_field_ids": [
// "<integer>",
// "<integer>"
// ],
// "updated_at": "<dateTime>",
// "url": "<string>"
// }
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
// Chilkat functions returning "const char *" return a pointer to temporary internal memory owned and managed by Chilkat.
Name = CkJsonObject_stringOf(jResp,"ticket_form.name");
Active = CkJsonObject_stringOf(jResp,"ticket_form.active");
Created_at = CkJsonObject_stringOf(jResp,"ticket_form.created_at");
Default = CkJsonObject_stringOf(jResp,"ticket_form.default");
Display_name = CkJsonObject_stringOf(jResp,"ticket_form.display_name");
End_user_visible = CkJsonObject_stringOf(jResp,"ticket_form.end_user_visible");
Id = CkJsonObject_stringOf(jResp,"ticket_form.id");
In_all_brands = CkJsonObject_stringOf(jResp,"ticket_form.in_all_brands");
Position = CkJsonObject_stringOf(jResp,"ticket_form.position");
Raw_display_name = CkJsonObject_stringOf(jResp,"ticket_form.raw_display_name");
Raw_name = CkJsonObject_stringOf(jResp,"ticket_form.raw_name");
Updated_at = CkJsonObject_stringOf(jResp,"ticket_form.updated_at");
v_Url = CkJsonObject_stringOf(jResp,"ticket_form.url");
i = 0;
count_i = CkJsonObject_SizeOfArray(jResp,"ticket_form.agent_conditions");
while (i < count_i) {
CkJsonObject_putI(jResp,i);
aliqua6 = CkJsonObject_stringOf(jResp,"ticket_form.agent_conditions[i].aliqua6");
Lorem_d = CkJsonObject_stringOf(jResp,"ticket_form.agent_conditions[i].Lorem_d");
mollit_cf = CkJsonObject_IntOf(jResp,"ticket_form.agent_conditions[i].mollit_cf");
ullamco_f7 = CkJsonObject_stringOf(jResp,"ticket_form.agent_conditions[i].ullamco_f7");
consequate_ = CkJsonObject_stringOf(jResp,"ticket_form.agent_conditions[i].consequate_");
consectetur_00 = CkJsonObject_IntOf(jResp,"ticket_form.agent_conditions[i].consectetur_00");
laborum50 = CkJsonObject_stringOf(jResp,"ticket_form.agent_conditions[i].laborum50");
i = i + 1;
}
i = 0;
count_i = CkJsonObject_SizeOfArray(jResp,"ticket_form.end_user_conditions");
while (i < count_i) {
CkJsonObject_putI(jResp,i);
irure__c = CkJsonObject_BoolOf(jResp,"ticket_form.end_user_conditions[i].irure__c");
Excepteur_38 = CkJsonObject_stringOf(jResp,"ticket_form.end_user_conditions[i].Excepteur_38");
sunt_8 = CkJsonObject_stringOf(jResp,"ticket_form.end_user_conditions[i].sunt_8");
nulla_48 = CkJsonObject_stringOf(jResp,"ticket_form.end_user_conditions[i].nulla_48");
ullamco_f6 = CkJsonObject_stringOf(jResp,"ticket_form.end_user_conditions[i].ullamco_f6");
i = i + 1;
}
i = 0;
count_i = CkJsonObject_SizeOfArray(jResp,"ticket_form.restricted_brand_ids");
while (i < count_i) {
CkJsonObject_putI(jResp,i);
strVal = CkJsonObject_stringOf(jResp,"ticket_form.restricted_brand_ids[i]");
i = i + 1;
}
i = 0;
count_i = CkJsonObject_SizeOfArray(jResp,"ticket_form.ticket_field_ids");
while (i < count_i) {
CkJsonObject_putI(jResp,i);
strVal = CkJsonObject_stringOf(jResp,"ticket_form.ticket_field_ids[i]");
i = i + 1;
}
CkHttp_Dispose(http);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);
}
Curl Command
curl -u login:password -X POST
-H "Accept: application/json"
https://example.zendesk.com/api/v2/ticket_forms/:ticket_form_id/clone
Postman Collection Item JSON
{
"name": "Clone an already existing ticket form",
"request": {
"method": "POST",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/ticket_forms/:ticket_form_id/clone",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"ticket_forms",
":ticket_form_id",
"clone"
],
"variable": [
{
"key": "ticket_form_id",
"value": "<integer>"
}
]
},
"description": "#### Allowed For\n\n* Admins\n"
},
"response": [
{
"name": "Success response",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/ticket_forms/:ticket_form_id/clone",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"ticket_forms",
":ticket_form_id",
"clone"
],
"variable": [
{
"key": "ticket_form_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"ticket_form\": {\n \"name\": \"<string>\",\n \"active\": \"<boolean>\",\n \"agent_conditions\": [\n {\n \"aliqua6\": \"proident deserunt\",\n \"Lorem_d\": \"cillum dolor Excepteur ut\",\n \"mollit_cf\": -33059877,\n \"ullamco_f7\": \"dolore occaeca\"\n },\n {\n \"consequate_\": 29214347.18513973,\n \"consectetur_00\": 83697330,\n \"laborum50\": \"cillum Ut\"\n }\n ],\n \"created_at\": \"<dateTime>\",\n \"default\": \"<boolean>\",\n \"display_name\": \"<string>\",\n \"end_user_conditions\": [\n {\n \"irure__c\": false,\n \"Excepteur_38\": -15203265.607602075,\n \"sunt_8\": \"culpa laboris Ut\"\n },\n {\n \"nulla_48\": \"quis esse\",\n \"ullamco_f6\": -25516091.19614251\n }\n ],\n \"end_user_visible\": \"<boolean>\",\n \"id\": \"<integer>\",\n \"in_all_brands\": \"<boolean>\",\n \"position\": \"<integer>\",\n \"raw_display_name\": \"<string>\",\n \"raw_name\": \"<string>\",\n \"restricted_brand_ids\": [\n \"<integer>\",\n \"<integer>\"\n ],\n \"ticket_field_ids\": [\n \"<integer>\",\n \"<integer>\"\n ],\n \"updated_at\": \"<dateTime>\",\n \"url\": \"<string>\"\n }\n}"
}
]
}