Templates and Attributes

Now you can extend our existing models with attributes that match your specific business logic.

Templates and Attributes are still in beta. Please use them with caution. Currently, Templates can only use the Product model, but we'll be releasing it for Resources, Users, Coupons, Orders, Payments, Subscriptions and Plans.

Template Object

Templates let you create the attributes you need for your specific use case. Create a Template of a Product and give it any attributes you need that aren't included in the existing, default Product Object list of attributes.

Attributes

Type

Description

name

string

The name of the template.

model

string

The model this template is going to use. Current choices:Product

attributes

array

Definitions of the attributes you want to add.

Attribute Definitions

Attributes

Type

Description

key

string

The name of the attribute.

kind

string

The type of attribute. Choices:string, url,email,int,float,boolean

human_id

string

Read only, human readable id for each attribute you create.

Create a Template

Body Parameters

Type

Description

name

string

The name of the template.

model

string

The model this template is going to use.

attributes

array

Definitions of the attributes you want to add.

While this feature is in beta, we only support 1 Template per model.

Update a Template*

Path Parameter

Type

Description

template_id

string

ID of the queried order.

Body Parameters

Type

Description

name

string

The name of the template.

model

string

Which model is going to use this template.

attributes

array

Definitions of the attributes you want to add.

There are some restrictions on updating the templates.

  • You can edit the name of the template.

  • You can add more attributes to the template.

  • You can not change the model of the template.

  • You can not remove attributes from the template.

  • You can not edit an attribute's key or kindin the template.

  • When updating a template, you need to send existing attributes with their human_id .

List all Templates

Query Parameters

Type

Description

size

number

Number of items to retrieve.

page

number

Which page to retrieve. Default is 10.

sort

string

Field used for sorting results. Default is created.

from_date

number

Start date, timestamp format. Default is current date minus 15 days.

to_date

number

End date, timestamp format. Default is current date plus 15 days.

date_filter

string

Date field used to filter results. Default is created.

Delete a Template

Path Parameter

Type

Description

template_id

string

ID of the queried order.

When you delete a template, all the related attributes will be deleted from all instances of that model.

How to use Attributes

This is very easy! You can add, update or remove attributes via your POSTor PUT request's body.

POST /products HTTP/1.1
Content-Type: application/json
Authorization: Bearer <service-account-key>
X-Builton-Api-Key: <builton-api-key>
Host: api.builton.dev

{
    "description": "It is a test product",
    "currency": "NOK",
    "price": 3.14,
    "name": "Product Name",
    "vat": 0.15,
    "external_reference": "123456abcd"

    "attributes": {
        "RAM_size": 6,
        "OS_version": "7.1.0",
        "dual_SIM": false
    }
}

Last updated