Your First API Call
This guide will walk you through making your first API call to the Weir AI API v1.0.1. We’ll cover different scenarios based on your chosen API category.Prerequisites
Before making your first API call, ensure you have:API Credentials
Your client credentials (External APIs) or user account (Console APIs)
Access Token
A valid access token for authentication
HTTP Client
curl, Postman, or your preferred HTTP client
Base URL
The Weir AI API base URL:
https://api.weir.aiExternal API - First Call
Step 1: Generate Access Token
Step 2: Use the Access Token
Console API - First Call
Step 1: Login and Get Tokens
Step 2: Create Your First Team
Understanding the Response Format
All Weir AI API responses follow a consistent format:Success Response Structure
Error Response Structure
Common Response Fields
Success Responses
Success Responses
- data: Contains the actual response data
- message: Human-readable success message
- status: Always “success” for successful requests
Error Responses
Error Responses
- error.code: Machine-readable error code
- error.message: Human-readable error message
- error.details: Additional error information
- status: Always “error” for failed requests
HTTP Status Codes
Success Codes
- 200 OK: Successful GET, PUT, PATCH requests
- 201 Created: Successful POST requests
- 204 No Content: Successful DELETE requests
Error Codes
- 400 Bad Request: Invalid request parameters
- 401 Unauthorized: Authentication required
- 403 Forbidden: Insufficient permissions
- 404 Not Found: Resource not found
- 429 Too Many Requests: Rate limit exceeded
Testing Your Setup
Verify Authentication
Make sure your authentication is working by generating a token or logging in successfully.
Test Basic Endpoint
Try a simple GET request to verify your setup is working correctly.
Check Response Format
Verify that you’re receiving responses in the expected format.
Handle Errors
Test error scenarios to ensure your error handling is working properly.
Code Examples
Troubleshooting
Authentication Issues
Authentication Issues
Problem: Getting 401 Unauthorized errorsSolutions:
- Check your credentials are correct
- Ensure you’re using the right authentication method
- Verify your access token hasn’t expired
- Check the Authorization header format
Request Format Issues
Request Format Issues
Problem: Getting 400 Bad Request errorsSolutions:
- Verify your request body is valid JSON
- Check required parameters are included
- Ensure parameter types are correct
- Validate request headers
Rate Limiting
Rate Limiting
Problem: Getting 429 Too Many Requests errorsSolutions:
- Check rate limit headers in responses
- Implement exponential backoff
- Reduce request frequency
- Cache responses when possible
Next Steps
Explore API Reference
Dive into the complete API reference for all available endpoints
Try Integration Guides
Follow detailed guides for building specific types of integrations
Check Code Examples
Browse ready-to-use code examples in multiple languages
Learn Best Practices
Understand best practices for building robust integrations
Congratulations! You’ve successfully made your first API call to the Weir AI API v1.0.1. You’re now ready to build powerful integrations with our platform.