API Prerequisites

All APIs are designed with some consistant approaches and parameters. Here are the things which should be kept in mind while integrating the APIs:

  1. Base URL The Base URL for API calls will be https://urbanfits.ae/api for both; Website and Admin panel. The paths in upcoming APIs will be relative to this.
  2. API Response Each API must contains 2 mandatory parameters i.e
    • success : Boolean which tells whether the requested operation was successful or not.
    • msg : String A user friendly message to inform about the requested operation. It can be directly shown in the notification/toasts.
  3. Session The backend uses JWT & Cookies based session both in Website and Admin panel.
  4. Session Cookies The session response will contain 2 important cookies:
    • session-token: An HTTP only cookie which should always be sent to the server in subsequent requests to the backend. It should be properly handled in mobile app so it can be sent back to the backend making any request for a logged in user.
    • is_logged_in : A client accessible cookie to demonstrate if the user is logged in or not. This cookie does not needed to be sent to the server on subsequent requsts.
  5. User update Each time user updates their data or something that will affect the user profile data, it will be udpated in the session token.
  6. Every response containing user data will have a fixed key i.e. user .

Hitting APIs

Specially if the APIs are being called from the web browser, a credentials header should be set to include vlaue i.e
credentials: 'include' which tells browser to send the session cookies along with subsequent requests since our backend will be requiring the user session token to authorize every request.
This must be handled properly in the Mobile App development so that every personalized API call send the cookies headers back to the backend as they were sent during the Signup or Login. This will be properly explained in the signup API.

Response Formats

A very Important point should be kept in mind while referring this documentation that the responses samples included further API docs won't always be necessarily complete neither it's possible to inlcude all the combinations of values. It is required to refer to the Schemas in the Github Repository.
There will be a models directory in the root of the project containing all the schemas for all data sets being used in project.

CORS (Cross Origin Resource Sharing)

The backend only allow CORS headers to these following origins:

Images Usage

The Backend uses AWS S3 cloud storage to store the all kinds of images whether its users', product images, UF-Tasks Image submition or any other carousel images.
There will be a fixed Base Image URL i.e. https://urban-fits.s3.ap-south-1.amazonaws.com. Every stored image record from any API response will have a partial image url relative this base url. In order to use images, this base image url must be prefixed to the url obtained in response.

There comes another consideration with it that the users who have accounts associated with Google will have their profile images stored in our server from the google server. It will be full url which needs to be detected on the runtime if the user profile image have a google domain then don't prefix it and use it as it is.