Users API
Use these APIs to to perform actions related to your users (members).
The id
and auth_id
are two different fields and are not interchangeable.
When using our Loyalty API, if you want to take an action on a user’s account, you need to use the auth_id.
The auth_id
can be set by you if you register users using our Loyalty API. So, for example, you could set it to the primary key you have for the user in your own systems. This saves you the trouble of creating another column to map users in your system to the user profile with qiibee.
However, if you prefer qiibee that generates a new unique identifier for every new user registration, simply leave the auth_id
field empty and we will generate a UUID-v4 and return it to you so you can save it in your system. The user_id
shown in the Loyalty Whitelabel App (LWA) frontend is different from the auth_id
and is used exclusively for the LWA frontend.
Create User
POST /users
Only the email field is mandatory. The email will be validated, failing which, will return a 400.
We recommend you send a unique UUID-v4 auth_id
for every new user registration so you can map each user to your internal system. If you do not send this field we will generate a UUID-v4 and return it to you.
Please save the auth_id
and use it for all actions on a user's account.
eg.
Responses
Created:
HTTP 201
with the user objectBad data:
HTTP 400
with error messageeg. duplicate
auth_id
Update User details
PUT /users/:auth_id
|| PATCH /users/:auth_id
You can update every field besides the auth_id
eg.
Responses
Update:
HTTP 200
with the user objectNot found:
HTTP 404
with error message
Get List of Users
GET /users/
This request returns a paginated list of users. By default, it returns the last 100 users associated with your brand, along with the total count of the users.
You can query transactions using the following query parameters:
limit
: (optional) sets the required limit of users history to be requested.Defaults:
100
Maximum:
100
offset
: (optional) number of users to offset when getting the remaining users.Default:
0
email_like
: (optional) a partial or complete email address of registered users.from_time
: (optional) queries for transactions that begin from the specified datetime.Defaults: The datetime at which the brand was created in the qiibee database.
to_time
: (optional) queries for transactions until the specified datetime.Defaults: The current datetime.
The params, limit
and offset
, work exactly as they’re used in SQL.
Please be sure to encode the query parameters. In the time parameters, the date and time must be expressed according to ISO 8601.
eg: The datetime for 06 June 2022 at 11:23:23 AM will be expressed as 2022-06-01T11:23:23Z
Responses
Success:
HTTP 200
with the user object:Bad data:
HTTP 404
with error messageeg. not found
Get User Details
GET /users/:auth_id
Responses
Success:
HTTP 200
with the user object:Bad data:
HTTP 404
with error messageeg. not found
Create User Membership
POST /users/:auth_id/memberships
All fields are mandatory.
Each user can have 1 membership per exchange provider. You can override the membership number in specific requests - for example, when exchanging points to miles you can provide a new membership number specifically for that request.
brand_id
can be one of:
your brand's id (in this case, the membership number will be your user's auth_id)
etihad
miles_and_more
alaska
The membership number will be validated. If you want to know how you can validate the numbers yourself please reach out to us and we will provide the algorithms for each exchange provider.
eg.
Responses
Created:
HTTP 201
with the user objectNot found:
HTTP 404
user not found
Bad data:
HTTP 400
with error messageinvalid format for the membership number
invalid exchange provider
Update User Membership
Same as Create User Membership.
Get User Memberships
GET /users/:auth_id/memberships
This will return all the memberships for a user. If no memberships exist for the user this will be an empty array.
eg.
Get User Membership
GET /users/:auth_id/memberships/:implementation_name
Returns the membership information for a user for a particular exchange provider implementation, if found, 404
and empty object otherwise.
eg.
Responses
Success:
HTTP 200
with membershipNot found:
HTTP 404
if user or membership not found
Delete User Membership
DELETE /users/:auth_id/memberships/:implementation_name
Deletes the membership information for a user if it exists. Returns 404
if user or membership not found.
eg.
Responses
Success:
HTTP 204
Not found:
HTTP 404
if user or membership not foundBad request:
HTTP 400
if the implementation does not exist
Last updated