|
## cURL |
|
|
|
# GET \ |
|
curl -i -X GET http://localhost:5000/api/products \ |
|
-H "Content-Type: application/json" \ |
|
-H "Accept: application/json" \ |
|
-H "Accept-Language: en" \ |
|
-H "Accept-Encoding: gzip" \ |
|
|
|
# GET |
|
curl -i -X GET http://localhost:5000/api/products/54a8391e64cc0b994d57ba63 \ |
|
-H "Content-Type: application/json" \ |
|
-H "Accept: application/json" \ |
|
-H "Accept-Language: en" \ |
|
-H "Accept-Encoding: gzip" \ |
|
|
|
#PUT |
|
curl -i -X PUT http://localhost:5000/api/products/54a8391e64cc0b994d57ba63 \ |
|
-H "Content-Type: application/json" \ |
|
-H "Accept: application/json" \ |
|
-H "Accept-Language: en" \ |
|
-H "Accept-Encoding: gzip" \ |
|
-d "{\ |
|
\"price\": 21\ |
|
}" \ |
|
|
|
# POST |
|
curl -i -X POST http://localhost:5000/api/products \ |
|
-H "Content-Type: application/json" \ |
|
-H "Accept: application/json" \ |
|
-H "Accept-Language: en" \ |
|
-H "Accept-Encoding: gzip" \ |
|
-d "{\ |
|
\"name\":\"My product\",\ |
|
\"sku\":\"ASDF1234\",\ |
|
\"price\": 32.50\ |
|
}" \ |
|
|
|
# DELETE |
|
curl -i -X DELETE http://localhost:5000/api/products/54a8391e64cc0b994d57ba63 \ |
|
-H "Content-Type: application/json" \ |
|
-H "Accept: application/json" \ |
|
-H "Accept-Language: en" \ |
|
-H "Accept-Encoding: gzip" \ |
|
|
|
### Authorisation |
|
#### NTLM |
|
|
|
curl --negotiate -u : -b ~/cookie.tmp -c ~/cookie.tmp -ik -X POST https://example.com/Authentication?login=true |
|
curl --ntlm -u {DOMAIN}\\{login}:{pass} -b ~/cookie.tmp -c ~/cookie.tmp -ik -X POST https://example.com/service \ |
|
-H "Content-Type: text/xml" \ |
|
-H "Accept: text/xml" \ |
|
-H "Accept-Language: en" \ |
|
# ... |
|
|
|
|
|
# curl |
|
# -c, --cookie-jar FILE Write cookies to FILE after operation (H) |
|
# --negotiate Use HTTP Negotiate (SPNEGO) authentication (H) |
|
# --ntlm Use HTTP NTLM authentication (H) |
|
# -d, --data DATA HTTP POST data (H) |
|
# -H, --header LINE Pass custom header LINE to server (H) |
|
# -k, --insecure Allow connections to SSL sites without certs (H) |
|
# -i, --include Include protocol headers in the output (H/F) |