A worked example, rendered from real sample data. Sign in to run the tool on your own input.
language=javascript
curl -X GET https://api.example.com/users -H "Authorization: Bearer token123" -H "Accept: application/json"fetch('https://api.example.com/users', {
method: 'GET',
headers: {
'Authorization': 'Bearer token123',
'Accept': 'application/json'
}
})
.then(res => res.json())
.then(data => console.log(data))
.catch(err => console.error(err));
Convert cURL commands to code in JavaScript, Python, Go with formatting options. Part of the DevTools Surf developer suite. Browse more tools in the API / Config collection.