Resources

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.

Asset Resource Object

Attribute

Type

Description

method

string

The resource type. asset or retail.

user

object

User associated with the resource.

name

string

Name of the resource item.

description

string

Description of the resource item.

image_url

string

Image associated with the resource.

reference_id

string

Reference ID associated with the resource.

product

object

Product associated with the resource.

tags

array

An array of tags.

human_id

string

6 character ID.

status

string

Status of the resource. Default is CREATED, other options are listed below.

Retail Resource Object

In addition to the attributes in the asset resource, the retailresource has the following attributes.

Attribute

Type

Description

_sub_products

array

An array with sub-products associated with the resource.

base_price

number

The sum of the product.price and price in all the _sub_products.

retail_price

number

The amount that this resource is sold for.

currency

string

The currency in the main product in the resource.

vat

number

The VAT from the main product in the resource. A decimal value between 0 and 1, e.g. 0.25 = 25%.

Resource Status

Default status for the resource is CREATED. Change the status by updating the resource.

Status

CREATED

PROCESSING

UTILIZED

IDLE

ON_THE_WAY_FROM

ON_THE_WAY_TO

DONE

Update a Resource

Parameters
Request
Response

Path Parameter

Type

Description

resource_id

string

The resource’s ID

Body Parameters

Type

Description

name

string

Name of the resource item.

description

string

Description of the resource item.

status

string

Status of the resource. Default is CREATED; other options are PROCESSING, UTILIZED or IDLE.

product

string

Product ID to be associated with the resource.

image_url

string

Image url associated with the resource.

reference_id

string

Customizable ID for the resource.

PUT /resources/596c643ed57ba203be2cf1c9 HTTP/1.1
Content-Type: application/json
Authorization: Bearer <jwt>
X-Builton-Api-Key: <builton-api-key>
Host: api.builton.dev
{
"name": "Resource 2",
"description": "An updated Resource",
"status": "IDLE"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"updated": {"$date": 1500276434527},
"method" "asset",
"_id": {"$oid": "596c643ed57ba203be2cf1c9"},
"user": {"$oid": "57ee9c72d76d431f85111432"},
"description": "An updated Resource",
"image_url": "http://reference.kvass.ai/images/logo.png",
"reference_id": "abc1234567890abc",
"name": "Resource 2",
"product": {"$oid": "58f9f856b70e2a56c4a0db3d"},
"status": "IDLE",
"deleted": false,
"created": {"$date": 1500275774067},
"company": {"$oid": "57ee9c71d76d431f8511142f"}
}

Retrieve a Resource by ID

Parameters
Request
Response

Path Parameter

Type

Description

resource_id

string

The resource’s ID.

GET /resources/<resource_id> HTTP/1.1
Content-Type: application/json
Authorization: Bearer <jwt>
X-Builton-Api-Key: <builton-api-key>
Host: api.builton.dev
HTTP/1.1 200 OK
Content-Type: application/json
{
"updated": {"$date": 1500275774067},
"_id": {"$oid": "596c643ed57ba203be2cf1c9"},
"method" "asset",
"user": {"$oid": "57ee9c72d76d431f85111432"},
"description": "description of the resource",
"image_url": "http://reference.kvass.ai/images/logo.png",
"reference_id": "abc1234567890abc",
"name": "name of resource",
"product": {"$oid": "58f9f856b70e2a56c4a0db3d"},
"status": "CREATED",
"deleted": false,
"created": {"$date": 1500275774067},
"company": {"$oid": "57ee9c71d76d431f8511142f"}
}

List All Resources

Parameters
Request
Response

Query Parameters

Type

Description

include_deleted

boolean

If true, the request also returns deleted resources.

size

number

Number of resources per page. Default is 10.

page

number

Defines which page to retrieve. Default is 0.

from_date

number

Start date, timestamp format. Default is None.

to_date

number

End date, timestamp format. Default is None.

sort

string

Field used to sort results. Default is -created.

status

string

Status of the resource. Default is CREATED; other options are PROCESSING, UTILIZED or IDLE

GET /resources HTTP/1.1
Content-Type: application/json
Authorization: Bearer <jwt>
X-Builton-Api-Key: <builton-api-key>
Host: api.builton.dev
HTTP/1.1 200 OK
Content-Type: application/json
{
"updated": {"$date": 1500275774067},
"_id": {"$oid": "596c643ed57ba203be2cf1c9"},
"method" "asset",
"user": {"$oid": "57ee9c72d76d431f85111432"},
"description": "description of the resource",
"image_url": "http://reference.kvass.ai/images/logo.png",
"reference_id": "abc1234567890abc",
"name": "name of resource",
"product": {"$oid": "58f9f856b70e2a56c4a0db3d"},
"status": "CREATED",
"deleted": false,
"created": {"$date": 1500275774067},
"company": {"$oid": "57ee9c71d76d431f8511142f"}
}

Search Resources by Keywords

Search by _id, name, reference_id, description and image_url. Returns an array that matches the query. Filter the query by using pagination.

Parameters
Request
Response

Query Parameters

Type

Description

query

string

Partial or full string of name, reference_id, description or image_url.

include_deleted

boolean

If true, the request also returns deleted resources.

size

number

Number of resources per page. Default is 10.

page

number

Defines which page to retrieve. Default is 0.

from_date

number

Start date, timestamp format. Default is None.

to_date

number

End date, timestamp format. Default is None.

sort

string

Field used to sort results. Default is created.

GET /resources/search?query=updated HTTP/1.1
Content-Type: application/json
Authorization: Bearer <jwt>
X-Builton-Api-Key: <builton-api-key>
Host: api.builton.dev
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"created": {"$date": 1500275774067},
"method" "asset",
"deleted": true,
"description": "An updated Resource",
"image_url": "http://reference.kvass.ai/images/logo.png",
"reference_id": "abc1234567890abc",
"name": "Resource 2",
"product": {"$oid": "58f9f856b70e2a56c4a0db3d"},
"status": "IDLE",
"company": {"$oid": "57ee9c71d76d431f8511142f"},
"_id": {"$oid": "596c643ed57ba203be2cf1c9"},
"updated": {"$date": 1500278314163},
"user": {"$oid": "57ee9c72d76d431f85111432"}
}
]