Instant multi‑lang HTTP request code tailored to your API call details:
Input:
URL: https://api.example.com/items
Method: PATCH
Query: {"verbose":true}
Auth: Basic (user/pass)
Headers: {"X-Trace-Id":"abc"}
Body: {"name":"New"}
Indent: 2
Languages: cURL, Python, PHP
Output cURL:
curl -X PATCH -H "X-Trace-Id: abc" -H "Authorization: Basic " "https://api.example.com/items?verbose=True" \
-d '{"name":"New"}'
Output Python:
import requests
response = requests.patch(
'https://api.example.com/items?verbose=True',
headers={
'X-Trace-Id': 'abc',
'Authorization': 'Basic {{ credentials }}',
},
json={
"name": "New"
},
)
print(response.status_code, response.text)
Output JavaScript:
fetch('https://api.example.com/items?verbose=True', {
method: 'PATCH',
headers: {
'X-Trace-Id': 'abc',
'Authorization': 'Basic {{ credentials }}',
},
body: JSON.stringify({
"name": "New"
}),
})
.then(res => res.json())
.then(data => console.log(data));