{"category":"web","endpoint":"https://setget.net/v1/tools/http-request-build","examples":[{"input":{"body":"{\"name\": \"Sam's\"}","headers":{"Content-Type":"application/json"},"method":"post","url":"https://api.example.com/items"},"output":{"curl":"curl -X POST 'https://api.example.com/items' \\\n  -H 'Content-Type: application/json' \\\n  --data-raw '{\"name\": \"Sam'\\''s\"}'","javascript":"const response = await fetch(\"https://api.example.com/items\", {\n  method: \"POST\",\n  headers: {\n    \"Content-Type\": \"application/json\"\n  },\n  body: \"{\\\"name\\\": \\\"Sam's\\\"}\"\n});\nconsole.log(response.status);\nconsole.log(await response.text());","python":"import requests\n\nresponse = requests.request(\n    'POST',\n    'https://api.example.com/items',\n    headers={\n        'Content-Type': 'application/json',\n    },\n    data='{\"name\": \"Sam\\'s\"}',\n)\nprint(response.status_code)\nprint(response.text)"}},{"input":{"url":"https://example.com/health"},"output":{"curl":"curl 'https://example.com/health'","javascript":"const response = await fetch(\"https://example.com/health\", {\n  method: \"GET\"\n});\nconsole.log(response.status);\nconsole.log(await response.text());","python":"import requests\n\nresponse = requests.request(\n    'GET',\n    'https://example.com/health',\n)\nprint(response.status_code)\nprint(response.text)"},"title":"A plain GET"}],"input_schema":{"additionalProperties":false,"properties":{"body":{"description":"The request body, exactly as it should be sent.","examples":["{\"name\": \"Sam\"}"],"type":"string"},"headers":{"description":"Request headers as a JSON object of names and values.","examples":[{"Content-Type":"application/json"}]},"method":{"default":"GET","description":"The HTTP method.","examples":["POST"],"maxLength":20,"type":"string"},"url":{"description":"The address to request.","examples":["https://api.example.com/items"],"maxLength":8192,"type":"string"}},"required":["url"],"type":"object"},"keywords":["http request","curl generator","fetch code","python requests","api call","code snippet","build curl","rest client"],"related":["curl-to-json","http-status","http-headers-parse","url-parse"],"slug":"http-request-build","summary":"Turn a method, URL, headers and body into ready-to-run curl, Python requests and JavaScript fetch code.","tier":"inline","title":"HTTP request code builder","url":"https://setget.net/tools/http-request-build"}
