Requests & Response Codes

Requests

All requests should supply the Accept: application/vnd.assignr.v2.hal+json header. POST requests must specify the Content-Type: application/vnd.assignr.v2.hal+json header. Request and response bodies are JSON encoded.

Requests must be made over HTTPS. Any non-secure requests are met with a redirect (HTTP 302) to the HTTPS equivalent URI.

Response Codes

When you make a request through the assignr.com API, the server will return a response code that indicates whether your request was successful or not. Here are the response codes that we use in our API:

200 OK

Indicates that your request was successful.

201 Created

Indicates that a new resource has been created successfully with a POST command.

204 No Content

Indicates that a new resource has been created successfully with a POST command, or successfully deleted with a DELETE command.

400 Bad Request

The request uses incorrect syntax. Most often, this is caused by invalid JSON data.

401 Unauthorized

Valid login credentials are required, or the credentials you provided are not correct.

402 Payment Required

The request is attempting to access information from a site that does not have an active subscription.

403 Forbidden

You have provided valid credentials but you don’t have permission to view the resource you have requested.

404 Not Found

Couldn’t find the resource you requested.

409 Conflict

Assignr uses optimistic locking for some data, which allows multiple users to view the same record for edits, but prevents two users from updating the record simultaneously. Optimistic locking compares the lock_version field that you provide against the record in the database before saving. If the lock_version attributes are equal, the resource has not been changed, and the update can proceed. Otherwise the transaction is cancelled and a 409 error is thrown. Only valid for PUT requests that update existing data, and that also include the lock_version attribute where applicable.

422 Unprocessable Entity

The request was well-formed but was unable to be followed due to semantic errors. Typically this means that your request failed one or more validation checks, for example, creating a game without a date or time, or creating a new user without a first and last name. Only valid for PUT, POST, or DELETE requests.

429 Too Many Requests

The request exceeded the rate limits imposed by assignr.com. The X-Ratelimit-Reset and X-Ratelimit-Reset-Seconds-Remaining headers in this response will indicate when a request can be retried. See the Rate Limits section above for more information on other rate limit response headers provided by assignr.com.

500 Error

This indicates that an unexpected server error occurred.

503 Service Unavailable

Indicates that we are temporarily unable to respond to your request. Please wait for a bit and try again.