Re: How to dynamically generate UUID in curl command (like macros) before sending http request?
Ray Satiro via curl-users <[email protected]>
| Newsgroups | gmane.comp.web.curl.general |
|---|---|
| Message-ID | <[email protected]> |
On 5/24/2024 2:52 PM, Timothe Litt via curl-users wrote:
>
> On most Linux/Unix, use uuidgen.
>
> curl -X POST -H "x-client-request-id: {$(uuidgen)}" -d '{"a": 1}'
> https:/example.com <http://example.com>
>
> If you need it for subsequent requests, use
>
> UUID="{$(uuidgen)}"
>
> curl -X POST -H "x-client-request-id: ${UUID}" -d '{"a": 1}'
> https:/example.com <http://example.com>
>
> and insert $UUID in the cookie/uri/whatever you need for those requests.
>
Some uuidgen will not be really random unless you use uuidgen -r I
think. Also, this guy asked the same question in the discussions
section. [1]
[1]: https://github.com/curl/curl/discussions/13768
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette: https://curl.se/mail/etiquette.html