Skip to content
Timothy Duffy edited this page Apr 5, 2015 · 2 revisions

###get_messages.json###

The get_messages.json gets any messages the user may have waiting for them. This includes response messages. This is an HTTP GET end point;

/get_messages.json?cuid=<client_id>&language_code=<language_code>&lat=<lat>&lng=<lng>

Field Descriptions:

[GET]
client_id:

    This is of type text, and is the unique id of the client.  This is a uuid that is generated by the 
    client and is associated with a user within the database.  Event if a user is 'validated' their 
    unique client_id is still used to identify them.

[GET]
language_code:

    This is of type text, and holds the two letter language code the post is in.  Language codes must
    match those codes that exist within the languages table within the database.  Valid values currently
    are:

        en - English
        es - Español

    Note: If responding to an assignment, the response post should have the same language code as the
    question being asked.

[GET]
lat:
    This is the latitude of the user. 43.1656 is an example.

[GET]
lng
    This is the longitude of the user.  -77.6114 is an example.

An example response looks like:

{
    "messages": [
        {
            "message_datetime": "2014-07-10 15:52:41.388892",
            "parent_message_id": null,
            "text": "Congratulations, you are now apart of Yellr!  You can start posting content right away!",
            "from_organization": null,
            "from_user_id": null,
            "to_user_id": 1,
            "subject": "Welcome to Yellr!"
            "message_id": 2,
        }
    ],
    "success": true
}

Response Field Descriptions:

message_datetime:

    This is the date and time the message was created.

parent_message_id:

    This holds the parent message id.  If the message is apart of a chain of correspondence, this will be
    the message the sender is responding to.  If the field is null, then it is an original, and the first
    of a correspondence chain.

text:

    This is the body text of the message.

from_organization:

    The display organization that the message is from.  If this field is null it is a system message.

from_user_id:

    This is the ID of the user that sent the message.  If it is null then it is a system message.

to_user_id:

    This is the ID of the client user.

subject:

    This is the subject field for the message.  This is usually a brief description or theme of the 
    message body.
Clone this wiki locally