Resource Technical Notes
This page covers advanced topics for resource development including OpenAPI specifications, authentication methods, pricing models, rate limiting, and troubleshooting common issues.
OpenAPI Specification
Resources must include a complete OpenAPI 3.0 specification defining all endpoints, parameters, request bodies, and response schemas. The platform validates incoming requests against this specification and generates interactive documentation for resource consumers.
Minimal OpenAPI Specification
A minimal OpenAPI specification includes:
OpenAPI Capabilities
The OpenAPI specification provides four critical capabilities:
- Auto-generated documentation - Interactive API documentation for resource consumers
- Type safety - Request and response validation against defined schemas
- SDK generation - Automatic client library generation for multiple languages
- Clear contracts - Explicit interface definitions between providers and consumers
Authentication Methods
Resources support five authentication mechanisms, each configured through the authentication field and optional authConfig object.
None
noneNo authentication required. Use for public APIs or resources with custom authentication logic.
API Key
api_keyAPI key authentication via header or query parameter. Specify the header name and location in
authConfig.
Bearer Token
bearerBearer token authentication using the Authorization header. Commonly used for JWT tokens and OAuth 2.0 access tokens.
Basic Authentication
basicHTTP Basic authentication with username and password. Credentials are base64-encoded in the Authorization header.
OAuth 2.0
oauth2OAuth 2.0 authentication flow with authorization URL, token URL, and scopes. The platform handles token refresh and expiration.
Method Definitions
Each resource method defines an HTTP operation with parameters, request body schema, response schema, and optional cost tracking.
Method Structure
HTTP Methods
Method definitions support all standard HTTP methods (GET, POST, PUT, PATCH, DELETE) and include path parameters using curly brace syntax: /users/{userId}.
Rate Limiting
Resources can define rate limits to control usage and prevent abuse. Rate limits specify the maximum number of requests allowed within a time window.
Rate Limit Configuration
Supported Time Windows
1m- One minute1h- One hour1d- One day
Rate Limit Behavior
When a rate limit is exceeded, the platform returns a 429 Too Many Requests response with a Retry-After header indicating when the next request can be made.
Pricing Models
Resources support four pricing models to monetize API access and service usage.
Free
freeNo cost for resource usage. Suitable for open APIs, promotional resources, or community-contributed integrations.
Pay-Per-Call
pay-per-callCharges a fixed price per method invocation. Users pay only for actual usage with no recurring fees.
Subscription
subscriptionCharges a recurring monthly fee for unlimited access. Suitable for high-volume use cases with predictable costs.
Tiered
tieredOffers multiple subscription tiers with included call quotas and overage pricing. Provides flexibility for different usage levels.
Troubleshooting
Authentication Failures
When resource authentication fails, verify the following:
- Credentials match the format expected by the authentication type
- Authentication type in credentials matches the resource configuration
- OAuth 2.0 tokens have not expired (check
expiresAtfield) - API keys have the necessary permissions for the requested operations
- Bearer tokens are valid and not revoked
For OAuth 2.0 resources, the platform automatically refreshes expired tokens using the refresh token. If refresh fails, re-authenticate the resource with new credentials.
Rate Limit Errors
When encountering 429 Too Many Requests responses:
- Implement exponential backoff and retry logic in your scripts
- Check the
Retry-Afterheader for the next available request time - Consider upgrading to a higher pricing tier with increased limits
- Batch multiple operations into single requests where possible
- Cache frequently accessed data to reduce API calls
Method Not Found Errors
When a method cannot be invoked:
- Verify the method name matches the resource definition exactly
- Confirm the resource is published and available in the marketplace
- Check that the user has installed and authenticated the resource
- Ensure the method is included in the resource's OpenAPI specification
- Verify the user's subscription tier includes access to the method
Invalid OpenAPI Specification
When resource creation fails due to specification errors:
- Validate the OpenAPI specification using an online validator
- Ensure all required fields (
openapi,info,paths) are present - Verify response schemas include
contentandschemadefinitions - Check that parameter types match OpenAPI 3.0 data types
- Confirm all
$refreferences resolve to defined components
Publishing Validation Errors
When publishing fails, common issues include:
- Missing or incomplete method definitions
- Invalid pricing configuration
- OpenAPI specification validation failures
- Missing authentication configuration for methods requiring auth
- Resource name conflicts with existing marketplace resources
Best Practices
Security
- Store API credentials securely using encryption at rest
- Never log or expose credentials in error messages
- Validate all incoming requests against the OpenAPI schema
- Implement rate limiting to prevent abuse
- Use HTTPS for all API endpoints
- Rotate API keys regularly and support key revocation
Performance
- Cache frequently accessed data to reduce API calls
- Use connection pooling for database-backed resources
- Implement request deduplication for idempotent operations
- Set appropriate timeouts to prevent hanging requests
- Monitor resource performance and optimize slow endpoints
Reliability
- Implement retry logic with exponential backoff
- Provide detailed error messages for debugging
- Monitor error rates and set up alerts
- Test resource methods thoroughly before publishing
- Version your API to support backward compatibility
Documentation
- Write clear descriptions for all methods and parameters
- Include example requests and responses
- Document error codes and their meanings
- Provide usage examples and common patterns
- Keep documentation in sync with implementation
See Also
- Overview - Resource concepts and types
- Endpoints - Complete API reference
- Examples - Practical implementation examples
- Authentication - Platform authentication guide