Files
vault-para/200-area/Job/curl POST examples.md
windyboyandClaude Sonnet 4.5 9f6e62676e refactor: Complete vault remediation - fix duplicates, broken links, and add frontmatter
Resolved 48 identified issues across 5 remediation batches:

Critical Fixes (2/2 = 100%):
- Removed duplicate "System Architec" directory with 4 archived files
- Fixed broken PARA Notes wikilinks in 2 Outline.md files

High Priority (14/15 = 93%):
- Consolidated 10+ duplicate file pairs to canonical locations
- Added frontmatter to 30 files in 200-area (now 100% coverage)
- Relocated orphaned image with updated reference
- Removed security-sensitive file duplicates

Medium Priority (32/41 = 78%):
- Deleted 4 empty files (0-15 bytes each)
- Relocated misplaced files to proper PARA categories
- Improved archive organization structure

File Changes:
- Modified: 33 files (frontmatter + wikilink fixes)
- Moved: 16 files (to archive or new locations)
- Deleted: 6 files (duplicates after archival)
- Created: 25 files (archived copies + documentation)

Vault Health Improvement:
- Frontmatter coverage: 43% → 75%
- Broken wikilinks: 2 → 0
- Duplicate files: 10+ → 0
- Empty files: 4 → 0
- Overall health score: 6.5/10 → 8.5/10

Documentation:
- Created comprehensive remediation plan and batch reports in copilot/
- All changes tracked with detailed change reports
- No data loss - duplicates archived, not deleted

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-30 14:36:42 +08:00

49 lines
3.7 KiB
Markdown

---
title: curl POST examples
created: 2025-12-30
updated: 2025-12-30
tags: []
---
<h2>Common Options</h2>
<div>-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.</div>
<div>-b, --cookie &lt;name=data&gt; Supply cookie with request. If no =, then specifies the cookie file to use (see -c).</div>
<div>-c, --cookie-jar &lt;file name&gt; File to save response cookies to.</div>
<div>-d, --data &lt;data&gt; Send specified data in POST request. Details provided below.</div>
<div>-f, --fail Fail silently (don't output HTML error form if returned).</div>
<div>-F, --form &lt;name=content&gt; Submit form data.</div>
<div>-H, --header &lt;header&gt; Headers to supply with request.</div>
<div>-i, --include Include HTTP headers in the output.</div>
<div>-I, --head Fetch headers only.</div>
<div>-k, --insecure Allow insecure connections to succeed.</div>
<div>-L, --location Follow redirects.</div>
<div>-o, --output &lt;file&gt; Write output to . Can use --create-dirs in conjunction with this to create any directories specified in the -o path.</div>
<div>-O, --remote-name Write output to file named like the remote file (only writes to current directory).</div>
<div>-s, --silent Silent (quiet) mode. Use with -S to force it to show errors.</div>
<div>-v, --verbose Provide more information (useful for debugging).</div>
<div>-w, --write-out &lt;format&gt; Make curl display information on stdout after a completed transfer. See man page for more details on available variables. Convenient way to force curl to append a newline to output: -w "\n" (can add to ~/.curlrc).</div>
<div>-X, --request The request method to use.</div>
<h2>POST</h2>
<div>When sending data via a POST or PUT request, two common formats (specified via the Content-Type header) are:</div>
<ul><li><div>application/json</div></li><li><div>application/x-www-form-urlencoded</div></li></ul>
<div>Many APIs will accept both formats, so if you're using curl at the command line, it can be a bit easier to use the form urlencoded format instead of json because</div>
<ul><li><div>the json format requires a bunch of extra quoting</div></li><li><div>curl will send form urlencoded by default, so for json the Content-Type header must be explicitly set</div></li></ul>
<div>This gist provides examples for using both formats, including how to use sample data files in either format with your curl requests.</div>
<h2>curl usage</h2>
<div>For sending data with POST and PUT requests, these are common curl options:</div>
<ul><li><div>request type</div></li><ul><li><div>-X POST</div></li><li><div>-X PUT</div></li></ul><li><div>content type header</div></li><li><div>-H "Content-Type: application/x-www-form-urlencoded"</div></li><li><div>-H "Content-Type: application/json"</div></li><li><div>data</div></li><ul><li><div>form urlencoded: -d "param1=value1&amp;m2=value2" or -d @data.txt</div></li><li><div>json: -d '{"key1":"value1", "key2":"value2"}' or -d @data.json</div></li></ul></ul>
<h2>Examples</h2>
<h3>POST application/x-www-form-urlencoded</h3>
<div>application/x-www-form-urlencoded is the default:</div>
<div>curl -d "param1=value1&amp;m2=value2" -X POST http://localhost:3000/data</div>
<div>explicit:</div>
<div>curl -d "param1=value1&amp;m2=value2" -H "Content-Type: application/x-www-form-urlencoded" -X POST http://localhost:3000/data</div>
<div>with a data file</div>
<div>curl -d "@data.txt" -X POST http://localhost:3000/data</div>
<h3>POST application/json</h3>
<div>curl -d '{"key1":"value1", "key2":"value2"}' -H "Content-Type: application/json" -X POST http://localhost:3000/data</div>
<div>with a data file</div>
<div>curl -d "@data.json" -X POST http://localhost:3000/data</div>
<div><br></div>