Getting started
Consuming the API
How to get consume the API
Install the api client package
In order to ease the integration of the API, we have created a client package for you.
After installing the package, you could set it up the following way:
Steps
Create your types
The next step is to create some types in types.ts also located in the lib folder. We start by importing a base interface from the package
it contains the following attributes:
| Name | Type | Description |
|---|---|---|
| id | string | This is a UUID unique to each row |
| folio | number | The order number given to the row upon creation |
| createdAt | string | When the row was created |
| updatedAt | string | When the row was last updated |
| publishedAt | string | When the row was published |
| deletedAt | string | When the row was deleted |
We create our types/interfaces by extending IBaseObject and adding the types we created in our space
Create your services
Once a client is created and the your types are defined, you could write your service functions in a separate file. We have chosen to create a file called services.ts in the lib folder
Now any service functions can be awaited in your server components