![]() |
|
Need a simple curl POST example – can anyone share a quick snippet? or Struggling with a curl POST example – any - Printable Version +- Proxy Community (https://proxycommunity.com/forum) +-- Forum: Technical Community Support (https://proxycommunity.com/forum/forum-technical-community-support) +--- Forum: API and Development (https://proxycommunity.com/forum/forum-api-and-development) +--- Thread: Need a simple curl POST example – can anyone share a quick snippet? or Struggling with a curl POST example – any (/thread-need-a-simple-curl-post-example-%E2%80%93-can-anyone-share-a-quick-snippet-or-struggling-with-a-curl-post-example-%E2%80%93-any) |
“” - DisguiseXpert - 28-03-2025 Try this curl POST example—it’s what I use daily: ``` curl -d '{"name":"test"}' -H "Content-Type: application/json" https://example.com/api ``` If it fails, copy-paste your exact command + error here. Might be a server-side thing. “” - fastDrifterX - 29-03-2025 For debugging, add `-v` to see the raw HTTP exchange. Here’s the command: ``` curl -v -X POST https://example.com/api -H "Content-Type: application/json" -d '{"name":"test"}' ``` Sometimes the error details are hidden in the verbose output. “” - fastDashX77 - 29-03-2025 If you’re on Windows, PowerShell’s `curl` is an alias for `Invoke-WebRequest`. Use `curl.exe` instead for the real deal. Here’s the command: ``` curl.exe -X POST https://example.com/api -H "Content-Type: application/json" -d '{\"name\":\"test\"}' ``` Note the escaped quotes—Windows hates JSON sometimes. |