Home > Mobile >  How can I create request ID in POST API and log it
How can I create request ID in POST API and log it

Time:09-22

As title mentions: How can I create request ID in POST API and log it

I am sending POST request to API and getting response but API do not reply any request ID, is there a way I can have request ID that I can generate after sending POST & log in a txt file for reference in case anytime request is not processed I can send request ID to API owner and get response file for my request ID

CodePudding user response:

You can generate your own unique ID for each request and then save the ID and the request in a file or database on your end so that on a failed request you can repeat later, that may be a reasonable strategy depending on your situation.

But, a request ID that you create is never going to mean anything to the API owner unless they are doing something on their end to save it, so most likely you can't send them an arbitrary ID you generated and expect them to be able to link it up later. You don't even have any way of knowing if they're saving responses on their end, if a request id isn't exposed. I think it would be best to handle failed requests on your end by repeating them, if possible.

  • Related