CURL

From Chorke Wiki
Jump to navigation Jump to search
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