Skip to main content

Interactive API Testing

The Hoops Finance API documentation includes interactive testing capabilities that allow you to test API endpoints directly from the documentation without leaving your browser.

How to Use Interactive Testing

1. Navigate to API Reference

Visit the API Reference section to access the interactive documentation.

2. Find an Endpoint

Browse through the available endpoints or use the search functionality to find the endpoint you want to test.

3. Try It Out

Look for the "Try it out" button next to each endpoint. Click it to enable interactive testing mode.

4. Configure Parameters

  • Path Parameters: Fill in required path parameters (like token addresses or pair IDs)
  • Query Parameters: Add optional query parameters (like pagination, filters, etc.)
  • Headers: The documentation will automatically include necessary headers

5. Execute the Request

Click the "Execute" button to send a real request to the Hoops Finance API.

6. View the Response

The response will be displayed with:

  • HTTP Status Code: 200, 404, 500, etc.
  • Response Headers: Including rate limiting information
  • Response Body: The actual JSON data returned by the API

Example: Testing the Protocols Endpoint

  1. Go to the API Reference and find the GET /protocols endpoint
  2. Click "Try it out"
  3. Click "Execute" (no parameters needed for this endpoint)
  4. View the live response showing all supported DeFi protocols

Example: Testing a Specific Pair

  1. Find the GET /pairs/{pairContract} endpoint
  2. Click "Try it out"
  3. Enter a pair contract address like: CAB6MICC2WKRT372U3FRPKGGVB5R3FDJSMWSLPF2UJNJPYMBZ76RQVYE
  4. Click "Execute"
  5. View detailed information about that specific liquidity pair

Rate Limiting

When testing interactively, you're subject to the same rate limits as regular API usage:

  • 120 requests per minute
  • 30 requests burst limit

Rate limit headers will be shown in the response, including:

  • X-RateLimit-Limit: Your rate limit
  • X-RateLimit-Remaining: Remaining requests
  • X-RateLimit-Reset: When the limit resets

CORS Support

The Hoops Finance API supports CORS (Cross-Origin Resource Sharing), which enables the interactive testing to work directly from your browser.

Tips for Testing

Use Real Data

  • The interactive testing uses the live production API
  • All responses contain real, up-to-date data
  • Be mindful of rate limits when testing extensively

Test Different Scenarios

  • Try valid parameters to see successful responses
  • Try invalid parameters to see error responses
  • Test edge cases like non-existent token addresses

Copy Examples

  • Use the "Copy" button to copy successful requests
  • Adapt the examples for your own applications
  • Note the exact parameter formats and required fields

Common Endpoints to Test

Basic Information

  • GET /protocols - List all supported protocols
  • GET /tokens - List all tracked tokens
  • GET /pairs - List all liquidity pairs

Specific Data

  • GET /pairs/\{pairContract\} - Get specific pair details
  • GET /tokens/\{tokenAddress\} - Get specific token information
  • GET /tokens/\{tokenAddress\}/pairs - Get pairs for a token

Analytics

  • GET /getmetrics - Platform-wide metrics
  • GET /getstatistics - Per-pair statistics

AI Endpoints

  • GET /ai/tokens - AI-formatted token data
  • GET /ai/pairs - AI-formatted pair data
  • GET /ai/whales - Top liquidity providers

Troubleshooting

Request Failed

  • Check that all required parameters are provided
  • Verify parameter formats (especially contract addresses)
  • Ensure you haven't exceeded rate limits

CORS Errors

  • The API should support CORS, but some browser extensions may interfere
  • Try disabling ad blockers or privacy extensions temporarily
  • Use an incognito/private browsing window

Invalid Responses

  • Verify the parameter values are correct
  • Check the API status at the base URL: https://api.hoops.finance
  • Some endpoints may require specific parameter combinations

Happy testing! 🚀