Request ID and Correlation ID are powerful header tools for debugging and tracing API requests in Straddle. This guide will explain what they are, how to use them, and best practices for implementation.Documentation Index
Fetch the complete documentation index at: https://docs.straddle.com/llms.txt
Use this file to discover all available pages before exploring further.
What are Request ID and Correlation ID?
Request ID
A Request ID is a user-defined identifier in the header of each API request. It helps in tracking and debugging individual API calls.Correlation ID
A Correlation ID is a user-defined identifier in the header of each API request. It helps in tracing a sequence of operations across multiple systems or services.How to Use Request ID and Correlation ID
You can include Request ID and Correlation ID in your API requests to Straddle by adding specific headers to your HTTP requests.Using Request ID and Correlation ID
Here’s an example of creating a charge using the correct fields as specified in the OpenAPI schema, along with Request ID and Correlation ID:Retrieving Request ID and Correlation ID
Straddle includes the Request ID and Correlation ID (if provided) in the response headers of every API request.- Request ID:
Request-Id - Correlation ID:
Correlation-Id
Best Practices
- Generate Unique IDs: Ensure that your Request IDs and Correlation IDs are unique. UUIDs are a good choice for this.
- Consistent Usage: Use Request IDs for every API call, and use Correlation IDs for all requests related to a single operation or transaction.
- Logging: Log both Request IDs and Correlation IDs in your application logs. This will make it easier to trace requests across your systems and Straddle.
- Error Handling: Include the Request ID and Correlation ID when logging errors or exceptions. This will help in debugging issues more effectively.
- Support Communication: When contacting Straddle support about a specific API request, always include the Request ID and Correlation ID (if applicable).