CURL: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 1: Line 1:
  sudo apt update
  sudo apt update
  sudo apt install curl && curl --version
  sudo apt install curl && curl --version
==Playground==
{|
| valign="top" |
<syntaxhighlight lang="bash">
# post request body
time cat <<< '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'| curl http://127.0.0.1:1983/v1/collections\
-H 'x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b'\
-H 'Content-Type:application/json'\
--data @-
</syntaxhighlight>
| valign="top" |
<syntaxhighlight lang="bash">
# post request body
time curl http://127.0.0.1:1983/v1/collections\
-H 'x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b'\
-H 'Content-Type:application/json'\
--data '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'
</syntaxhighlight>
|-
| colspan="3" |
----
|-
| valign="top" |
<syntaxhighlight lang="bash">
# put request body
time cat <<< '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'| curl http://127.0.0.1:1983/v1/collections\
-H 'x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b'\
-H 'Content-Type:application/json'\
-X PUT \
--data @-
</syntaxhighlight>
| valign="top" |
<syntaxhighlight lang="bash">
# put request body
time curl http://127.0.0.1:1983/v1/collections\
-H 'x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b'\
-H 'Content-Type:application/json'\
-X PUT \
--data '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'
</syntaxhighlight>
|-
| colspan="3" |
----
|-
| valign="top" |
<syntaxhighlight lang="bash">
# delete response body
time cat <<< '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'| curl http://127.0.0.1:1983/v1/collections\
-H 'x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b'\
-H 'Content-Type:application/json'\
-X DELETE \
--data @-
</syntaxhighlight>
| valign="top" |
<syntaxhighlight lang="bash">
# delete response body
time curl http://127.0.0.1:1983/v1/collections\
-H 'x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b'\
-H 'Content-Type:application/json'\
-X DELETE \
--data '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'
</syntaxhighlight>
|-
| colspan="3" |
----
|-
| valign="top" |
time curl http://127.0.0.1:1983/v1/collections
time curl https://cdn.chorke.org/exec/cli/
curl --version
curl --help
| valign="top" |
|}


==References==
==References==

Revision as of 02:28, 20 April 2024

sudo apt update
sudo apt install curl && curl --version

Playground

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

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

# delete response body
time cat <<< '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'| curl http://127.0.0.1:1983/v1/collections\
 -H 'x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b'\
 -H 'Content-Type:application/json'\
 -X DELETE \
 --data @-
# delete response body
time curl http://127.0.0.1:1983/v1/collections\
 -H 'x-auth-key:aeda11fd-14ea-44d0-aff6-e94bf6b78c1b'\
 -H 'Content-Type:application/json'\
 -X DELETE \
 --data '{
    "code": "M",
    "name": "Male",
    "group": "gender",
    "properties": {},
    "extendedProperties": {}
}'

time curl http://127.0.0.1:1983/v1/collections
time curl https://cdn.chorke.org/exec/cli/
curl --version
curl --help

References