API - Requests

Request Methods

GET

The GET method means retrieve information from the resource that is identified by the Request-URI. If the Request-URI refers to a data-processing resource (like the search-resource), it is the produced data that is returned as the entity.

POST

PUT

DELETE

Request Headers

Accept

The Accept request-header field can be used to specify certain media types which are acceptable for the response. omdb respects the Accept values of 'text/html' and 'application/xml' (or 'text/xml'). The value 'text/javascript' is reserved for the omdb web interface. omdb might publicly support the 'text/javascript' (json) in the future.

You can emulate the request-header value via file-extensions. A file extension '.xml' will be interpreted as a 'application/xml' request-header, regardless of request-headers sent. The value 'text/html' will always have priority when sent with other headers. So a request-header value 'application/xml, text/html' will result in a 'text/html' response, even though 'application/xml' is the first acceptable media type.

Some routes might accept requests for other media types like 'text/comma-separated-values', 'image/png' or 'application/pdf'. The routes will list all additional acceptable media types.

 Example for Accept request-header emulation

 http://www.omdb.org/search?query=James%20Bond - auto negotiate media types
 http://www.omdb.org/search.xml?query=James%20Bond - Accept request-header explicitly set to 'application/xml'
 http://www.omdb.org/search.html?query=James%20Bond - Accept request-header explicitly set to 'text/html'

Accept-Language

The Accept-Language request-header field is similar to Accept, but restricts the set of natural languages that are preferred as a response to the request. omdb supports german (de) and english (en), all other language request-headers will be ignored. If no language can be negotiated, english will be used. omdb will support other languages in the future.

You can emulate the request-header value via filename-suffix. A file suffix '.{language}' will automatically be interpreted as the appropriate language, the request-header value will be ignored. The file-suffix to emulate a language must be used in combination with a file extension (see Accept). The usage of a file-suffix without a file-extension is undefined and might result in 400 Bad Request response.

 Example for a Accept-Language request-header emulation

 http://www.omdb.org/movie/123 - auto negotiate language
 http://www.omdb.org/movie/123.xml.en - explicitly set language to english and media type to 'application/xml'
 http://www.omdb.org/movie/123.html.de - explicitly set language to german and media type to 'text/html' 

Sources