Introduction
This document provides a comprehensive guide for mobile developers on how to use the APIs in ADAFASA project. It covers the authentication process using an UAE PASS provider, as well as details on each API endpoint, request formats, and response formats.
Authentication
To authenticate requests to the mobile APIs, you need to obtain an access token from the UAE PASS provider. The following steps outline the authentication process:
Mobile App User Authentication: The mobile app should integrate with the UAE PASS authentication flow, allowing users to log in and obtain an access token.
Access Token Retrieval: After successful authentication, the UAE PASS will issue an access token to the mobile app. This access token will be used to authenticate requests to the mobile APIs.
Token Inclusion: All requests to the mobile APIs should include the access token in the request headers. Use the following header:
Authorization: Bearer <access_token> Replace<access_token>
with the actual access token obtained from the OpenID provider.Token Expiration and Refresh: Access tokens are typically short-lived and will expire after a certain period. If an API request returns a 401 Unauthorized status code, the mobile app should refresh the access token using the UAE PASS refresh token mechanism. The refreshed token should then be used for subsequent requests.
please refer to https://docs.uaepass.ae/guides/authentication/mobile-application for the full mobile integration guide
API Endpoints
The following section provides an overview of the available API endpoints along with their request formats and response formats.
Register
Endpoint
POST /api/app/trainee-profile/register
Request Format
The request should be a JSON object with the following properties:
name string required The full name of the trainee.
emiratesId string required The Emirates ID of the trainee.
emailAddress string required (required) The email address of the trainee.
phoneNumber string required The phone number of the trainee.
trainee.nationality string The nationality of the trainee.
trainee.dateOfBirth dateTime The date of birth of the trainee.
trainee.gender number The gender of the trainee (0 for male, 1 for female).
trainee.personalPhoto string The personal photo of the trainee.
trainee.workInFoodEstablishment boolean Indicates whether the trainee works in a food establishment.
trainee.establishmentLicenseNumber string The license number of the establishment where the trainee works.
trainee.establishmentName string The name of the establishment where the trainee works.
trainee.receiveNotifications boolean Indicates whether the trainee wants to receive notifications.
trainee.educationLevel string required The education level of the trainee.
trainee.howDoYouNowAboutUs string How the trainee came to know about the service.
Example Request:
{
"name": "Adafsa Trainee",
"emiratesId": "123456789",
"emailAddress": "Adafsa@Trainee.com",
"phoneNumber": "9721234567",
"trainee": {
"nationality": "emirati",
"dateOfBirth": "2000-05-08T10:09:01.037Z",
"gender": 0,
"personalPhoto": "string",
"workInFoodEstablishment": true,
"establishmentLicenseNumber": "string",
"establishmentName": "string",
"receiveNotifications": true,
"educationLevel": "High School",
"howDoYouNowAboutUs": "Facebook"
}
}
Response Format
The response will be a JSON object with the following properties:
Example Success Response:
{
"name": "Adafsa Trainee",
"emailAddress": "Adafsa@Trainee.com",
"phoneNumber": "9721234567",
"trainee": {
"nationality": "emirati",
"dateOfBirth": "2000-05-09T07:04:10.689Z",
"gender": 0,
"personalPhoto": "string",
"workInFoodEstablishment": false,
"establishmentLicenseNumber": "string",
"establishmentName": "string",
"receiveNotifications": true,
"educationLevel": "High School",
"howDoYouNowAboutUs": "Facebook"
}
}
Profile Lookups :-
Education Levels
Endpoint
GET /api/app/lookups/education-levels
Request Format
The Header Accept-Language must be sent to get localized displayName
Response Format
The response will be a JSON object with the following properties:
Example Response:
[
{
"value": "Bachelor Degree",
"displayName": "BachelorDegree"
},
{
"value": "High School",
"displayName": "HighSchool"
}
]
Channels
Endpoint
GET /api/app/lookups/channels
Request Format
The Header Accept-Language must be sent to get localized displayName
Response Format
The response will be a JSON object with the following properties:
Example Response:
[
{
"value": "Facebook",
"displayName": "Facebook"
},
{
"value": "WhatApp",
"displayName": "WhatApp"
}
]
Get Profile
Endpoint
GET /api/app/trainee-profile/profile
Request Format
No request body is required for this endpoint.
Response Format
The response will be a JSON object with the following properties:
Example Response:
{
"name": "Adafsa Trainee",
"emailAddress": "Adafsa@Trainee.com",
"phoneNumber": "9721234567",
"trainee": {
"nationality": "emirati",
"dateOfBirth": "2000-05-09T07:04:10.689Z",
"gender": 0,
"personalPhoto": "string",
"workInFoodEstablishment": false,
"establishmentLicenseNumber": "string",
"establishmentName": "string",
"receiveNotifications": true,
"educationLevel": "High School",
"howDoYouNowAboutUs": "Facebook"
}
}
Update Profile
Endpoint
PUT /api/app/trainee-profile/profile
Request Format
The request should be a JSON object with the following properties: name string required The full name of the trainee.
emailAddress string required (required) The email address of the trainee.
phoneNumber string required The phone number of the trainee.
trainee.nationality string The nationality of the trainee.
trainee.dateOfBirth dateTime The date of birth of the trainee.
trainee.gender number The gender of the trainee (0 for male, 1 for female).
trainee.receiveNotifications boolean Indicates whether the trainee wants to receive notifications.
Example Request:
{
"name": "Adafsa Trainee",
"emailAddress": "Adafsa@Trainee.com",
"phoneNumber": "97212345678",
"trainee": {
"nationality": "emirati",
"dateOfBirth": "2000-05-08T10:48:29.358Z",
"gender": 0,
"receiveNotifications": true
}
}
Response Format
The response will be a JSON object with the following properties:
Example Response:
{
"name": "Adafsa Trainee",
"emailAddress": "Adafsa@Trainee.com",
"phoneNumber": "97212345678",
"trainee": {
"nationality": "emirati",
"dateOfBirth": "2000-05-09T07:04:10.689Z",
"gender": 0,
"personalPhoto": "string",
"workInFoodEstablishment": false,
"establishmentLicenseNumber": "string",
"establishmentName": "string",
"receiveNotifications": true,
"educationLevel": "High School",
"howDoYouNowAboutUs": "Facebook"
}
}