API

This guide provides instructions on how to use the API endpoints of Silverbucket using HTTP requests. The API allows you to perform CRUD (Create, Read, Update, Delete) operations on various resources within the application.

Base URL

Before making any API requests, you must know the base URL where the API is hosted. The base URL for our API is:
https://<your_environment>.agbucket.com/customer-api/1.0/


Authentication

Authentication is required to access most API endpoints. You must include an authentication token in the request headers. To obtain an authentication token, please refer to our authentication documentation.



Endpoints

[Resource Name] - /resource-name/

[Resource Name] represents the specific resource you want to interact with, such as "users," "projects," or "programs." Each resource has its set of endpoints for CRUD operations.


Create a New [Resource]

Endpoint: POST /resource-name/
To create a new [resource], send a POST request to the endpoint with the following JSON data:
{
"key1": "value1",
"key2": "value2",
...
}
To create a list of [resources], send a POST request to the endpoint with the following JSON data:

[
{
"key1": "value1",
"key2": "value2",
...
},
{
"key1": "value1",
"key2": "value2",
...
},
{
"key1": "value1",
"key2": "value2",
...
}
]


Retrieve [Resource] by ID

Endpoint: GET /resource-name/{id}/
To retrieve a specific [resource] by its unique ID, send a GET request to the endpoint, replacing {id} with the actual ID of the resource.


List All [Resources]

Endpoint: GET /resource-name/
To retrieve a list of all [resources], send a GET request to the endpoint. You can apply filters and pagination to limit the results.


Update [Resource] by ID

Endpoint: PUT /resource-name/{id}/
To update a specific [resource] by its ID, send a PUT request to the endpoint with the following JSON data:
{
"key1": "new-value1",
"key2": "new-value2",
...
}


Delete [Resource] by ID

Endpoint: DELETE /resource-name/{id}/
To delete a specific [resource] by its ID, send a DELETE request to the endpoint.


Bulk Update [Resources]

Endpoint: POST /resource-name/bulk-update/
To update multiple [resources] in bulk, send a POST request to the endpoint with a JSON array of objects representing the updates.
[
{
"id": 1,
"key1": "new-value1"
},
{
"id": 2,
"key1": "new-value2"
}
]



Response Format

All API responses are returned in JSON format and include relevant status codes and data. Successful responses typically have a status code of 200 OK or 201 Created, while errors are accompanied by appropriate status codes and error messages.
Here's a sample successful response:
{
"next": null, // Link to the next page of results (if applicable)
"previous": null, // Link to the previous page of results (if applicable)
"current": 1, // Current page number
"itemsPerPage": 500, // Number of items displayed per page
"count": 1, // Total number of items in the response
"lastPage": 1, // Last page number
"data": [ // List of data items
{
"id": 8,
"key1": "value1",
"key2": "value2",
}
],
"excelUrl": "/customer-api/1.0/users/?user.id=8&excel=true", // URL to export data in Excel format
"csvUrl": "/customer-api/1.0/users/?user.id=8&csv=true" // URL to export data in CSV format
}