Messages API

Get Conversations

OVERVIEW

Method to obtain messages

This method is supported in version 4 of the API and above

Request URI

GET         /api/4/conversations?searchtext={searchtext}&filter={filter}

 

Parameter Name Value Description
searchtext String
       search input
filter String         ACTIVE (default)
        UNREAD
        ARCHIVED
offset int The integer value of the last message conversation fetched. 
limit int

No of message conversations to return in one request. Default is 6 and the maximum value is 25

If a value of 0 or less is provided in the request then 6 message conversations will be returned.

If a value of more than 25 is provided then 25 message conversations are returned. 

 

Response

The response will contain a collection of messages

<conversations>

Conversation Common Object  list

</conversations>


Response codes

 

CODE MEANING
    201    Comments returned successfully
    400    Problem with parameters
    401     Unauthorized
    403    Validation failed | Forbidden
    500    Internal error occurred while returning comments

 

In case of an error code other than 201, an error object will be returned in the format 

Error Response

<error>
     <ref>{integer reference id, generated on the server side} </ref>
     <summary>{Description for the error message}</summary>
</error>

 

Response body sample

XML form

<conversations>
    <conversation>
        <conversationid>{conversation id}</conversationid>
        <recipients>
            <users>
                <user>
                    <userid>{User id}</userid>
                    <name>
                          <firstname>{first name}</firstname>
                          <lastname>{last name}</lastname>
                    </name>
                    <httpavatar></httpavatar>
                    <avatar></avatar>
                    <userlink></userlink>
                    <httplink></httplink>
                </user>
                <user>
                    <userid>{User id}</userid>
                    <name>
                          <firstname>{first name}</firstname>
                          <lastname>{last name}</lastname>
                    </name>
                    <httpavatar></httpavatar>
                    <avatar></avatar>
                    <userlink></userlink>
                    <httplink></httplink>
                </user>
            </users>
        </recipients>
        <messages>
            <message>
                <text></text>
                <lastsentdatetime></lastsentdatetime>
            </message>
        </messages>
    </conversation>
    <conversation>
        <conversationid>{conversation id}</conversationid>
        <recipients>
            <users>
                <user>
                    <userid>{User id}</userid>
                    <name>
                          <firstname>{first name}</firstname>
                          <lastname>{last name}</lastname>
                    </name>
                    <httpavatar></httpavatar>
                    <avatar></avatar>
                    <userlink></userlink>
                    <httplink></httplink>
                </user>
                <user>
                    <userid>{User id}</userid>
                    <name>
                          <firstname>{first name}</firstname>
                          <lastname>{last name}</lastname>
                    </name>
                    <httpavatar></httpavatar>
                    <avatar></avatar>
                    <userlink></userlink>
                    <httplink></httplink>
                </user>
            </users>
        </recipients>
        <messages>
            <message>
                <text></text>
                <lastsentdatetime></lastsentdatetime>
            </message>
        </messages>
    </conversation>
</conversations>

JSON form

[
   {
      "conversationid": "{conversation id}",
      "recipients": {
         "users": [
            {
               "userid": "{User id}",
               "name": {
                  "firstname": "{first name}",
                  "lastname": "{last name}"
               },
               "httpavatar": [],
               "avatar": [],
               "userlink": [],
               "httplink": []
            },
            {
               "userid": "{User id}",
               "name": {
                  "firstname": "{first name}",
                  "lastname": "{last name}"
               },
               "httpavatar": [],
               "avatar": [],
               "userlink": [],
               "httplink": []
            }
         ]
      },
      "messages": {
         "message": {
            "text": [],
            "lastsentdatetime": []
         }
      }
   },
   {
      "conversationid": "{conversation id}",
      "recipients": {
         "users": [
            {
               "userid": "{User id}",
               "name": {
                  "firstname": "{first name}",
                  "lastname": "{last name}"
               },
               "httpavatar": [],
               "avatar": [],
               "userlink": [],
               "httplink": []
            },
            {
               "userid": "{User id}",
               "name": {
                  "firstname": "{first name}",
                  "lastname": "{last name}"
               },
               "httpavatar": [],
               "avatar": [],
               "userlink": [],
               "httplink": []
            }
         ]
      },
      "messages": {
         "message": {
            "text": [],
            "lastsentdatetime": []
         }
      }
   }
]


Note : It will return only root message's details without images and attachments.

Comments


0 Comments

Last Updated: Nov 08,2024