Buy commercial curl support. We
help you work out your issues, debug your libcurl applications, use the API,
port to new platforms, add new features and more. With a team lead by the
curl founder Daniel himself.
Re: How to dynamically generate UUID in curl command (like macros) before sending http request?
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Timothe Litt <litt_at_acm.org>
Date: Fri, 24 May 2024 14:52:20 -0400
What OS?
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.
Timothe Litt
ACM Distinguished Engineer
--------------------------
This communication may not represent the ACM or my employer's views,
if any, on the matters discussed.
On 24-May-24 13:46, Евгений Морозов via curl-users wrote:
> I want to send POST http request via curl in Windows command line app.
> There is *x-client-request-id* header in request
> I want to create curl command that dynamically generate UUID for this
> header
>
> Something like that:
> curl -X POST -H "x-client-request-id: {{UUID}}" -d '{"a": 1}'
> https:/example.com <http://example.com>
>
> This doesn't work:
> ${uuid}
> {{$uuid}}
>
>
> --
> James Frost
>
Received on 2024-05-24
Date: Fri, 24 May 2024 14:52:20 -0400
What OS?
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.
Timothe Litt
ACM Distinguished Engineer
--------------------------
This communication may not represent the ACM or my employer's views,
if any, on the matters discussed.
On 24-May-24 13:46, Евгений Морозов via curl-users wrote:
> I want to send POST http request via curl in Windows command line app.
> There is *x-client-request-id* header in request
> I want to create curl command that dynamically generate UUID for this
> header
>
> Something like that:
> curl -X POST -H "x-client-request-id: {{UUID}}" -d '{"a": 1}'
> https:/example.com <http://example.com>
>
> This doesn't work:
> ${uuid}
> {{$uuid}}
>
>
> --
> James Frost
>
-- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users Etiquette: https://curl.se/mail/etiquette.html
- application/pgp-signature attachment: OpenPGP digital signature