When designing a REST API
, what is the best practice for adding a unique request identifier
when performing an http request?
I would normally add it in the headers as x-request-id
, but today heard someone mention adding it in the url as a query string!
Also after doing some research, it seems like some people add it in the response body and send it as part of the payload!
Out of these three which would be the best application of a unique request identifier
and why? What are the possible pros and cons of each approach?