Lectronz API Reference

Version 1

The Lectronz API enables store owners to manage their orders and products through a JSON REST API.

WARNING: This API reference description is work in progress and is not guaranteed to be complete or accurate yet.

Introduction

All API calls must be authenticated with a API key, through "bearer authentication", by passing the following header in the request:

Authorization: Bearer {API_KEY}

So for example if the API KEY is l4PI3mLGW451UQMavfy3UVPd, then the following curl request would retrieve order number 3021:

curl -H "Authorization: Bearer l4PI3mLGW451UQMavfy3UVPd" \
     https://lectronz.com/api/v1/orders/3201

For API calls that expect as input a JSON object, it is also necessary to add the header `Content-Type: application/json`.

For example, the following curl request could be used to mark order 3021 as fulfilled:

curl -X PATCH -H "Authorization: Bearer l4PI3mLGW451UQMavfy3UVPd" \
     -H "Content-Type: application/json" \
     https://lectronz.com/api/v1/orders/3201

Going through collections of objects

Some API calls return a list of objects. For example, there is an API call that retrieves a list of orders. However, the API does not return all the objects at once, but limits the number of objects returned to 20 by default. To retrieve more objects, you can use the `offset` parameter, which is available for all API calls that return a list of objects.

This notably applies to the API calls that retrieve a list of orders.

The API that allows you to retrieve a list of orders limits the number of orders returned to 20 by default. To retrieve more orders, you can use the `offset` parameter, which is available for all API calls that return a list of objects. For example, to retrieve the orders 20 to 39, you would use the following curl request:

curl -H "Authorization: Bearer l4PI3mLGW451UQMavfy3UVPd" \
     https://lectronz.com/api/v1/orders?offset=20

Additionally, you can use the `limit` parameter to change the number of orders returned. For example, to retrieve 50 orders instead of the default 20, you would use the following curl request:

curl -H "Authorization: Bearer l4PI3mLGW451UQMavfy3UVPd" \
     https://lectronz.com/api/v1/orders?limit=50

The `offset` and `limit` parameters can be used together. For example, to retrieve the orders 30 to 79, you would use the following curl request:

curl -H "Authorization: Bearer l4PI3mLGW451UQMavfy3UVPd" \
     https://lectronz.com/api/v1/orders?limit=50&offset=30

The maximum value for the `limit` parameter is 150. We recommend using a limit of 50 or less, as larger limits may cause the API to take longer to respond.

Using the default limit of 20 is even better.