If you are developing a QuickBooks Online integation, the RequestID uniquely identifies the HTTP request sent from the app to the service and enables the app to correlate requests and responses, in case the app needs to resend a request because of a dropped connection.
We strongly recommend all developers to send in the RequestID for every API request so that idempotency is guaranteed and we are able to replay the request back to you without any state changes in the event of a service disruption. This also ensures that data is not duplicated in the event of a disruption.
In the request, the app specifies the RequestID as a query string parameter. If the service receives another request with the same RequestID, instead of performing the operation again or returning an error, the service sends the same response as it did for the original request.
- The RequestID your app specifies as the query parameter must be unique for all requests for a given company.
- The RequestID can have a maximum of 50 characters for all operations except batch.
- For batch operations, the RequestID supports a maximum of 36 characters. For each batch ID, only 10 characters are allowed when RequestID is also specified.
- To avoid duplicate IDs, the app is responsible for generating a unique ID for each request. It is recommended to generate requestid values with a library such as java.util.UUID or .NET System.GUID.
The following scenario shows how an app might use the RequestID in a create operation:
- The app sends a request to create an invoice, specifying the RequestID 4957: baseURL/company/1234/invoice?requestid=4957
- The service processes the request to create the invoice.
- The app loses its connection and does not receive the response.
- The app sends the request to create the invoice again, specifying the same content and requestid as the first request.
- The service determines that the RequestID has been sent before, so it sends the same response as in step 2. (If the app had not specified a RequestID, the service would create a duplicate invoice with a new entity ID.)
- The app receives the response and verifies that it contains no errors.
Advantages of using RequestID
The following two sequence diagrams depict the advantages of using RequestID and disadvantages of not using RequestID.
Leave a Reply