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.

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

User Role

Create a new Resource*

Parameters
Request
Response

Body Parameters

Type

Description

name

string

Name of the resource item.

product

string

Product ID to be associated with the resource.

description

string

Description of the resource item.

status

string

Status of the resource _default is CREATED other options are PROCESSING, UTILIZED, IDLE

image_url

string

Image URL associated with the resource.

reference_id

string

Customizable ID for the resource

POST /resources HTTP/1.1
Content-Type: application/json
Authorization: Bearer <service-account-key>
X-Builton-Api-Key: <builton-api-key>
Host: api.builton.dev
{
"product": "58f9f856b70e2a56c4a0db3d",
"description": "description of the resource",
"name": "name of resource",
"image_url": "http://reference.kvass.ai/images/logo.png",
"reference_id": "abc1234567890abc"
}
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",
"reference_id": "abc1234567890abc",
"image_url": "http://reference.kvass.ai/images/logo.png",
"name": "name of resource",
"product": {"$oid": "58f9f856b70e2a56c4a0db3d"},
"status": "CREATED",
"human_id" "1EBY8A",
"deleted": false,
"created": {"$date": 1500275774067},
"company": {"$oid": "57ee9c71d76d431f8511142f"}
}

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.

user

string

User ID to be associated with a user.

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"}
}
]

Admin Role

*Paths listed above and denoted with a star are accessible to both Users and Admins. Additional Admin Role paths are listed below.

Create a new Resource

Parameters
Request
Response

Body Parameters

Type

Description

name

string

Name of the resource item.

product

string

Product ID to be associated with the resource.

user

string

User ID to be associated with a User.

description

string

Description of the resource item.

status

string

Status of the resource _default is CREATED other options are PROCESSING, UTILIZED, IDLE

image_url

string

Image URL associated with the resource.

reference_id

string

Customizable ID for the resource

POST /resources HTTP/1.1
Content-Type: application/json
Authorization: Bearer <service-account-key>
X-Builton-Api-Key: <builton-api-key>
Host: api.builton.dev
{
"product": "58f9f856b70e2a56c4a0db3d",
"description": "description of the resource",
"name": "name of resource",
"image_url": "http://reference.kvass.ai/images/logo.png",
"reference_id": "abc1234567890abc"
}
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",
"reference_id": "abc1234567890abc",
"image_url": "http://reference.kvass.ai/images/logo.png",
"name": "name of resource",
"product": {"$oid": "58f9f856b70e2a56c4a0db3d"},
"status": "CREATED",
"human_id" "1EBY8A",
"deleted": false,
"created": {"$date": 1500275774067},
"company": {"$oid": "57ee9c71d76d431f8511142f"}
}

Create new Resources in Bulk

Parameters
Request
Response

Body Parameters

Type

Description

name

string

Name of the resource item.

description

string

Description of the resource item.

user

string

User ID to be associated with a User.

status

string

Status of the resource _default is CREATED other options are PROCESSING, UTILIZED, 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.

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

Delete a Resource

Parameters
Request
Response

Path Parameters

Type

Description

<resource_id>

string

ID of the resource to be deleted.

DELETE /resources/596c643ed57ba203be2cf1c9 HTTP/1.1
Content-Type: application/json
Authorization: Bearer <service-account-key>
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",
"name": "Resource 2",
"product": {"$oid": "58f9f856b70e2a56c4a0db3d"},
"reference_id": "abc1234567890abc",
"status": "IDLE",
"company": {"$oid": "57ee9c71d76d431f8511142f"},
"_id": {"$oid": "596c643ed57ba203be2cf1c9"},
"updated": {"$date": 1500278314163},
"user": {"$oid": "57ee9c72d76d431f85111432"}
}