The Snipe-IT JSON REST API allows you to perform most of the same actions through your own tools as you can through the web interface.
If you need the Swagger/OpenAPI Specification, you can find it here.
Try the API Explorer
In this documentation, whenever you see the API explorer with a button say thats "Try It", go ahead and try it! The API explorer live-queries a demo database attached to the development demo. You'll be able to add, edit, update and delete right from the API explorer.
Since the API Explorer talks to the live development database - and resets periodically - you CAN (and probably) will occasionally break some stuff as you're playing around.
If you'd like to be logged into the development demo at the same time as you play with the API Explorer to see your changes reflect through the Web UI, use the username admin
and the password password
.
This documentation (and the API itself) is still under development, so some things may not work exactly as expected, or we may not have code examples and sample responses for everything just yet. Please be patient. As we continue to develop the API, we are updating the documentation.
Philosophy
Our philosophy on HTTP status codes is that as long as the pipe (the http request itself) is sound, the API should return a 200 OK
status code. We realize that some very smart people have a very different philosophy, but in general we want the HTTP status code to describe the state of the resource endpoint, with the actual status of the transaction returned in the JSON payload.
For example, if you made a valid HTTP request to retrieve an asset that doesn't exist, we'll return a 200 OK, with the following payload:
{
"status": "error",
"messages": "Asset does not exist."
}
Likewise, if you try to update a resource, but you don't provide all of the required information, we'll respond with validation errors in the messages
section of the response:
{
"status": "error",
"messages": {
"model_id": [
"The selected model id is invalid."
],
"status_id": [
"The selected status id is invalid."
]
}
}
Escaping
The results of the API will automatically be escaped to prevent XSS attacks. If you're consuming the API output, you'll want to unescape the results.