Skip to main content

TPRM

BCMLogic Next documentation includes an interactive API playground that allows you to test API endpoints directly from your browser.

Features

  • Try It Out: Test API endpoints without writing code
  • Authentication Support: Save and reuse authentication tokens
  • Request Builder: Interactive forms for building API requests
  • Response Viewer: View formatted API responses with status codes
  • Server Selection: Switch between development and production servers

How to Use

1. Navigate to an API Endpoint

Go to the API Reference section and select any endpoint you want to test.

2. Select a Server

At the top of the API documentation page, you'll see a server dropdown:

  • Local development server: http://localhost:8000 - For testing against your local backend
  • Production server: https://api.vendorhub.bcmlogic.com - For testing against production

Select the appropriate server for your needs.

3. Fill in Parameters

The interactive playground provides input fields for:

  • Path parameters: Variables in the URL path (e.g., vendor_id)
  • Query parameters: URL query string parameters
  • Request body: JSON payload for POST/PUT/PATCH requests
  • Headers: Custom HTTP headers

4. Authentication (if required)

For endpoints that require authentication:

  1. Click on the Authorization section
  2. Enter your authentication token or API key
  3. The credentials will be saved in localStorage for future requests

5. Send the Request

Click the "Execute" or "Send API Request" button to make the request.

6. View the Response

The playground will display:

  • HTTP status code (200, 400, 404, etc.)
  • Response headers
  • Response body (formatted JSON)
  • Request duration

Example: Testing the Vendor Search Endpoint

  1. Navigate to Get Vendor List
  2. Select http://localhost:8000 from the server dropdown
  3. In the request body, enter:
{
"query": "",
"filters": {}
}
  1. Click "Execute"
  2. View the response with the list of vendors

Server Configuration

The available servers are configured in the FastAPI backend:

  • Local Development: http://localhost:8000
  • Production: https://api.vendorhub.bcmlogic.com

Authentication Persistence

Authentication tokens are persisted using localStorage, which means:

  • Tokens remain even after refreshing the page
  • Tokens are shared across all API endpoints in the documentation
  • Tokens are stored in your browser (don't use production credentials on shared computers)

CORS Configuration

When testing against a local backend, ensure that CORS is properly configured to allow requests from http://localhost:3000 (the Docusaurus dev server).

Tips

  • Use the local server for development: Test changes against your local backend before deploying
  • Check the request examples: Each endpoint shows example requests in multiple languages
  • Review response schemas: Understand the structure of responses before making requests
  • Save frequently used requests: Use browser bookmarks to save API pages with pre-filled parameters

Troubleshooting

"Network Error" or "CORS Error"

  • Ensure the backend server is running
  • Check that CORS is configured to allow requests from the documentation site
  • Verify the server URL is correct

"401 Unauthorized"

  • Check that you've entered valid authentication credentials
  • Verify the token hasn't expired
  • Ensure you're using the correct authentication method

"404 Not Found"

  • Verify the endpoint path is correct
  • Check that the backend is running the latest version
  • Ensure all path parameters are filled in correctly