Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Id
string ls_V_Type
string ls_ActiveSwitchboardIntegrationId
string ls_Name
string ls_IntegrationId
string ls_IntegrationType
string ls_PendingSwitchboardIntegrationId
string ls_PendingSwitchboardIntegrationName
string ls_PendingSwitchboardIntegrationIntegrationId
string ls_PendingSwitchboardIntegrationIntegrationType
integer li_IsDefault
string ls_DisplayName
string ls_Description
string ls_IconUrl
string ls_Lang
string ls_BusinessLastRead
string ls_LastUpdatedAt
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Http.BasicAuth = 1
loo_Http.Login = "username"
loo_Http.Password = "password"
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
li_Success = loo_Http.QuickGetSb("https://domain.com/",loo_SbResponseBody)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_SbResponseBody
return
end if
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Http.LastStatus
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Http.LastHeader
Write-Debug "Failed."
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "conversation": {
// "id": "c93bb9c14dde8ffb94564eae",
// "type": "personal",
// "activeSwitchboardIntegration": {
// "id": "5ef21b86e933b7355c11c604",
// "name": "bot",
// "integrationId": "5ef21b86e933b7355c11c605",
// "integrationType": "zd:agentWorkspace"
// },
// "pendingSwitchboardIntegration": {
// "id": "5ef21b86e933b7355c11c604",
// "name": "bot",
// "integrationId": "5ef21b86e933b7355c11c605",
// "integrationType": "zd:agentWorkspace"
// },
// "isDefault": false,
// "displayName": "pari",
// "description": "Conversation between Rogers and Carl.",
// "iconUrl": "https://www.gravatar.com/image.jpg",
// "metadata": {
// "lang": "en-ca"
// },
// "businessLastRead": "2020-06-23T14:33:47.492Z",
// "lastUpdatedAt": "2020-06-26T14:33:47.120Z"
// }
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
ls_Id = loo_JResp.StringOf("conversation.id")
ls_V_Type = loo_JResp.StringOf("conversation.type")
ls_ActiveSwitchboardIntegrationId = loo_JResp.StringOf("conversation.activeSwitchboardIntegration.id")
ls_Name = loo_JResp.StringOf("conversation.activeSwitchboardIntegration.name")
ls_IntegrationId = loo_JResp.StringOf("conversation.activeSwitchboardIntegration.integrationId")
ls_IntegrationType = loo_JResp.StringOf("conversation.activeSwitchboardIntegration.integrationType")
ls_PendingSwitchboardIntegrationId = loo_JResp.StringOf("conversation.pendingSwitchboardIntegration.id")
ls_PendingSwitchboardIntegrationName = loo_JResp.StringOf("conversation.pendingSwitchboardIntegration.name")
ls_PendingSwitchboardIntegrationIntegrationId = loo_JResp.StringOf("conversation.pendingSwitchboardIntegration.integrationId")
ls_PendingSwitchboardIntegrationIntegrationType = loo_JResp.StringOf("conversation.pendingSwitchboardIntegration.integrationType")
li_IsDefault = loo_JResp.BoolOf("conversation.isDefault")
ls_DisplayName = loo_JResp.StringOf("conversation.displayName")
ls_Description = loo_JResp.StringOf("conversation.description")
ls_IconUrl = loo_JResp.StringOf("conversation.iconUrl")
ls_Lang = loo_JResp.StringOf("conversation.metadata.lang")
ls_BusinessLastRead = loo_JResp.StringOf("conversation.businessLastRead")
ls_LastUpdatedAt = loo_JResp.StringOf("conversation.lastUpdatedAt")
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -X GET
-u 'username:password'
https://domain.com/
Postman Collection Item JSON
{
"name": "Get Conversation",
"_postman_id": "ffbb4dbd-fbf6-43f4-9e0c-6be5c4e2829c",
"request": {
"method": "GET",
"header": [
],
"url": "{{url}}/v2/apps/{{appId}}/conversations/{{conversationId}}",
"description": "Fetches an individual conversation."
},
"response": [
{
"id": "90c0f930-c5be-456b-93fd-2d14edac480c",
"name": "Ok",
"originalRequest": {
"method": "GET",
"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": "{\n \"conversation\": {\n \"id\": \"c93bb9c14dde8ffb94564eae\",\n \"type\": \"personal\",\n \"activeSwitchboardIntegration\": {\n \"id\": \"5ef21b86e933b7355c11c604\",\n \"name\": \"bot\",\n \"integrationId\": \"5ef21b86e933b7355c11c605\",\n \"integrationType\": \"zd:agentWorkspace\"\n },\n \"pendingSwitchboardIntegration\": {\n \"id\": \"5ef21b86e933b7355c11c604\",\n \"name\": \"bot\",\n \"integrationId\": \"5ef21b86e933b7355c11c605\",\n \"integrationType\": \"zd:agentWorkspace\"\n },\n \"isDefault\": false,\n \"displayName\": \"pari\",\n \"description\": \"Conversation between Rogers and Carl.\",\n \"iconUrl\": \"https://www.gravatar.com/image.jpg\",\n \"metadata\": {\n \"lang\": \"en-ca\"\n },\n \"businessLastRead\": \"2020-06-23T14:33:47.492Z\",\n \"lastUpdatedAt\": \"2020-06-26T14:33:47.120Z\"\n }\n}"
},
{
"id": "d66e4f40-123a-4f32-8858-445be2b989d3",
"name": "Conversation not found",
"originalRequest": {
"method": "GET",
"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": ""
}
]
}