Sadie
Sadie

Reputation: 35

How can I send this POST request with cURL?

Here is the HTML code

<form method="POST" action="https://testnet.demo.example.org/api/v1/invoices">
      <input type="hidden" name="storeId" value="LLKZz9dtP7DYvEUDq73K59EKvjMWox7nvnUhfCGMKsux" />
      <input type="hidden" name="price" value="10" />
      <input type="hidden" name="currency" value="USD" />
      <input type="image" class="submit" name="submit">
    </form>

When I click the "submit" button, it redirects me to a random url like this,

https://testnet.demo.example.org/invoice?id=KuVFG7YFmfArccjkmBPhyg

How can I send this POST request using command line using cURL and get that random invoice url?

Upvotes: 0

Views: 10588

Answers (1)

Whatatimetobealive
Whatatimetobealive

Reputation: 1353

Here is the command:

curl --verbose  --request "POST" "https://testnet.demo.example.org/api/v1/invoices?storeId=LLKZz9dtP7DYvEUDq73K59EKvjMWox7nvnUhfCGMKsux&price=10&currency=USD"

You can always use tools like this curl-builder, but I highly suggest to use tools like Postman to make api calls.

Upvotes: 1

Related Questions