How to convert a curl command to fetch()?
<p>Here is my command:</p>
<pre class="lang-bash prettyprint-override"><code>curl -H 'API-Key: EXAMPLE' https://api.vultr.com/v1/server/label_set --data 'SUBID=576965' --data 'label=example'
</code></pre>
<p>I have tried</p>
<pre class="lang-js prettyprint-override"><code>fetch(&quot;https://api.vultr.com/v1/server/label_set&quot;, {
    method: &quot;POST&quot;,
    headers: {
        &quot;API-Key&quot;:&quot;EXAMPLE&quot;
    },
    data: &quot;SUBID=576965&amp;label=example&quot;,
})
</code></pre>
<p>and many others, but none of them worked.</p>