NAV
shell

Introduction

Welcome to the CheckMaxx Account API !

You can use our API to access endpoints, which gives read/write to CheckMaxx user accounts.

Endpoints description, method, url, request/response schema and their description are presented on the left. The right side contains example requests (via curl) and responses (in JSON).

For more information on types and possible value, refer to the Models and Enumeration section.

In the future, more endpoints will be added in order to provide complete access to CheckMaxx database.

If this is your first time reading the docs, check out the Authentication section for obtaining and using API keys.

Changelog section contains all updates related to this API.

Authentication

To authorize, use this code:

# With shell, you can just pass the correct header with each request
curl "api_endpoint_here"
  -H "Authorization: $your_api_key"

CheckMaxx API uses API keys to allow access to the API... You can receive a new API key by logging in, and it will be provided as a session token.

Account Service IAM Controller

Enables a user to login and logout.

Enables a user to login and logout. This begins a user session that is required for using the other services of CheckMaxx.

Logout

curl "API_BASE/v1/iam/logout"
    -H "Authorization: $your_api_key"

This endpoint allows users to logout

HTTP Request

GET /v1/iam/logout

The request JSON response is:

This endpoint do not return anything, only the HTTP status code matters.

Request schema

This request does not accept any parameters.

Response schema

This endpoint do not return anything, only the HTTP status code matters.

Retrieves user-specific information from the session

curl "API_BASE/v1/iam/me"
    -H "Authorization: $your_api_key"

This endpoint returns data associated with the authenticated user. The Shop associated with the User is embedded

HTTP Request

GET /v1/iam/me

The request JSON response is:

{
    "created_on": "0001-01-01T00:00:00Z",
    "updated_on": "0001-01-01T00:00:00Z",
    "id": 0,
    "email": "",
    "language_code": "",
    "app_version": "",
    "web_version": "",
    "role_id": 0,
    "shop_id": null,
    "shop": null
}

Request schema

This request does not accept any parameters.

Response schema

This endpoint return an object of type User, please refer to the JSON response column on the right, or to the Models and Enumeration section for more details.

Login through Google

curl "API_BASE/v1/iam/google_login"
    -H "Authorization: $your_api_key"

This endpoint allows users to sign in with a Google account. If the user does not exists yet, an account will be created, without a shop. See the shops/create endpoint from this service to create and assign a shop. The user returned contains the SessionToken. If a shop is assigned it's embedded to avoid having to call /me after each login.

HTTP Request

POST /v1/iam/google_login

The request Body payload is:

{
    "id_token": "",
    "app_version": ""
}

The request JSON response is:

{
    "user": null,
    "session_token": ""
}

Request schema

Parameter Type Required Description
id_token string true Google ID token
app_version string true The app version used when loggin in from the app

Response schema

This endpoint return an object with the following fields, please refer to the JSON response column on the right for an example.

Parameter Type
user model.User
session_token string

Account Service Shop Controller

When users login on the app, an account will be created for them if they don't have one yet.

If a user does not have a shop assigned, the app will ask to create one, and use this controller to create and assign it.

Later on, more shop management and assignment endpoints will be added.

Update a shop

curl "API_BASE/v1/shops/update"
    -H "Authorization: $your_api_key"

This endpoint update an existing shop.

HTTP Request

POST /v1/shops/update

The request Body payload is:

{
    "shop": {
        "created_on": "0001-01-01T00:00:00Z",
        "updated_on": "0001-01-01T00:00:00Z",
        "id": 0,
        "photo_url": "",
        "thumbnail_url": "",
        "name": "",
        "address": "",
        "phone": "",
        "email": "",
        "checkable_id": 0,
        "shop_tier_id": 0,
        "created_by_id": 0,
        "updated_by_id": null
    }
}

The request JSON response is:

This endpoint do not return anything, only the HTTP status code matters.

Request schema

Parameter Type Required Description
shop Shop true The shop to be updated

Response schema

This endpoint do not return anything, only the HTTP status code matters.

Upload a shop photo

curl "API_BASE/v1/shops/upload_photo"

This endpoint upload a picture and return it's URL to be used as shop.photo_url.

HTTP MultiPart Request

POST /v1/shops/upload_photo

The request parts are:

--XXX
Content-Disposition: form-data; name=

...
--XXX
Content-Disposition: form-data; name=

...--XXX--

The request JSON response is:

{
    "photo_url": "",
    "thumbnail_url": ""
}

This request must be a multipart/form-data content-type with valid boundary for each part

Request parts schema

Parameter Type Required Description
photo http.FormFile true The photo to be uploaded
thumbnail http.FormFile true The thumbnail to be uploaded

Response schema

This endpoint return an object with the following fields, please refer to the JSON response column on the right for an example.

Parameter Type
photo_url string
thumbnail_url string

Creates a shop

curl "API_BASE/v1/shops/create"
    -H "Authorization: $your_api_key"

This endpoint create a shop and assign it for users that does not have one with the provided details.

HTTP Request

POST /v1/shops/create

The request Body payload is:

{
    "shop": {
        "created_on": "0001-01-01T00:00:00Z",
        "updated_on": "0001-01-01T00:00:00Z",
        "id": 0,
        "photo_url": "",
        "thumbnail_url": "",
        "name": "",
        "address": "",
        "phone": "",
        "email": "",
        "checkable_id": 0,
        "shop_tier_id": 0,
        "created_by_id": 0,
        "updated_by_id": null
    }
}

The request JSON response is:

{
    "id": 0
}

Request schema

Parameter Type Required Description
shop Shop true The shop to be created

Response schema

This endpoint return an object with the following fields, please refer to the JSON response column on the right for an example.

Parameter Type
id ShopID

Models and Enumeration

Checkable Enumeration

Value Description
1 Car
2 Truck
3 Bicycle
4 Motorcycle
5 Tractor
6 Moped

LanguageCode Enumeration

Value Description
nl-NL Dutch
en-GB English

Role Enumeration

Value Description
10 Top level user role (has all permissions)
20 Support admin role, similar to admin but without deleting rights
100 User of the service

ShopTier Enumeration

Value Description
1 Basic shop, limited to 4 checkmaxx a day. Default option when creating a Shop.

FormFile Model

Field Type Description

Shop Model

Field Type Description
ID ShopID
PhotoURL string URL of the shop photo
ThumbnailURL string URL of the shop thumbail
Name string Name or title
Address string Physical address or location
Phone string Contact phone number
Email string Email address
CheckableID Checkable What is the shop checking
ShopTierID ShopTier Which feature the shop has access to
CreatedByID UserID ID of the user that created the shop
UpdatedByID UserID ID of the last user who updated the shop

User Model

Field Type Description
ID UserID
Email string Email address
LanguageCode LanguageCode Identifier for the language used
AppVersion string Application version
WebVersion string Web application version
RoleID Role Identifier for the assigned Role
ShopID ShopID Identifier of the Shop to which the user belongs
Shop Shop Optionally embedded field, containing the full shop to which the user belongs

Changelog

This section contains changes related to the API service. Changes will be included if:

Initial release - 08.06.2023.

The following endpoints are included with initial release:

Errors

CheckMaxx APIs uses the following error codes:

Error Code Meaning
400 Bad Request : Your request is invalid.
401 Unauthorized : Your API key is wrong.
404 Not Found : The specified endpoint could not be found.
405 Method Not Allowed : You tried to access server with an invalid method.
429 Too Many Requests : You're making too many requests.
500 Internal Server Error : We had a problem with our server. Try again later.
503 Service Unavailable : We're temporarily offline for maintenance. Please try again later.