Previous topic

Filtering Reports

Next topic

Examples

This Page

Submitting Reports

Submission of mPING reports is limited to only those API users who have been given permission to do so in their applications.

Submitting reports consists of sending a POST request to the report endpoint with a payload consisting of json formatted data. The format of this payload is described below.

POST /mping/api/v2/reports

Submit an mPING Report

Example request

POST /mping/api/v2/reports HTTP/1.0
Host: mping.ou.edu
Content-Type: application/json
Authorization: Token Your_API_Key

{
  "description_id": 1,
  "obtime": "2015-02-12T16:22:57Z",
  "geom": {
    "type": "Point",
    "coordinates": [-71.50508467720653, 43.5616146765032]
  }
}
Request Headers:
 
  • Content-Type – required format of “application/json”
  • Authorization – Token Your_API_Key - must provide your api key for authorization
Request JSON Object:
 
  • description_id (int) – The primary id for the selected Description. This is provided from the menu query. This is all that is needed as it will automatically relate the correct Category.
  • obtime (datetime) – the UTC obtime of the report in format $YYYY-$mm-$ddT$HH:$MM:$SSZ
  • geom (geometry) – the longitude and latitude of the report in a geojson style format. Note: longitude is listed first.

Example response

HTTP/1.0 201 CREATED
Date: Thu, 12 Feb 2015 17:47:42 GMT
Server: WSGIServer/0.1 Python/2.7.9
Vary: Accept, Accept-Language, Cookie
Content-Type: application/geojson
Content-Language: en-us
Allow: GET, POST, HEAD, OPTIONS

{
  "type": "FeatureCollection",
  "features": [
    {
      "id": 78792,
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-85.91628, 39.97065]
      },
      "properties": {
        "obtime": "2012-02-15T19:21:00Z",
        "category": "Rain/Snow",
        "description": "Sleet/Ice Pellets",
        "description_id": 7
      }
    },
    {
      "id": 94006,
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-78.75934, 35.74011]
      },
      "properties": {
        "obtime": "2012-02-20T19:13:00Z",
        "category": "Test",
        "description": "NULL",
        "description_id": 1
      }
    },
    {
      "id": 104884,
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-78.7593, 35.74018]
      },
      "properties": {
        "obtime": "2012-02-22T19:11:00Z",
        "category": "None",
        "description": "NULL",
        "description_id": 2}
      },
    {
      "id": 104939,
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [-78.75923, 35.74027]
      },
      "properties": {
        "obtime": "2012-02-22T19:06:31Z",
        "category": "Rain/Snow",
        "description": "Freezing Drizzle",
        "description_id": 6
      }
    },
Status Codes:
  • 201 Created – Created - submission was successful
  • 400 Bad Request – Bad Request - something is likely wrong with your json data (missing field, wrong format, etc)
  • 401 Unauthorized – Unauthorized - must supply an API Key with submission permissions
  • 403 Forbidden – Forbidden

Returns a GeoJSON encoded representation of all reports from the last 15 minutes and within 250km of the submitted report. This data is so apps can show the user how their report compares to others close by. There are use restrictions to these data. They are only to be displayed to the user who submitted the report.

Response JSON Object:
 
  • type (string) – GeoJSON’s “FeatureCollection”
  • features (array) – mPING reports within 15 minutes and 250km of the submitted report
Response JSON Array of Objects:
 
  • id (int) – the id of the report
  • type (string) – GeoJSON’s “Feature”
  • geometry (geometry) – provides the point location of the report in [lon, lat] format
  • properties (string) – properties of the point/report
  • obtime (datetime) – the date and time of the report in UTC/GMT
  • category (string) – the category of the report
  • description (string) – the description of the report
  • description_id (int) – the description id of the report