CURL: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 168: Line 168:
| valign="top" |
| valign="top" |
* [[HTTPie]]
* [[HTTPie]]
* [[Locale]]
* [[Flask]]
* [[Flask]]



Revision as of 19:26, 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