Skip to content
drwelby edited this page Oct 12, 2012 · 6 revisions

Image Request API

The Image Request app provides a full API for image request management. Driven by Django-Tastypie, features can be requested, created, modified, or deleted through the appropriate request verbs GET, POST, UPDATE, DELETE.

The API also provides read-only access to a Test Area feature class, for testing the ability to create new image requests from the geometry of other features.

Endpoint

In the current URL scheme, the API can be accessed at:

/rfi/api/<featuretype>

So for image requests:

/rfi/api/rfi

And for test features:

/rfi/api/test

A GET request to the basic endpoint will return a JSON list of all features. Django-Tastypie also allows for pagination and filtering (docs).

To access a feature, refer to it by its primary key id, for example:

/rfi/api/rfi/24/

To receive the feature as JSON, append ?format=json:

/rfi/api/rfi/24/?format=json

To create or update a feature, POST or UPDATE the JSON payload describing the feature. The feature schema is as follows:

  • requestor_name (text, max length = 50, REQUIRED)
  • requestor_email (text)
  • requestor_phone (text, max length = 50)
  • org_choice (either 'ngo', 'io', 'academic', or 'government')
  • supported_operation (text)
  • supported_partners (text)
  • reason_for_use (text)
  • objective (text)
  • justification (text)
  • bounds (Polygon geometry in GeoJSON or WKT or a URL that returns a JSON feature with a polygon object in it. REQUIRED)
  • start_date (date and time)
  • end_date (date and time)
  • img_format (either 'nitf', 'sid', 'tif' or 'jpg')
  • delivery_format (either 'disk' or 'ftp')
  • need_by_date = (date and time)
  • priority (either 'high', 'routine', or 'low')
  • nextview_ack (boolean)

Example

Add a feature via curl:

curl --dump-header - -H "Content-Type: application/json" -X POST --data '{"bounds": {"coordinates": [[[30, 11], [30, 9], [31, 9], [31, 11], [30, 11]]], "type": "Polygon"}, "requestor_name": "Curl Request"}'  http://localhost:8000/rfi/api/rfi/
Clone this wiki locally