You are a developer who has been given an Exowpee account, and you want a first successful call. This page takes you through them: sign in, select a company, read, write. To run the application on your own machine instead, see Your first API call. The API lives at https://api.exowpee.com/v1. Requests and responses are JSON.

Before you start

You need an account that can sign in. A member signs up with Check an email address and then Sign up with a company, and must verify the email address before signing in. The address must be real: its domain is checked, so an address such as name@example.com is refused. See Sign up and sign in.

1. Sign in

Sign in is POST /v1/auth/{type}/login. The type is one of user, agent, client, client_agent, organization or organization_agent. A member who works in a company signs in as user.
username is the email address for members. It must be an email address, or 3 to 100 letters, digits, _, . or -, and it is lower-cased. An agent account also sends the company_id it belongs to (client_id for client_agent, organization_id for organization_agent); for the other types these fields are refused. The route allows 5 attempts per minute. The answer carries the token:
expires_in is the life of the token in seconds: 7 days unless your installation sets otherwise. Send the token on every following call:
Each space (company, organization, client) has its own session. Signing in again as the same account in the same space ends the previous session of that account there. Sign in lists the other refusals. To see who is signed in, call View my account.

2. Select a company

A member’s token has no company or profile selected yet. With it, only a few routes answer, such as View my account; the others, including the list below, answer 403 with “Select a profile before using this workspace.” The sign-in answer lists the member’s active profile assignments in user.user_profiles. Pick the assignment of the company you want to work in (right after sign-up there is only one) and send its id to Switch company profile:
The answer has the same shape as sign-in. Its auth.access_token replaces the previous token, which stops working. An agent account skips this step: its token already carries its company and profile.

3. Read a list

List categories needs the categories.list permission.
Lists use cursor pagination. The answer has this shape:
Pass meta.next_cursor as cursor to get the next page. The list parameters are per_page, cursor, sort_by and sort_order (asc or desc). per_page is held between 1 and 1000. On the actions that have been migrated, ?fields=id,title keeps only the listed keys, and ?include= adds related objects. Both go in the query string.

4. Write

Create a category needs the categories.create permission, a title and a sort_order.
On the migrated actions, a POST, PUT or PATCH answers 204 with no content. Add ?response=resource to get the created object back, with status 201:
A DELETE always answers 204. Actions that have not been migrated answer as their reference page says.

Money

Exowpee stores every amount as an integer in minor units (the smallest unit of the currency), with a currency_code and a currency_exponent. In the API, the format depends on the action. Sales, prices and purchases send and return amounts in the main unit of the currency, with no more decimals than currency_exponent (for example unit_price on an order). Accounting actions send and return integers in minor units (for example amount on a journal line). Each reference page gives the format of its fields. XOF has an exponent of 0, so 200,000 FCFA is 200000 in both formats.

Errors

Wrong credentials, an expired, missing or replaced token, and a token of another kind of account than the route accepts are also answered with 401, in the standard Laravel body (message). Other errors, such as a missing resource, follow the framework’s standard answers.

Where next