in reply to curl url request

You should compare what curl sends with what you send.

Invoke curl with -v -v -v to see what it sends over the wire.

Look at that.

Look at your script and the parameters you give it, and look at the API documentation for the API.

When I run your code through my Curl to Perl converter, I get the following:

#!perl use strict; use warnings; use HTTP::Tiny; my $ua = HTTP::Tiny->new( 'verify_SSL' => '1' ); my $res = $ua->request( 'POST' => 'https://api.link.io/v1/payment', { headers => { 'Accept' => '*/*', 'User-Agent' => 'curl/7.55.1', 'Content-Length' => '196', 'Content-Type' => 'application/json', 'X-Api-Key' => '{{api-key}}' }, content => "{ \x22price_amount\x22: 3999.5, \x22price_currency\x22: \x22usd\x22 +, \x22pay_currency\x22: \x22usd\x22, \x22ipn_callback_url\x22: \x22 +https://link.io\x22, \x22order_id\x22: \x22RGDBP-21314\x22, \x22ord +er_description\x22: \x22Apple Macbook Pro 2019 x 1\x22}" }, );

Most likely, the API does not want {{ABCDEF}} but ABCDEF in its x-api-key header.

Replies are listed 'Best First'.
Re^2: curl url request
by The_Dj (Scribe) on May 28, 2024 at 06:49 UTC
    I concur with this advise.

    I've chased this sort of thing before and it almost always comes down to some header tha nothing says is relevant.
    Typically the User-Agent, but YMMV