Skip to end of metadata
Go to start of metadata
Table of Contents


General Patterns


  • Create record: POST /collection
  • Get all records: GET /collection
  • Get record: GET /collection/[id]
  • Update record: PUT /collection/[id]
  • Delete record: DELETE /collection/[id]
  • Search records: GET /collection?q=something&type=report
  • All records should return a link as part of the response. This will usually be an 'url' field
  • They will also return links for related records.
    • Related records will be returned as an object with both ID and URL
    • Related records can be submitted with just the ID or ID within the object.
Response Example

Response Codes

  • 200 OK
  • 404 Not found
  • 400 Bad Request - includes invalid json, or invalid attributes supplied
  • 405 Method not supported
  • 500 Server error
  • 401 Authentication Required


API tests are written in behat.
Each resources url / collection should test at least the following:

  • Create a record
  • Get all records
  • Get a record
  • Update a record
  • Delete a record
  • Search for a record
  • Failure conditions
    • Get non-existent record
    • Create a record with invalid data
    • Delete non-existent record

Possible extra tests

  • Test a record update which removing an attribute (if applicable)
  • Different formats (ie. geojson for posts)
  • No labels