Previous topic

API Introduction

Next topic

Query Category items

This Page

Query for the Menu

The Menu endpoint allows you to submit GET requests to retrive all of the currently active categories and descriptions. This allows apps to use this information to build their menu entries.

Apps are required to query this endpoint in order to populate their menu entries. This ensures the menus always show the latest options.

The response provides a list of categories with name and descriptions attributes. The descriptions contain a list of all of the descriptions for that category with their respective name and id’s. The description id is important as this is what will be used when submitting reports.

All categories and descriptions are returned in the order they should appear in the menu. Please respect this order when displaying the menu for users.

GET /mping/api/v2/menu

Get all available menu options

Example request:

GET /mping/api/v2/menu HTTP/1.0
Host: mping.ou.edu
Accept: application/json
Request Headers:
 
  • Accept-Language – Optional: if need menu entries in another language supported by the API
  • Content-Type – Optional: requested format type of response (default is json)

Example response

HTTP/1.0 200 OK
Date: Wed, 11 Feb 2015 17:14:23 GMT
Server: WSGIServer/0.1 Python/2.7.9
Vary: Accept, Accept-Language, Cookie
Content-Type: application/json
Content-Language: en-us
Allow: GET, HEAD, OPTIONS

{
  "count": 9,
  "next": null,
  "previous": null,
  "results": [
    {
      "name": "Test",
      "descriptions": [
        {
          "id": 1,
          "name": "NULL"
        }
      ]
    },
    {
      "name": "None",
      "descriptions": [
        {
          "id": 2,
          "name": "NULL"
        }
      ]
    },
    {
      "name": "Rain/Snow",
      "descriptions": [
        {
          "id": 3,
          "name": "Rain"
        },
        {
          "id": 4,
          "name": "Freezing Rain"
        },
        {
          "id": 5,
          "name": "Drizzle"
        },
        {
          "id": 6,
          "name": "Sleet/Ice Pellets"
        },
        {
          "id": 7,
          "name": "Snow"
        },
        {
          "id": 8,
          "name": "Mixed Rain and Snow"
        },
        {
          "id": 9,
          "name": "Mixed Ice Pellets and Snow"
        },
        {
          "id": 10,
          "name": "Mixed Rain and Ice Pellets"
        }
      ]
    },
Status Codes:
Response JSON Object:
 
  • count (int) – The total number of menu entries matching your query
  • next (string) – provides url to get next page of results otherwise null
  • previous (string) – provides url to get previous page of results otherwise null
  • results (array) – array of menu entries matching your query
Response JSON Array of Objects:
 
  • id (int) – primary id for this Category
  • name (string) – Category name of menu
  • descriptions (array) – array of Description items for this Category menu
  • [description id] (int) – primary id for this Description (needed when submitting a report)
  • [description name] (string) – Description name