Developers

Postman

DevelopersPostman

Postman is a popular tool for exploring and testing APIs. The BookFlow OpenAPI spec imports cleanly into Postman and gives you a full request collection in 60 seconds.

Setup

  1. Open Postman. Click "Import" in the top left.
  2. Choose "Link" and paste the OpenAPI URL once it ships (currently https://booking-api.netwit.ca/api/openapi.yaml is not yet served — see OpenAPI). Until then, import a manually-authored Postman collection or use curl examples from the per-audience reference pages.
  3. Click "Continue" then "Import". Postman creates a collection with one request per endpoint.
  4. Open the collection. Click the variables tab.
  5. Set the baseUrl variable: https://booking-api.netwit.ca (or http://localhost:8787 for dev).
  6. Send a POST /api/auth/login request with your email + password. The response will include a data.token.
  7. Copy that token into the token variable in Postman.
  8. Now all the other requests in the collection will use it via Bearer auth.

Try a public endpoint (no auth)

GET /api/public/demo-salon-1785076211558918289 works without a token. Useful for getting started.

Try an owner endpoint (with token)

GET /api/businesses/me returns the current business. Make sure your token variable is set.

Save as a collection

Once you have the collection working, click "Save" and give it a name like "BookFlow (prod)". Share it with your team by clicking "Share" → "Get public link".

Environments

Postman lets you have multiple environments (prod, staging, dev). Create them in the left sidebar and set the variables for each.

Pre-request scripts

For endpoints that need a fresh token (e.g. after the 24h expiry), add a pre-request script at the folder level:

// Auto-refresh token if missing
if (!pm.environment.get("token")) {
  pm.sendRequest({
    url: pm.environment.get("baseUrl") + "/api/auth/login",
    method: "POST",
    header: { "content-type": "application/json" },
    body: {
      mode: "raw",
      raw: JSON.stringify({
        email: pm.environment.get("email"),
        password: pm.environment.get("password"),
      }),
    },
  }, (err, res) => {
    pm.environment.set("token", res.json().data.token);
  });
}

Tests

Add a test to every request to assert the response. Example for GET /api/businesses/me:

pm.test("returns 200", () => pm.response.to.have.status(200));
pm.test("has a tenant id", () => {
  const json = pm.response.json();
  pm.expect(json.data.id).to.be.a("string");
});
Need a human?

Email hello@netwit.ca or call +1-604-206-8169. NetWit responds in 1 business day.