WellnessLiving API
Getting Started with Our API
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.What is a Bearer Token? 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.
Invoke the Methods: Using the APIs
To invoke our RESTful API, you should make an HTTP request using a methods such as In some cases, you may use libraries or tools like This sends a
Always ensure to handle errors properly and check the server’s response for successful execution or failure.
GET
, POST
, PUT
, or DELETE
, depending on the operation you want to perform and availabilities of those operation.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:
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.Error handling
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:
If you encounter issues with token authentication, the API will return an error response. Below are common scenarios and how to resolve them:
401
Unauthorized: Invalid or expired Bearer token
Generate a new token and retry the request.
403
Forbidden: Token lacks required permissions
Ensure your token has the appropriate scopes.
400
Bad Request: Invalid token request format
Verify the request payload and try again.