Skip to content

Swagger UI Instructions

Kshitij09 edited this page Nov 5, 2021 · 2 revisions

Swagger UI will provide you with a list of endpoints supported by the API Server.

  • You can expand any endpoint section and click on "Try it out" to perform the API call.
  • APIs marked with a lock symbol is authorized using bearer token thus you may first need to perform a Login request ( /api/v2/auth/login ) to use such APIs

How to login?

  1. Expand /api/v2/auth/login section
  2. provide valid credentials to make a successful login request. Server initializes following user accounts with the initialization service. You can find the account details in the users.json file.
    email password role
    john.doe@test.com 1234 User
    ashok.kumar@test.com 0000 Admin
    john.smith@test.com 9876 Vendor
  3. Checkout response body, if the login was successful, you'll receive a JSON object having a key 'access_token'
  4. Copy the access_token value (must be a pretty long string)
  5. Click on the lock icon of any authorized API section or an "Authorize" button at the top right corner.
  6. Paste your access token in the 'value' Input and click " Authorize"
    1. You've successfully configured the required Authorization Header! You may now be able to use the authorized APIs.

Things to try out!

  • Products API ( /api/v2/products ) supports "Full Text Search" for names, try searching something that won't work with LIKE queries, for instance, search "potatoes" and you'll find out what that feature means.
  • Try getting all users ( /api/v2/users ) and soon you'll get to know you can only succeed with an admin account.
  • Try reading user details of some a user other than the one you logged-in with, turns out, you can't do that. Same goes for reading other user's orders.
Clone this wiki locally