View file api_docs/endpoints/messaging/includes/get-messages.phtml

File size: 2.78Kb
<div class="content__inner">
    <h2>Get Messages</h2>
    <p>
        Please use this <strong>(<?php echo cl_link("mobile_api/get_messages"); ?>) API for accessing the endpoint of the message list</strong> 
    </p>
    <br>
    <h4 class="table-title">Get parameters</h4>
    <table class="table table-bordered">
        <thead>
        <tr>
            <th width="15%">Field</th>
            <th width="25%">Value</th>
            <th width="45%">Remarks</th>
        </tr>
        </thead>
        <tbody>
            <tr>
                <td>session_id</td>
                <td>​Access token ID</td>
                <td>
                    E.g. de25cc16eb00960f076...
                </td>
            </tr>
            <tr>
                <td>user_id</td>
                <td>​User ID of the interlocutor</td>
                <td>
                    E.g. 4567
                </td>
            </tr>
            <tr>
                <td>offset_up</td>
                <td>First message offset ID</td>
                <td>
                    This is only needed when loading old messages from the current chat.
                </td>
            </tr>
            <tr>
                <td>offset_down</td>
                <td>Last message offset ID</td>
                <td>
                    This is only needed when loading new messages from the current chat.
                </td>
            </tr>
            <tr>
                <td>page_size</td>
                <td>​Total message limit for each request</td>
                <td>
                    Recommended: 20
                </td>
            </tr>
        </tbody>
    </table>
    <h4 class="table-title">Success response</h4>
    <div class="code-holder">
        <div class="code-holder-inner">
    <pre><code class="json">{
        "code": 200,
        "data": [
            {
                "id": 86,
                "sent_by": 7,
                "sent_to": 78,
                "owner": true,
                "message": "1",
                "media_file": "",
                "media_type": "none",
                "seen": "0",
                "deleted_fs1": "N",
                "deleted_fs2": "N",
                "time": "22 Nov, 2020 10:11",
                "side": "right"
            },
            {...}
        ]
    }
    </code></pre>
        </div>
    </div>
    <h4 class="table-title">Error responses</h4>
    <div class="code-holder">
        <div class="code-holder-inner">
    <pre><code class="json">{
        "code": 401,
        "data": [],
        "message": "Unauthorized Access"
    }

    {
        "code": 400,
        "message": "Interlocutor ID is missing or invalid",
        "data": []
    }

    {
        "code": 204,
        "message": "No data found",
        "data": []
    }
    </code></pre>
        </div>
    </div>
</div>