We break a Resource into two concepts; a resource as a reusable asset
and a retail
resource that is meant to be sold.
If not specified, an asset
resource is created.
Changes since API version2019-02-01
image
changed to Image
Object.
We are deprecating the old image_url
and replacing it with Image
Object.
Attribute | Type | Description |
|
| The resource type. |
|
| ​ |
|
| Name of the resource item. |
|
| Description of the resource item. |
|
| ​ |
|
| ​ |
|
| An array of tags. |
|
| 6 character ID. |
|
| Status of the resource. Default is |
In addition to the attributes in the asset
resource, the retail
resource has the following attributes.
Attribute | Type | Description |
|
| An array with sub-products associated with the resource. |
|
| The sum of the |
|
| The amount that this resource is sold for. |
|
| The currency in the main product in the resource. |
|
| The VAT from the main product in the resource. A decimal value between 0 and 1, e.g. 0.25 = 25%. |
Default status for the resource is CREATED
. Change the status by updating the resource.
Status |
|
|
|
|
|
|
|
Body Parameters | Type | Description |
|
| Name of the resource item. |
|
| Product ID to be associated with the resource. |
|
| Description of the resource item. |
|
| Status of the resource, default is |
|
|
|
|
| Customizable ID for the resource |
Request --POST /resources HTTP/1.1Content-Type: application/jsonAuthorization: Bearer <service-account-key>X-Builton-Api-Key: <builton-api-key>Host: api.builton.dev​{"name": "Electric Scooter W3E7IB","description": "Rent this electric scooter"}
Response --HTTP/1.1 200 OKContent-Type: application/json​{"_id": {"$oid": "596c643ed57ba203be2cf1c9"},"method" "asset","name": "Electric Scooter W3E7IB","description": "Rent this electric scooter",[...]}
builton.resources.create({name: 'Electric Scooter W3E7IB',description: 'Rent this electric scooter',}).then(console.log);​/*Resource {id: '596c643ed57ba203be2cf1c9',method: 'asset',name: 'Electric Scooter W3E7IB',description: 'Rent this electric scooter',[...]}*/
Path Parameter | Type | Description |
|
| The resource’s ID |
Body Parameters | Type | Description |
|
| Name of the resource item. |
|
| Description of the resource item. |
|
|
|
|
| Status of the resource. Default is |
|
| ​ |
|
|
|
|
| Customizable ID for the resource. |
Request --PUT /resources/596c643ed57ba203be2cf1c9 HTTP/1.1Content-Type: application/jsonAuthorization: Bearer <jwt>X-Builton-Api-Key: <builton-api-key>Host: api.builton.dev​{"name": "Electric Scooter Q2EW6UV",}
Response --HTTP/1.1 200 OKContent-Type: application/json​{"_id": {"$oid": "596c643ed57ba203be2cf1c9"},"method" "asset","name": "Electric Scooter Q2EW6UV","description": "Rent this electric scooter",[...]}
builton.resources.update('596c643ed57ba203be2cf1c9', {name: 'Electric Scooter Q2EW6UV',}).then(console.log);​/*Resource {id: '596c643ed57ba203be2cf1c9',method: 'asset',name: 'Electric Scooter Q2EW6UV',description: 'Rent this electric scooter',[...]}*/
Path Parameter | Type | Description |
|
| The resource’s ID. |
Request --GET /resources/596c643ed57ba203be2cf1c9 HTTP/1.1Content-Type: application/jsonAuthorization: Bearer <jwt>X-Builton-Api-Key: <builton-api-key>Host: api.builton.dev
Response --HTTP/1.1 200 OKContent-Type: application/json​{"_id": {"$oid": "596c643ed57ba203be2cf1c9"},"method" "asset","name": "Electric Scooter Q2EW6UV","description": "Rent this electric scooter","product": {"$oid": "58f9f856b70e2a56c4a0db3d"},"image": {"$oid": "596c643ed57ba203be2cf2c9"},[...]}
builton.resources.get('596c643ed57ba203be2cf1c9').then(console.log);​/*Resource {id: '596c643ed57ba203be2cf1c9',method: 'asset',name: 'Electric Scooter Q2EW6UV',description: 'Rent this electric scooter',[...]}*/
Query Parameters | Type | Description |
|
| If |
|
| Number of resources per page. Default is 10. |
|
| Defines which page to retrieve. Default is 0. |
|
| Start date, |
|
| End date, |
|
| Field used to sort results. Default is |
|
| Status of the resource. Default is |
Request --GET /resources HTTP/1.1Content-Type: application/jsonAuthorization: Bearer <jwt>X-Builton-Api-Key: <builton-api-key>Host: api.builton.dev
Response --HTTP/1.1 200 OKContent-Type: application/json​[{"_id": {"$oid": "596c643ed57ba203be2cf1c9"},"method" "asset","name": "Electric Scooter Q2EW6UV","description": "Rent this electric scooter","product": {"$oid": "58f9f856b70e2a56c4a0db3d"},"image": {"$oid": "596c643ed57ba203be2cf2c9"},[...]},[...]]
builton.resources.get().then(page => {console.log(page.current); // First page});​/*[Resource {id: '596c643ed57ba203be2cf1c9',method: 'asset',name: 'Electric Scooter Q2EW6UV',description: 'Rent this electric scooter',[...]},[...]]*/
Search by _id
, name
, reference_id
, description
and image_url
. Returns an array
that matches the query. Filter the query by using pagination.
Query Parameters | Type | Description |
|
| Partial or full string of |
|
| If |
|
| Number of resources per page. Default is 10. |
|
| Defines which page to retrieve. Default is 0. |
|
| Start date, |
|
| End date, |
|
| Field used to sort results. Default is |
Request --GET /resources/search?query=electric HTTP/1.1Content-Type: application/jsonAuthorization: Bearer <jwt>X-Builton-Api-Key: <builton-api-key>Host: api.builton.dev
Response --HTTP/1.1 200 OKContent-Type: application/json​[{"_id": {"$oid": "596c643ed57ba203be2cf1c9"},"method" "asset","name": "Electric Scooter Q2EW6UV","description": "Rent this electric scooter","product": {"$oid": "58f9f856b70e2a56c4a0db3d"},"image": {"$oid": "596c643ed57ba203be2cf2c9"},[...]},[...]]
builton.resources.get().then(page => {console.log(page.current); // First page});​/*[Resource {id: '596c643ed57ba203be2cf1c9',method: 'asset',name: 'Electric Scooter Q2EW6UV',description: 'Rent this electric scooter',[...]},[...]]*/
*Paths listed above and denoted with a star are accessible to both Users and Admins. Additional Admin Role paths are listed below.
Body Parameters | Type | Description |
|
| Name of the resource item. |
|
| Description of the resource item. |
|
|
|
|
| Status of the resource _default is |
|
| Product ID to be associated with the resource. |
|
|
|
|
| Customizable ID for the resource. |
Request --POST /resources/bulk HTTP/1.1Content-Type: application/jsonAuthorization: Bearer <service-account-key>X-Builton-Api-Key: <builton-api-key>Host: api.builton.dev​[{"product": "58f9f856b70e2a56c4a0db3d","method": "asset","name": "First resource"},{"product": "58f9f856b70e2a56c4a0db3d","method": "asset","name": "Second resource"}]
Response --HTTP/1.1 200 OKContent-Type: application/json​[{"_id": {"$oid": "596c643ed57ba203be2cf1c9"},"product": "58f9f856b70e2a56c4a0db3d","method" "asset","name": "First resource",[...]},{"_id": {"$oid": "57ee9c71d76d431f8511142f"},"product": "58f9f856b70e2a56c4a0db3d","method" "asset","name": "Second resource",[...]}]
Path Parameters | Type | Description |
|
| ID of the resource to be deleted. |
Request --DELETE /resources/596c643ed57ba203be2cf1c9 HTTP/1.1Content-Type: application/jsonAuthorization: Bearer <service-account-key>X-Builton-Api-Key: <builton-api-key>Host: api.builton.dev
Response --HTTP/1.1 200 OKContent-Type: application/json​{"_id": {"$oid": "596c643ed57ba203be2cf1c9"},"method" "asset","name": "Electric Scooter W3E7IB","description": "Rent this electric scooter","deleted": true,}
builton.resources.del('5e5e7580a66b2a00089308b5').then(console.log);​/*Resource {id: '596c643ed57ba203be2cf1c9',method: 'asset',name: 'Electric Scooter Q2EW6UV',description: 'Rent this electric scooter',delete: true}*/