Here is my mand:
curl -H 'API-Key: EXAMPLE' --data 'SUBID=576965' --data 'label=example'
I have tried
fetch(";, {
method: "POST",
headers: {
"API-Key":"EXAMPLE"
},
data: "SUBID=576965&label=example",
})
and many others, but none of them worked.
Here is my mand:
curl -H 'API-Key: EXAMPLE' https://api.vultr./v1/server/label_set --data 'SUBID=576965' --data 'label=example'
I have tried
fetch("https://api.vultr./v1/server/label_set", {
method: "POST",
headers: {
"API-Key":"EXAMPLE"
},
data: "SUBID=576965&label=example",
})
and many others, but none of them worked.
Share Improve this question edited Sep 7, 2022 at 8:39 user3064538 asked Jun 22, 2016 at 13:41 Zhaoyu ZHONGZhaoyu ZHONG 1331 gold badge1 silver badge9 bronze badges2 Answers
Reset to default 11You could try this tool: https://kigiri.github.io/fetch/
Source on github: https://github./kigiri/fetch
Output:
fetch("https://api.vultr./v1/server/label_set", {
body: "SUBID=576965&label=example",
header: {
"API-Key": "EXAMPLE",
"Content-Type": "application/x-www-form-urlencoded"
}
})
You can use curlconverter./javascript/. It converts your mand to
fetch('https://api.vultr./v1/server/label_set', {
method: 'POST',
headers: {
'API-Key': 'EXAMPLE'
},
body: new URLSearchParams({
'SUBID': '576965',
'label': 'example'
})
});