WellnessLiving API (v1)
    WellnessLiving API (v1)
    • WellnessLiving API
    • Auth
      • Authentication
    • Appointment
      • /v1/appointment/book/asset/list
      • /v1/appointment/book/asset/category
      • /v1/appointment/book/service/list
      • /v1/appointment/book/staff/list
    • Business
      • /v1/business
      • /v1/business/skin
    • Classes
      • /v1/classes/list
      • /v1/classes/view/element
    • Collector
      • /v1/collector/debt/list
      • /v1/collector/debt/pay
      • /v1/collector/debt/transaction
    • Drive
      • /v1/drive/product/image/upload
    • Event
      • /v1/event/book/list
      • /v1/event/list
      • /v1/event/book/view/element
    • Location
      • /v1/location/list
      • /v1/location/view
    • Login
      • /v1/login/search/settings
      • /v1/login/search/staff-app/list
      • /v1/login/search/settings
    • Member
      • /v1/member/info
    • Profile
      • /v1/profile/purchase/list
      • /v1/profile/contract
      • /v1/profile/purchase/list/element
    • Promotion
      • /v1/promotion/list
      • /v1/promotion
    • Purchase
      • /v1/purchase/receipt
    • Report
      • /v1/report/data
      • /v1/report/query
    • Schedule
      • /v1/schedule/class/list
      • /v1/schedule/page/list
      • /v1/schedule/tab
      • /v1/schedule/class/view
      • /v1/schedule/page/element
    • Shop
      • /v1/shop/category
    • Staff
      • /v1/staff/list
      • /v1/staff/view
    • User
      • /v1/user
    • Visit
      • /v1/visit/status

    WellnessLiving API

    2024-12-10_15-18-16.png

    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.
    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.
    Step 1: Obtain Your Bearer Token
    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.
    Example Request:
    POST https://access.api.wellnessliving.io/oauth2/token
    Content-Type: application/x-www-form-urlencoded
    grant_type=client_credentials
    client_id=YOUR_CLIENT_ID
    client_secret=YOUR_CLIENT_SECRET
    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.

    Step 2: use the Bearer Token in your API requests
    Step 3: Handle Expired Tokens

    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.
    Error handling

    Always ensure to handle errors properly and check the server’s response for successful execution or failure.
    :::
    Hover over me
    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.
    Next
    Authentication