HTTPie: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
Line 8: Line 8:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# post request body
# post request body
time http 127.0.0.1:1983/v1/collections\
time http 127.0.0.1:1983/api/v1/collections\
  x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
  x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
  Content-Type:application/json\
  Content-Type:application/json\
Line 23: Line 23:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# post request body
# post request body
time http 127.0.0.1:1983/v1/collections\
time http 127.0.0.1:1983/api/v1/collections\
  x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
  x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
  Content-Type:application/json\
  Content-Type:application/json\
Line 42: Line 42:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# put request body
# put request body
time http PUT 127.0.0.1:1983/v1/collections/1000\
time http PUT 127.0.0.1:1983/api/v1/collections/1000\
  x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
  x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
  Content-Type:application/json\
  Content-Type:application/json\
Line 57: Line 57:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# put request body
# put request body
time http PUT 127.0.0.1:1983/v1/collections/1000\
time http PUT 127.0.0.1:1983/api/v1/collections/1000\
  x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
  x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
  Content-Type:application/json\
  Content-Type:application/json\
Line 76: Line 76:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# show response body
# show response body
time http 127.0.0.1:1983/v1/collections\
time http 127.0.0.1:1983/api/v1/collections\
  x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
  x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
  Content-Type:application/json\
  Content-Type:application/json\
Line 92: Line 92:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
# show response body
# show response body
time http 127.0.0.1:1983/v1/collections\
time http 127.0.0.1:1983/api/v1/collections\
  x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
  x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
  Content-Type:application/json\
  Content-Type:application/json\

Revision as of 22:24, 20 April 2024

choco install httpie
brew  install httpie
snap  install httpie

Playground

# post request body
time http 127.0.0.1:1983/api/v1/collections\
 x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
 Content-Type:application/json\
 <<< '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'
# post request body
time http 127.0.0.1:1983/api/v1/collections\
 x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
 Content-Type:application/json\
 --raw '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'

# put request body
time http PUT 127.0.0.1:1983/api/v1/collections/1000\
 x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
 Content-Type:application/json\
 <<< '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'
# put request body
time http PUT 127.0.0.1:1983/api/v1/collections/1000\
 x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
 Content-Type:application/json\
 --raw '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'

# show response body
time http 127.0.0.1:1983/api/v1/collections\
 x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
 Content-Type:application/json\
 -b\
 <<< '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'
# show response body
time http 127.0.0.1:1983/api/v1/collections\
 x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b\
 Content-Type:application/json\
 -b\
 --raw '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'

http https://cdn.chorke.org/bash/java/pull
http https://cdn.chorke.org/exec/cli/
http --version
http --help

References