DLI REST-style API Reference
20240627T101433Z
REST architectural style introduction

REST exposes the manipulated objects as an hierarchical collection of resources. You may think of such collection as of a directory in a file system, an SNMP OID subtree, etc. Resources can be retrieved, modified, created and deleted; all of these operations are performed using standard HTTP methods, with well-defined semantics and behavior adjustable by standard HTTP headers.

HTTP verbs

In the REST architectural style, HTTP verbs are used to indicate what you want to do with the resource.

The following HTTP verbs are supported:

  • GET

    GET is used to retrieve representation of the resource.

  • HEAD

    HEAD is similar to GET, but returns only the headers for the resource.

  • POST

    POST is used to create a new element in the collection resource, or perform the function call.

  • PUT

    PUT is used to create or overwrite the resource.

  • PATCH

    PATCH is used to update the resource in place, possibly conditionally.

  • DELETE

    DELETE is used to delete the resource from its collection.

  • OPTIONS

    OPTIONS is used to preflight cross-origin requests (it's usually sent internally by browsers).

HTTP request headers

Request headers inform the server about what and how the client wants the server to return. Here are the more important ones:

  • Authorization

    Authorization contains access credentials; it's usually sent internally by clients.

  • Accept

    Accept indicates client's preferences in the content type of representation to be returned by the server.

  • Content-Type, Content-Length

    Content-Type and Content-Length in the request indicate the kind and size of payload the client sends to the server.

  • Range

    Range allows to select only a portion of the resource to be retrieved. We define a specific kind of range that limits tree nesting.

  • Prefer

Prefer allows to customize different aspects of server behaviour, e.g. whether the full representation of the resource should be returned, etc.

  • X-Requested-With

    An X-Requested-With: XMLHttpRequest header indicates that XMLHttpRequest has been used to issue the request (it's used for cross-site request forgery prevention).

Additionally, the following nonstandard headers are supported:

  • X-HTTP-Method

    X-HTTP-Method can be used to emulate a PUT/DELETE/PATCH request if the client doesn't support it (it is honored in POST requests only).

  • X-CSRF

    An X-CSRF header with any value can be used to mark legitimate requests (used for cross-site request forgery prevention).

Content types