Syntax
http PUT
{url} key1:value1 key2:valu2….keyN:valueN
Example
Above request
is equivalent to below one.
PUT
/public/v1/guests/ HTTP/1.1
Accept:
application/json, */*
Accept-Encoding:
gzip, deflate
Connection:
keep-alive
Content-Length:
43
Content-Type:
application/json
Host:
localhost:8080
User-Agent:
HTTPie/1.0.2
{
"id": 1,
"firstName": "Siva",
"lastName": "Nzv"
}
Create a
guest
$http POST http://localhost:8080/public/v1/guests/ firstName=krishna lastName=maj
HTTP/1.1 200
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json;charset=UTF-8
Date: Fri, 02 Aug 2019 11:41:07 GMT
Expires: 0
Pragma: no-cache
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
{
"firstName": "krishna",
"id": 5,
"lastName": "maj"
}
Get the
Guest by id
$http GET http://localhost:8080/public/v1/guests/5
HTTP/1.1 200
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json;charset=UTF-8
Date: Fri, 02 Aug 2019 11:41:55 GMT
Expires: 0
Pragma: no-cache
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
{
"firstName": "krishna",
"id": 5,
"lastName": "maj"
}
Update the
guest with id 5
$http PUT http://localhost:8080/public/v1/guests/ id=5 firstName=Siva lastName=Nzv
HTTP/1.1 200
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json;charset=UTF-8
Date: Fri, 02 Aug 2019 11:44:04 GMT
Expires: 0
Pragma: no-cache
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
{
"firstName": "Siva",
"id": 5,
"lastName": "Nzv"
}
$
$http GET http://localhost:8080/public/v1/guests/5
HTTP/1.1 200
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json;charset=UTF-8
Date: Fri, 02 Aug 2019 11:44:09 GMT
Expires: 0
Pragma: no-cache
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
{
"firstName": "Siva",
"id": 5,
"lastName": "Nzv"
}
No comments:
Post a Comment