The API attempts to be as RESTful as possible by using appropriate HTTP Verbs for each action, such as:
Verb | Description |
---|---|
OPTIONS | Used to retrieve the available HTTP verbs, name, description, input format (parsers) and output format (renderers) for a particular resource. |
GET | Used for retrieving resources. |
PUT | Used for replacing resources or collections. |
POST | Used for creating resources. |
PATCH | Used for partially updating an existing resource with one or more changes. For example, changing the description on a repository resource is a PATCH. |
DELETE | Used to delete specific resources. |
As described above, the OPTIONS request will show the available HTTP verbs for a resource, in addition to some details about the resource itself. Let's see it in action:
curl -i -X OPTIONS https://api.cloudsmith.io/user/self/
HTTP/1.0 200 OK
Allow: GET, OPTIONS
Content-Type: application/json
Date: Sun, 29 Jan 2017 18:02:54 GMT
{
"name": "User Who Am I",
"description": "View for showing the current user details.",
"renders": ["application/json"],
"parses": ["application/json"]
}