DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1
{"args":{"test":"123"},"headers":{"x-forwarded-
proto":"https","host":"postman-
echo.com","accept":"*/*","user-
agent":"curl/7.54.0","x-forward-
ed-port":"443"},"url":"https://postman-
echo.com/get?test=123"}

Example 7-8 shows how to use curl to call a simple POST
request.


Example 7-8 Sample HTTP POST Using curl

Click here to view code image


$ curl -sD - -X POST https://postman-
echo.com/post -H 'cache-control: no-cache'
-H 'content-type: text/plain' -d 'hello
DevNet'
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 27 Aug 2019 05:16:58 GMT
ETag: W/"13a-0lMLfkxl7vDVWfb06pyVxdZlaug"
Server: nginx
set-cookie:
sails.sid=s%3AwiFXmSNJpzY0ONduxUCAE8IodwNg9Z2Y.j%2BJ5%2BOmch8XEq8jO1vzH8
kjNBi8ecJij1rGT8D1nBhE; Path=/; HttpOnly
Vary: Accept-Encoding
Content-Length: 314
Connection: keep-alive
{"args":{},"data":"hello DevNet","files":
{},"form":{},"headers":{"x-forwarded-
proto":"https","host":"postman-
echo.com","content-
length":"12","accept":"*/*","ca
che-control":"no-cache","content-
type":"text/plain","user-
agent":"curl/7.54.0","x-
forwarded-
port":"443"},"json":null,"url":"https://postman-
echo.com/post"}

Example 7-9 shows how to use curl to call a simple GET
request with Basic Auth sent via the header.

Free download pdf