Back to Collection Items
// This example assumes the Chilkat API to have been previously unlocked.
// See Global_Ref.html">Global Unlock Sample for sample code.
http := chilkat.NewHttp()
var success bool
http.SetBasicAuth(true)
http.SetLogin("username")
http.SetPassword("password")
resp := http.QuickRequest("DELETE","https://domain.com/")
if http.LastMethodSuccess() == false {
fmt.Println(http.LastErrorText())
http.DisposeHttp()
return
}
sbResponseBody := chilkat.NewStringBuilder()
resp.GetBodySb(sbResponseBody)
jResp := chilkat.NewJsonObject()
jResp.LoadSb(sbResponseBody)
jResp.SetEmitCompact(false)
fmt.Println("Response Body:")
fmt.Println(*jResp.Emit())
respStatusCode := resp.StatusCode()
fmt.Println("Response Status Code = ", respStatusCode)
if respStatusCode >= 400 {
fmt.Println("Response Header:")
fmt.Println(resp.Header())
fmt.Println("Failed.")
resp.DisposeHttpResponse()
http.DisposeHttp()
sbResponseBody.DisposeStringBuilder()
jResp.DisposeJsonObject()
return
}
resp.DisposeHttpResponse()
http.DisposeHttp()
sbResponseBody.DisposeStringBuilder()
jResp.DisposeJsonObject()
Curl Command
curl -X DELETE
-u 'username:password'
https://domain.com/
Postman Collection Item JSON
{
"name": "Delete Conversation",
"_postman_id": "381c099d-f11d-4672-ae3c-c0dc67509758",
"request": {
"method": "DELETE",
"header": [
],
"url": "{{url}}/v2/apps/{{appId}}/conversations/{{conversationId}}",
"description": "Delete an entire conversation record, along with its messages and attachments. Note that the default conversation cannot be deleted, but the messages contained [can be](#deleteAllMessages)."
},
"response": [
{
"id": "320df640-c966-4083-bcd3-b4433a631e4a",
"name": "Conversation 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",
"host": [
"{{baseUrl}}"
],
"path": [
"v2",
"apps",
":appId",
"conversations",
":conversationId"
],
"variable": [
{
"key": "appId"
},
{
"key": "conversationId"
}
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"id": "4c857bc9-907e-4ab6-9bf8-1bfd947ef5a8",
"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",
"host": [
"{{baseUrl}}"
],
"path": [
"v2",
"apps",
":appId",
"conversations",
":conversationId"
],
"variable": [
{
"key": "appId"
},
{
"key": "conversationId"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{}"
},
{
"id": "95aad8b7-0f04-49d7-b90a-3b160137c70d",
"name": "Conversation c93bb9c14dde8ffb94564eae cannot be deleted because it is the default.",
"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",
"host": [
"{{baseUrl}}"
],
"path": [
"v2",
"apps",
":appId",
"conversations",
":conversationId"
],
"variable": [
{
"key": "appId"
},
{
"key": "conversationId"
}
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "text",
"header": [
{
"key": "Content-Type",
"value": "text/plain"
}
],
"cookie": [
],
"body": ""
}
]
}