A worked example, rendered from real sample data. Sign in to run the tool on your own input.
curl -X POST 'https://api.example.com/users' -H 'Content-Type: application/json' -H 'Authorization: Bearer token123' -d '{"name":"Ada","email":"ada@example.com"}'const response = await fetch("https://api.example.com/users", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer token123"
},
body: "{",
});
const data = await response.json();
Convert a curl command into a JS fetch() call. Part of the DevTools Surf developer suite. Browse more tools in the Developer Utilities collection.