Here is the example.
curl -H 'API-Key: EXAMPLE' https://api.vultr.com/v1/server/label_set --data 'SUBID=576965' --data 'label=example'
I have tried:
fetch("https://api.vultr.com/v1/server/label_set",{
        method:"POST",
        headers:{
            "API-Key":"EXAMPLE"
        },
        data:"SUBID=576965&label=example",
    })
and tried many others, but none of them worked.
Thanks.
To make a GET request using Curl, run the curl command followed by the target URL. Curl automatically selects the HTTP GET request method unless you use the -X, --request, or -d command-line option.
What Is the curl Command? curl (short for "Client URL") is a command line tool that enables data transfer over various network protocols. It communicates with a web or application server by specifying a relevant URL and the data that need to be sent or received.
You could try this tool: https://kigiri.github.io/fetch/
Source on github: https://github.com/kigiri/fetch
Output:
fetch("https://api.vultr.com/v1/server/label_set", {
       body: "SUBID=576965&label=example",
       header: {
       "API-Key": "EXAMPLE",
       "Content-Type": "application/x-www-form-urlencoded"
   }
})
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With