Skip to content

Admin API Documentation

Timothy Duffy edited this page Mar 8, 2015 · 5 revisions

#NOTE: THIS PAGE IS DEPRECATED AND WILL SOON BE REMOVED. DO NOT USE THESE DOCS!#







##Admin APIs##

###admin/get_access_token.json###

This gets an access token that needs to be passed around with all admin api calls.

admin/get_access_token.json

POST fields:

username
    =<username>

password
    =<password>

Response:

{
    "username": "temp_user",
    "first_name": "",
    "last_name": "",
    "fence": {
        "bottom_right_lat": 43,
        "top_left_lng": -77.9,
        "top_left_lat": 43.4,
        "bottom_right_lng": -77.3
    },
    "success": true,
    "token": "5861d170-7de2-4373-b86d-1520c46cea0a",
    "organization": ""
}

Possible error messages include:

Bad credentials:
{
    "success": false,
    "error_text": "Invalid credentials"
}

Missing fields:

{
    "success": false,
    "error_text": "Missing 'username' or 'password' within request"
}

###admin/check_logged_in.json###

This end point sees if the user is logged in using a token passed via a GET param, or by looking at the session.

admin/check_logged_in.json

Fields:

[optional]
token
    This is an optional field of the token.  In cases where sessions are not used, this is where the token being checked would be passed.

An example response looks like:

{
    "logged_in": false,
    "success": true
}

###admin/logout.json###

This end point logs the user out, removing the token from the database and session.

admin/logout.json

Fields

[optional]
token
    This is an optional field of the token.  In cases where sessions are not used, this is where the token being checked would be passed.

An example response looks like:

{
    "success": true
}

###admin/get_posts.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/get_posts.json?token=238236fa-0e1a-499c-8051-c46e2f416387&start=<start_index>&count=<count>&deleted=<deleted>

There are thre optional fields:

[ OPTIONAL ]
start
    Start allows you to set a starting index for the responses.  This is useful for paging.
    Note: If start is not specified, then it defaults to 0.

[ OPTIONAL ]
count
    Count allows you to set the number of responses to return.  This is useful for paging.
    Note: If count is not specified, then it defaults to 50.

[ OPTIONAL ]
deleted
    This will return only the deleted posts if set to a non-zero int.  If omitted or set to 0, 
    posts that are not deleted will be returned.

Note: within the response there is the 'total_post_count' field. This is the total number of posts within the database. This is useful for paging.

Example response:

{
    "total_post_count": 3,
    "posts": [
        {
            "deleted": false,
            "verified_user": false,
            "post_id": 3,
            "client_id": "c844debc-7671-4226-aada-b8b4bf58040b",
            "language_code": "en",
            "lat": 43.1,
            "lng": -77.5,
            "post_datetime": "2015-01-07 15:19:27.223430",
            "media_objects": [
                {
                    "media_id": "80774262-6cc7-4697-b852-95ea2d05dfdd",
                    "file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339.jpg",
                    "preview_file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339p.jpg",
                    "media_text": "I saw a policeman help walk an old lady accross the street today.",
                    "caption": "",
                    "media_type_description": "Text.",
                    "media_type_name": "text"
                }
            ],
            "user_id": 2,
            "title": "",
            "assignment_id": null,
            "assignment_name": null,
            "language_name": "English"
        },
        {
            "deleted": false,
            "verified_user": false,
            "post_id": 2,
            "client_id": "120ce16c-4d52-48e4-8f7a-11e8ee49879c",
            "language_code": "en",
            "lat": 43.1,
            "lng": -77.5,
            "post_datetime": "2015-01-07 15:19:26.948721",
            "media_objects": [
                {
                    "media_id": "d4d8a1d7-92c4-425d-b722-a21b95537295",
                    "file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339.jpg",
                    "preview_file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339p.jpg",
                    "media_text": "Going out to Da CLUB!!!",
                    "caption": "",
                    "media_type_description": "Text.",
                    "media_type_name": "text"
                }
            ],
            "user_id": 3,
            "title": "",
            "assignment_id": 1,
            "assignment_name": "What are you doing for new years?",
            "language_name": "English"
        },
        {
            "deleted": false,
            "verified_user": false,
            "post_id": 1,
            "client_id": "c844debc-7671-4226-aada-b8b4bf58040b",
            "language_code": "en",
            "lat": 43.1,
            "lng": -77.5,
            "post_datetime": "2015-01-07 15:19:26.665846",
            "media_objects": [
                {
                    "media_id": "668ad40c-1c39-41b1-baf5-5cb9e3c5f64f",
                    "file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339.jpg",
                    "preview_file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339p.jpg",
                    "media_text": "Hopefully staying awake long enough to see the ball drop ... :/",
                    "caption": "",
                    "media_type_description": "Text.",
                    "media_type_name": "text"
                }
            ],
            "user_id": 2,
            "title": "",
            "assignment_id": 1,
            "assignment_name": "What are you doing for new years?",
            "language_name": "English"
        }
    ],
    "success": true
}

There are two different errors that can come back:

{
    "error_text": "Invalid auth token.",
    "success": false
}

{
    "error_text": "Missing 'token' field in request.",
    "success": false
}

The file_name and preview_file_name fields are used in this manor:

http://<root_domain>/media/<file_name>

- and -

http://<root_domain>/media/<preview_file_name>

###admin/get_post.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/get_post.json?token=238236fa-0e1a-499c-8051-c46e2f416387&post_id=<post_id>

There is a single field:

post_id
    This is the ID of the desired post.

Note: within the response there is the 'total_post_count' field. This is the total number of posts within the database. This is useful for paging.

Example response:

{
    "post" :
        {
            "deleted": false,
            "verified_user": false,
            "post_id": 1,
            "client_id": "c844debc-7671-4226-aada-b8b4bf58040b",
            "language_code": "en",
            "lat": 43.1,
            "lng": -77.5,
            "post_datetime": "2015-01-07 15:19:26.665846",
            "media_objects": [
                {
                    "media_id": "668ad40c-1c39-41b1-baf5-5cb9e3c5f64f",
                    "file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339.jpg",
                    "preview_file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339p.jpg",
                    "media_text": "Hopefully staying awake long enough to see the ball drop ... :/",
                    "caption": "",
                    "media_type_description": "Text.",
                    "media_type_name": "text"
                }
            ],
            "user_id": 2,
            "title": "",
            "assignment_id": 1,
            "language_name": "English"
        }
    },
    "success": true
}

There are two different errors that can come back:

{
    "error_text": "Invalid auth token.",
    "success": false
}

{
    "error_text": "Missing post_id",
    "success": false
}

The file_name and preview_file_name fields are used in this manor:

http://<root_domain>/media/<file_name>

- and -

http://<root_domain>/media/<preview_file_name>

###admin/create_question.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/create_question.json?token=238236fa-0e1a-499c-8051-c46e2f416387

There are two parts of an assignment: the assignment itself, and the questions that go along with it. Yellr supports multiple questions to support multiple languages. The create_question.json is a HTTP POST event, and takes Four mandatory fields.

language_code
    The two letter language code for the question ('en', 'es', 'fr', etc.)

question_text
    This is the text of the question, in whatever language is defined by the 
    language_code field

description
    This is a field that allows additional information to be presented about the question.
    This is a nice way to keep the question brief and concise, while still giving enough information
    within this field for the user to understand why the asking person wanted to know.

question_type
    This is the type of question: free text, multiple choice, ect.
    Examples: 'free_text', 'multiple_choice'

[ OPTIONAL ]
answers
    Optionally you can include a field called answers.  This field is a JSON array of
    strings.  This is used for questions types such as multiple choice.  You are allowed
    up to ten options.  You do not need to specify all ten if they are not used.

A valid response will include a success field, and a question_id field. This ID is used with the publish_assignment.json api to link questions to assignments.

{
    "success": true
    "question_id": 5
}

There are two different errors that can come back:

{
    "error_text": "Missing 'token' field in request.",
    "success": false
}

{
    "error_text": "One or more of the following fields is missing or invalid: 
                   language_code, question_text, question_type. ",
    "success": false
}

###admin/publish_assignment.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/publish_assignment.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This call is an HTTP POST API. The command takes six fields:

name
    This is a short name for the assignment so it is easily picked out when several are displayed.
    This is only used on the moderator side, and will not be displayed to users.

life_time
    This is a non-zero integer that represents the number of hours the assignment should live for.

questions
    This is a JSON array of question ids that are associated with the assignment.
    note: see admin/create_question.json for more information on question ids.

top_left_lat
     The top left latitude of the geo fence bounding box for the assignment in degrees.

top_left_lng
     The top left longitude of the geo fence bounding box for the assignment in degrees.

bottom_right_lat
    The bottom right latitude of the geo fence bounding box for the assignment in degrees.

bottom_right_lng
    The bottom right longitude of the geo fence bounding box for the assignment in degrees.

Note: set the bounding box to these values for 'the whole earth':

top_left_lat: 90
top_left_lng: -180
bottom_right_lat: -90
bottom_right_lng: 180

Note: set the bounding box to these values for 'Monroe County, NY':

top_left_lat: 43.4
top_left_lng: -77.9
bottom_right_lat: 43.0
bottom_right_lng: -77.3

A successful response looks like this:

{
    "assignment_id": 4,
    "success": true
}

Possible errors include:

{
    "error_text": "One or more of the following fields is missing or invalid: life_time,questions (JSON list of question id's). ",
    "success": false
}

###admin/update_assignment.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/create_message.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This call is an HTTP POST API. The command takes two fields:

name
    This is a short name for the assignment so it is easily picked out when several are displayed.
    This is only used on the moderator side, and will not be displayed to users.

life_time
    This is a non-zero integer that represents the number of hours the assignment should live for.
    Note: this is the number of hours *from when the assignment was originally posted*.

# [ NOT YET IMPLEMENTED ]
#questions
#    This is a JSON array of question ids that are associated with the assignment.
#    note: see admin/create_question.json for more information on question ids.

top_left_lat
     The top left latitude of the geo fence bounding box for the assignment in degrees.

top_left_lng
     The top left longitude of the geo fence bounding box for the assignment in degrees.

bottom_right_lat
    The bottom right latitude of the geo fence bounding box for the assignment in degrees.

bottom_right_lng
    The bottom right longitude of the geo fence bounding box for the assignment in degrees.

A valid response looks like:

{
    "assignment_id": 2,
    "success": true
}

###admin/create_message.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/create_message.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This call is an HTTP POST API. The command takes the following fields:

to_client_id
    This is the client if of the user that you are sending the message to.

subject
    This is free-form text that is the subject of the message.

text
    This is the free-form text contents of the message.

[optional]
parent_message_id
    If this is the first message of a chain, then you do not need to include this (and you shouldn't).
    If this is a response to a message that a client sent back to an admin/mod/sub, then 
    this field needs to be included.

Responses:

{
    "error_text": "Invalid auth token.",
    "success": false
}

{
    "error_text": "One or more of the following fields is missing or invalid: to_client_id, subject, text.\n",
    "success": false
}

This can happen if you are trying to respond to the message twice
{
    "success": false
}

This will be returned on a valid posting.
{
    "message_id": 3,
    "success": true 
}

###admin/get_languages.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/get_languages.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This command returns the available languages the system supports. It is a HTTP GET request.

A response looks like:

{
    "languages": [
        {
            "code": "en",
            "name": "English"
        },
        {
            "code": "sp",
            "name": "Spanish"
        }
    ],
    "success": true
}

###admin/get_organizations.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/get_organizations.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This command returns the organizations the system. It is a HTTP GET request.

A response looks like:

{
    "organizations": [
        {
            "description": "",
            "created": "2015-03-07 17:21:26.350299",
            "contact_email": "",
            "contact_name": "",
            "id": 1,
            "name": "Yellr"
        }
    ],
    "success": true
}

###admin/get_question_types.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/get_question_types.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This command returns the available languages the system supports. It is a HTTP GET request.

A response looks like:

{
    "question_types": [
        {
            "question_type_text": "free_text",
            "question_type_id": 1,
            "question_type_description": "Free form text responce."
        },
        {
            "question_type_text": "multiple_choice",
            "question_type_id": 2,
            "question_type_description": "Allows for up to ten multiple choice options"
        }
    ],
    "success": true
}

###admin/add_organization.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/create_user.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This allows for creating new organizations. This is a HTTP POST request.

The following fields are required:

name
    The name of the organization.

description
    A brief description of the organization.

contact_name
    A contact name for the organization.

contact_email
    An email address for the contact name.

An example of a response looks like:

{
    "organization_id": 2,
    "success": true
}

###admin/create_user.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/create_user.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This allows for creating new users. This is a HTTP POST request.

The following fields are required:

user_type
    This is the type of the user.  Valid values are: admin, moderator, subscriber, user

user_name
    This is a username that is used to login with.

password
    The password for the username.  There are no restrictions to this field.

first_name
    First name of the user.

last_name
    Last name of the user.

email
    The email address of the user.

organization
    The organization the user belongs to.

fence_top_left_lat
    
    Users default top left geo fence box latitude value.

fence_top_left_lng

    Users default top left geo fence box longitude value.

fence_bottom_right_lat

    Users default bottom right geo fence box latitude value.

fence_bottom_right_lng

    Users default bottom right geo fence box longitude value.

A response looks like:

{
    "user_id": 3,
    "success": true
}

###admin/get_assignment_responses.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/get_assignment_responses.json?token=238236fa-0e1a-499c-8051-c46e2f416387&assignment_id=<assignment_id>&start=<start_post_index>&count=<post_count>

This is returns all of the posts associated with an assignment. It is a HTTP GET request, and takes the following fields:

assignment_id
    This is the id within the database of the assignment.

[ OPTIONAL ]
start
    This is the post index to start the response from.  This is useful for paging.

[ OPTIONAL ]
count
    This can be used to limit the number of posts that are returned.  This is useful for paging.

[ OPTIONAL ]
deleted
    This will return only the deleted posts if set to a non-zero int.  If omitted or set to 0, 
    posts that are not deleted will be returned.

Note: that the media_objects array will hold all of the media objects associated with the post.

Note: the response is a dictionary of posts, not an array. This was done to speed up response time, and reduce load on the web server so multiple loops did not have to run. Here is the reference to how to iterate though the dictionary in javascript:

http://stackoverflow.com/questions/558981/iterating-through-list-of-keys-for-associative-array-in-json

Note: the keys will be the post id's within the database, and may not go in order (assume they will not), and thus should not be used as an index.

This is what a valid response looks like:

{
    "post_count": 2,
    "posts": [
        {
            "deleted": false,
            "verified_user": false,
            "post_id": 2,
            "client_id": "120ce16c-4d52-48e4-8f7a-11e8ee49879c",
            "language_code": "en",
            "lat": 43.1,
            "lng": -77.5,
            "post_datetime": "2015-01-07 15:19:26.948721",
            "media_objects": [
                {
                    "media_id": "d4d8a1d7-92c4-425d-b722-a21b95537295",
                    "file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339.jpg",
                    "preview_file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339p.jpg",
                    "media_text": "Going out to Da CLUB!!!",
                    "caption": "",
                    "media_type_description": "Text.",
                    "media_type_name": "text"
                }
            ],
            "user_id": 3,
            "title": "",
            "assignment_id": 1,
            "language_name": "English"
        },
        {
            "deleted": false,
            "verified_user": false,
            "post_id": 1,
            "client_id": "c844debc-7671-4226-aada-b8b4bf58040b",
            "language_code": "en",
            "lat": 43.1,
            "lng": -77.5,
            "post_datetime": "2015-01-07 15:19:26.665846",
            "media_objects": [
                {
                    "media_id": "668ad40c-1c39-41b1-baf5-5cb9e3c5f64f",
                    "file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339.jpg",
                    "preview_file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339p.jpg",
                    "media_text": "Hopefully staying awake long enough to see the ball drop ... :/",
                    "caption": "",
                    "media_type_description": "Text.",
                    "media_type_name": "text"
                }
            ],
            "user_id": 2,
            "title": "",
            "assignment_id": 1,
            "language_name": "English"
        }
    ],
    "success": true
}

The file_name and preview_file_name fields are used in this manor:

http://<root_domain>/media/<file_name>

- and -

http://<root_domain>/media/<preview_file_name>

###admin/publish_story.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/publish_story.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This is a HTTP POST end point that takes the following fields:

title
    The title of the post.

tags
    Comma separated list of words the be used as tags.

top_text
    Place where credit, updates, and/or corrections can be placed.

banner_media_id
    The media_id of the banner image to be displayed at the top of the story.

contents
    The markdown/html contents of the story.

language_code
    The two letter language code of the language of the story. ('en', 'es', 'fr', etc.)

top_left_lat
    the top left latitude

top_left_lat
     The top left latitude of the geo fence bounding box for the assignment in degrees.

top_left_lng
     The top left longitude of the geo fence bounding box for the assignment in degrees.

bottom_right_lat
    The bottom right latitude of the geo fence bounding box for the assignment in degrees.

bottom_right_lng
    The bottom right longitude of the geo fence bounding box for the assignment in degrees.

Note: set the bounding box to these values for 'the whole earth':

top_left_lat: 90
top_left_lng: -180
bottom_right_lat: -90
bottom_right_lng: 180

Note: set the bounding box to these values for 'Monroe County, NY':

top_left_lat: 43.4
top_left_lng: -77.9
bottom_right_lat: 43.0
bottom_right_lng: -77.3

A valid response looks like:

{
    "story_unique_id": "9efce1a9-4a1b-45f5-a240-3bd8776646d5",
    "success": true
}

Note: The story_unique_id will be used for recording the number of views a story gets.

###admin/create_collection.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/create_collection.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This is a HTTP POST end point, and includes the following fields:

name
    The name of the collection.

description
    A brief description of the collection.

tags
    This is a comma separated list of tags that describe, or are pertinent to the story.

A valid response looks like this:

{
    "collection_id": 3,
    "success": true
}

###admin/disable_collection.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/disable_collection.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This is a HTTP POST end point, and includes the following fields:

collection_id
    This is the ID of the collection that will be disabled.

A valid response looks like this:

{
    "disabled": true,
    "collection_id": 1,
    "success": true
}

###admin/add_post_to_collection.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/add_post_to_collection.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This is a HTTP POST end point, and includes the following fields:

collection_id
    This is the ID of the collection that the post should be added to.

post_id
    This is the ID of the post being added to the collection.

Note: posts may exist within multiple collections.

A valid response looks like this:

{
    "post_id": 1,
    "success": true,
    "collection_id": 1
}

###admin/remove_post_from_collection.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/remote_post_from_collection.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This is a HTTP POST end point, and includes the following fields:

collection_id
    The ID of the collection that the post defined in the post_id field exists.

post_id
    The ID of the post that should be removed from the collection defined by the
    collection_id field.

A valid response looks like this:

{
    "post_id": 1,
    "success": true,
    "collection_id": 1
}

###admin/get_collection_posts.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/get_collection_posts.json?token=238236fa-0e1a-499c-8051-c46e2f416387&collection_id=<collection_id>

This is a HTTP GET end point, and includes the following fields:

collection_id
    This is the ID of the collection that all returned posts belong to.

Note: that the media_objects array will hold all of the media objects associated with the post.

Note: the response is a dictionary of posts, not an array. This was done to speed up response time, and reduce load on the web server so multiple loops did not have to run. Here is the reference to how to iterate though the dictionary in javascript:

http://stackoverflow.com/questions/558981/iterating-through-list-of-keys-for-associative-array-in-json

Note: the keys will be the post id's within the database, and may not go in order (assume they will not), and thus should not be used as an index.

A valid response looks like this:

    {
    "post_count": 1,
    "collection_id": 1,
    "posts": [
        {
            "deleted": false,
            "verified_user": true,
            "post_id": 1,
            "client_id": "ef32b30b-6e86-4210-ae2a-15b9de670c13",
            "language_code": "en",
            "lat": 43.1,
            "lng": -77.5,
            "post_datetime": "2015-01-07 15:19:26.665846",
            "media_objects": [
                {
                    "media_id": "668ad40c-1c39-41b1-baf5-5cb9e3c5f64f",
                    "file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339.jpg",
                    "preview_file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339p.jpg",
                    "media_text": "Hopefully staying awake long enough to see the ball drop ... :/",
                    "caption": "",
                    "media_type_description": "Text.",
                    "media_type_name": "text"
                }
            ],
            "user_id": 2,
            "title": "",
            "assignment_id": 1,
            "language_name": "English"
        }
    ],
    "success": true,
    "collection_name": "Assignment #1"
}

The file_name and preview_file_name fields are used in this manor:

http://<root_domain>/media/<file_name>

- and -

http://<root_domain>/media/<preview_file_name>

###admin/get_my_collections.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/get_my_collections.json?token=238236fa-0e1a-499c-8051-c46e2f416387

Here is what a valid response looks like:

Note that assignment_id and assignment_name will be populated if the collection is associated with an assignment. Each time an assignment is created, a collection is automatically created with it, and assigned to the assignment.

{
    "collections": [
        {
            "name": "My First Collection",
            "tags": "first, yellr, posts, awesome",
            "enabled": true,
            "collection_datetime": "2014-09-04 22:44:01.727454",
            "decription": "A collection that I will put posts in.",
            "post_count": 43,
            "collection_id": 1,
            "assignment_id": null,
            "assignment_name": null,
        }
    ],
    "success": true
}

###admin/get_my_messages.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/get_my_messages.json?token=238236fa-0e1a-499c-8051-c46e2f416387

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
}

###admin/get_assignments.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/get_my_assignments.json?token=238236fa-0e1a-499c-8051-c46e2f416387

A valid response looks like:

{
    "assignments": [
        {
            "bottom_right_lat": 43,
            "expire_datetime": "2014-09-10 04:20:51.034039",
            "name": "Are you listening?"
            "top_left_lng": -77.9,
            "top_left_lat": 43.4,
            "questions": [
                {
                    "answer9": "",
                    "answer8": "",
                    "answer5": "",
                    "answer4": "",
                    "answer7": "",
                    "answer6": "",
                    "answer1": "No",
                    "answer0": "Yes",
                    "answer3": "",
                    "answer2": "Please leave me alone",
                    "question_type_id": 2,
                    "question_text": "Can you hear me now?"
                }
            ],
            "assignment_id": 1,
            "publish_datetime": "2014-09-08 22:20:51.034033",
            "bottom_right_lng": -77.3
        }
    }
}

###admin/register_post_view.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/register_post_view.json?token=238236fa-0e1a-499c-8051-c46e2f416387

This command registers that a post has been viewed by a admin/mod/sub. It is a HTTP POST request.

The fields required are:

post_id
    This is the id of the post that is being viewed

A response looks like:

{
    "notification_id": 11,
    "post_id": "1",
    "success": true
}

###admin/get_user_posts.json###

All admin api's require a token to be passed in. See get_access_token.json for more information.

admin/get_user_posts.json?token=238236fa-0e1a-499c-8051-c46e2f416387&client_id=<client_id>

This command registers that a post has been viewed by a admin/mod/sub. It is a HTTP GET request.

The fields required are:

client_id
    The unique client ID that you want to get the posts for.

[ OPTIONAL ]
start
    This is the post index to start the response from.  This is useful for paging.

[ OPTIONAL ]
count
    This can be used to limit the number of posts that are returned.  This is useful for paging.

A valid response looks like:

{
    "post_count": 1,
    "posts": [
        {
            "deleted": false,
            "verified_user": true,
            "post_id": 1,
            "client_id": "ef32b30b-6e86-4210-ae2a-15b9de670c13",
            "language_code": "en",
            "lat": 43.1,
            "lng": -77.5,
            "post_datetime": "2015-01-07 15:19:26.665846",
            "media_objects": [
                {
                    "media_id": "668ad40c-1c39-41b1-baf5-5cb9e3c5f64f",
                    "file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339.jpg",
                    "preview_file_name": "4c1c23ab-d989-49fc-af1a-594a38cc1339p.jpg",
                    "media_text": "Hopefully staying awake long enough to see the ball drop ... :/",
                    "caption": "",
                    "media_type_description": "Text.",
                    "media_type_name": "text"
                }
            ],
            "user_id": 2,
            "title": "",
            "assignment_id": 1,
            "language_name": "English"
        }
    ],
    "client_id": "ef32b30b-6e86-4210-ae2a-15b9de670c13",
    "success": true
}

The file_name and preview_file_name fields are used in this manor:

http://<root_domain>/media/<file_name>

- and -

http://<root_domain>/media/<preview_file_name>
Clone this wiki locally