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. .. http:post:: /mping/api/v2/reports Submit an mPING Report **Example request** .. sourcecode:: http 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] } } :reqheader Content-Type: required format of *"application/json"* :reqheader Authorization: Token Your_API_Key - must provide your api key for authorization :reqjson int description_id: 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. :reqjson datetime obtime: the UTC obtime of the report in format $YYYY-$mm-$ddT$HH:$MM:$SSZ :reqjson geometry geom: the longitude and latitude of the report in a geojson style format. *Note: longitude is listed first.* **Example response** .. sourcecode:: http 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 } }, :statuscode 201: Created - submission was successful :statuscode 400: Bad Request - something is likely wrong with your json data (missing field, wrong format, etc) :statuscode 401: Unauthorized - must supply an API Key with submission permissions :statuscode 403: 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. :resjson string type: GeoJSON's "FeatureCollection" :resjson array features: mPING reports within 15 minutes and 250km of the submitted report :>jsonarr int id: the id of the report :>jsonarr string type: GeoJSON's "Feature" :>jsonarr geometry geometry: provides the point location of the report in [lon, lat] format :>jsonarr string properties: properties of the point/report :>jsonarr datetime obtime: the date and time of the report in UTC/GMT :>jsonarr string category: the category of the report :>jsonarr string description: the description of the report :>jsonarr int description_id: the description id of the report