Introduction
Learn how to integrate our APIs into your application.
API Basics
Before you begin!
You should create a Bunce account that you can test the API against. We will provide you with secret key that you can use to interact with our APIs.
The Bunce API lets you interact with data and resources through REST. The API accepts requests in JSON format, returns responses in JSON, and uses standard HTTP response codes, authentication, methods and verbs.
You can use the Bunce API in test mode, which doesn’t affect your live data. The API key you use to authenticate the request determines whether the request is live mode or test mode.
Requests and Response
When making requests, specify application/json
as your Content-Type. For example:
curl -X POST https://sandbox.api.bunce.so/v1/customers
-H "X-Authorization: sk_test_re4e69088ww423f8f1e2d"
-H "Content-Type: application/json"
-d "{ "first_name": "John", "last_name": "Doe", "email": "johndoe@example.com" }"
Both request body data and response data are formatted as JSON. Content type for responses will always be application/json
. Generally, all responses will be in the following format:
Keys
{
"success": "boolean",
"message": "string",
"data": "object"
}
- success
boolean
: This lets you know if your request was successful or not. We recommend that you use this in combination with HTTP status codes to determine the result of an API call. - message
string
: This is a summary of the response and its status. For instance when trying to retrieve a list of customers, message might read “Customers fetched successfully”. In the event of an error, the message key will contain a description of the error. This is the only key that is universal across requests. - data
object
: This contain the results of your request. It can either be an object, or an array depending on the request made. For instance, a request to retrieve get a customer will return a customer object in the data key, while the key would be an array of customers if a list is requested instead.
Meta Object
"meta": {
"per_page": "number",
"total": "number",
"total_pages": "number",
}
The meta key is used to provide context for the contents of the data key. For example, list customers. These list API methods share a common structure and accept, at a minimum, the following three parameters: per_page
, page
, and query
. The meta key will then contain an object with the following attributes:
Keys
total: number
: This is the total number of records.per_page: number
: This is the maximum number of records that will be returned per request. This can be modified by passing a new value as a `per_page` query parameter.Default: 20
page: number
: This is the current page being returned. This is dependent on what page was requested using the page query parameter.Default: 1
total_pages: number
: This is how many pages in total are available for retrieval considering the maximum records per page specified.