With our SDKs

Unauthenticated requests

Some resources do not require an authenticated request to be accessible, which means you can access them solely with a BuiltOn API Key.

If you were to list products, here is how you could do it:

Core SDK
Node SDK
Python SDK
HTTP
Core SDK
const BuiltOn = require('@builton.dev/core-sdk');
const builton = new BuiltOn({
apiKey: '<builton-api-key>'
});
builton.products.get({ size: 5 }).then((page) => {
const firstProduct = page.current[0];
console.log(firstProduct);
});
Node SDK
// The Node SDK, although similar to the Core SDK, is intended for server-to-server communication.
const BuiltOn = require('@builton.dev/node-sdk');
const builton = new BuiltOn({
apiKey: '<builton-api-key>'
});
builton.products.get({ size: 5 }).then((page) => {
const firstProduct = page.current[0];
console.log(firstProduct);
});
Python SDK
# The Python is intended for server-to-server communication.
from builton_sdk import Builton
builton = Builton(api_key="<builton-api-key>")
builton.product().get_all(size=5)
HTTP
GET /products HTTP/1.1
Content-Type: application/json
X-Builton-Api-Key: <builton-api-key>
Host: api.builton.dev

For more information about the pagination, please visit the Pagination page.

Authenticated requests

Most resources require an authenticated user to be accessible. This is the case of order for example.

To authenticate a user, do the following:

Core SDK
HTTP
Core SDK
const BuiltOn = require('@builton.dev/core-sdk');
const builton = new BuiltOn({
bearerToken: '<jwt>',
apiKey: '<builton-api-key>'
});
const userData = {
first_name: 'foo',
last_name: 'bar',
email: 'foo@bar.com'
};
builton.users.authenticate(userData).then((user) => {
console.log(user);
});
HTTP
POST /users HTTP/1.1
Content-Type: application/json
Authorization: Bearer <jwt>
X-Builton-Api-Key: <builton-api-key>
Host: api.builton.dev
{
"first_name": "foo",
"last_name": "bar",
"email": "foo@bar.com",
}

For more information about the service accounts, please visit the Service account page.