API / Customers

With /customers/ endpoint you can read and manage customers' data in Silverbucket's database.



GET


When you call GET method of /customers/ endpoint without any parameters, you will get all the customers in Silverbucket's database. URL for this endpoint is:


https://<your_environment>/customer-api/1.0/customers/

Below is example response with one customer:
{
"count": 1,
"csvUrl": "/customer-api/1.0/customers/?csv=true",
"itemsPerPage": 500,
"excelUrl": "/customer-api/1.0/customers/?excel=true",
"next": null,
"current": 1,
"lastPage": 1,
"data": [
{
"id": 29,
"created": "2019-04-30T15:31:09.916556",
"modified": "2019-04-30T15:31:09.916578",
"creator": "Help Manual",
"creator_id": 5298,
"modifier": "Help Manual",
"modifier_id": 5298,
"name": "Silverbucket Oy",
"name_secondary": null,
"created_date": "2019-04-30T15:31:09.916606",
"street_address": "Hämeenkatu 26A",
"postal_code": "33200",
"city": "Tampere",
"country": "Finland",
"delivery_street_address": "Hämeenkatu 26A",
"delivery_postal_code": "33200",
"delivery_city": "Tampere",
"delivery_country": "Finland",
"businesscode": "2371301-1",
"active": true,
"show_in_crm": true,
"website": "https://www.silverbucket.com",
"payment_terms": null,
"code": "",
"description": null,
"lft": 1,
"rght": 2,
"tree_id": 35,
"level": 0,
"classification": null,
"parent": null,
"industries": [],
"labels": []
}
],
"previous": null
}



POST


You can add customers to Silverbucket's database with the same endpoint when fetching data with GET method. When you are adding customers, you have to add JSON formatted body the call. You have to have at least these fields in JSON:
{
"name": "<string>"
}

Below is complete listing of metadata fields which you can use when adding a customer:
{
"name": "<string>"
"street_address": "<string>",
"postal_code": "<string>",
"city": "<string>",
"country": "<string>",
"delivery_street_address": "<string>",
"delivery_postal_code": "<string>",
"delivery_city": "<string>",
"delivery_country": "<string>",
"businesscode": "<string>",
"active": <boolean: true|false>,
"website": "<string>",
"code": "<string>",
"description": "<string>"
}