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;
// 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,"username");
CkHttp_putPassword(http,"password");
resp = CkHttp_QuickRequest(http,"DELETE","https://domain.com/v2/apps/{{appId}}/conversations/{{conversationId}}/messages/:messageId");
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);
CkHttp_Dispose(http);
CkStringBuilder_Dispose(sbResponseBody);
CkJsonObject_Dispose(jResp);
}
Curl Command
curl -X DELETE
-u 'username:password'
https://domain.com/v2/apps/{{appId}}/conversations/{{conversationId}}/messages/:messageId
Postman Collection Item JSON
{
"name": "Delete Message",
"_postman_id": "5d762656-c623-4682-8c64-2c3ed6d53333",
"request": {
"method": "DELETE",
"header": [
],
"url": {
"raw": "{{url}}/v2/apps/{{appId}}/conversations/{{conversationId}}/messages/:messageId",
"host": [
"{{url}}"
],
"path": [
"v2",
"apps",
"{{appId}}",
"conversations",
"{{conversationId}}",
"messages",
":messageId"
],
"variable": [
{
"key": "messageId"
}
]
},
"description": "Delete a single message of a particular conversation."
},
"response": [
{
"id": "7a439e80-72c7-44c9-887b-6a51ddf3c491",
"name": "Not found",
"originalRequest": {
"method": "DELETE",
"header": [
{
"description": {
"content": "Added as a part of security scheme: bearer",
"type": "text/plain"
},
"key": "Authorization",
"value": "Bearer <token>"
}
],
"url": {
"raw": "{{baseUrl}}/v2/apps/:appId/conversations/:conversationId/messages/:messageId",
"host": [
"{{baseUrl}}"
],
"path": [
"v2",
"apps",
":appId",
"conversations",
":conversationId",
"messages",
":messageId"
],
"variable": [
{
"key": "appId"
},
{
"key": "conversationId"
},
{
"key": "messageId"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"id": "8ad0db6a-c82e-4272-8996-b92c7399a83c",
"name": "Ok",
"originalRequest": {
"method": "DELETE",
"header": [
{
"description": {
"content": "Added as a part of security scheme: bearer",
"type": "text/plain"
},
"key": "Authorization",
"value": "Bearer <token>"
}
],
"url": {
"raw": "{{baseUrl}}/v2/apps/:appId/conversations/:conversationId/messages/:messageId",
"host": [
"{{baseUrl}}"
],
"path": [
"v2",
"apps",
":appId",
"conversations",
":conversationId",
"messages",
":messageId"
],
"variable": [
{
"key": "appId"
},
{
"key": "conversationId"
},
{
"key": "messageId"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{}"
}
]
}