Last active
February 28, 2022 21:24
-
-
Save carymrobbins/ff88a97c23b40e4c74597d72e6bab67b to your computer and use it in GitHub Desktop.
Example curl to send a POST request with URL-encoded query params and a request body
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% curl \ | |
-XPOST https://httpbin.org/post \ | |
-G \ | |
--data-urlencode foo=bar \ | |
--data-urlencode baz=quux \ | |
-T <(echo -n '{"spam": "eggs"}') | |
{ | |
"args": { | |
"baz": "quux", | |
"foo": "bar" | |
}, | |
"data": "{\"spam\": \"eggs\"}", | |
"files": {}, | |
"form": {}, | |
"headers": { | |
"Accept": "*/*", | |
"Host": "httpbin.org", | |
}, | |
"json": { | |
"spam": "eggs" | |
}, | |
"url": "https://httpbin.org/post?foo=bar&baz=quux" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment