Getting Started with Our API#
Welcome to WellnessLiving RESTful API! This guide will help you get started quickly and securely, enabling you to integrate our services into your application.
Authentication: Using Bearer Tokens#
To access our API, all requests must be authenticated using a Bearer token. This token ensures secure communication and validates your identity as an authorized client.A Bearer token is a string of characters that represents your API authentication credentials. It must be included in the Authorization header of your HTTP requests to authenticate and execute API calls.
1. Register Your Application:If you haven't already, please follow the details provided
Getting API Access to receive your API credentials (client ID and client secret).
2. Generate a Token:
Use your API credentials to request a Bearer token by calling the /token endpoint.Store the access_token securely. This token is valid for 3600 seconds (expires_in one hour), after which you'll need to generate a new one.
Invoke the Methods: Using the APIs#
To invoke our RESTful API, you should make an HTTP request using a methods such as
GET
,
POST
,
PUT
, or
DELETE
, depending on the operation you want to perform and availabilities of those operation.
In some cases, you may use libraries or tools like fetch
in JavaScript or axios
to send these requests. For example, to retrieve data from an API, you can use a GET
request. Here’s how it might look using the fetch
function in JavaScript:This sends a GET
request to https://uat-api.wellnessliving.io/v1/business
, attaching the JWT token for authentication in the Authorization header. The server responds with data in JSON format, which is then processed in the .then()
block.
Always ensure to handle errors properly and check the server’s response for successful execution or failure.Error Handling
If you encounter issues with token authentication, the API will return an error response. Below are common scenarios and how to resolve them:
1
401
Unauthorized: Invalid or expired Bearer token
Generate a new token and retry the request.
2
403
Forbidden: Token lacks required permissions
Ensure your token has the appropriate scopes.
3
400
Bad Request: Invalid token request format
Verify the request payload and try again.
OpenAPI Specification
This documentation provides details about the WellnessLiving API. If you would like to download the OpenAPI specification, please click here.