Sunday 18 August 2019

HTTPie: Pass query string parameters

Use param==value syntax to pass query parameters.

Find all Guests
$http http://localhost:8080/public/v1/guests/
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 12:07:00 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": "rashika",
        "id": 5,
        "lastName": "gurram"
    },
    {
        "firstName": "ram",
        "id": 6,
        "lastName": "gurram"
    },
    {
        "firstName": "ram",
        "id": 7,
        "lastName": "ponnam"
    }
]


Get all the guests whose firstName is ram

$http GET http://localhost:8080/public/v1/guests firstName==ram
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 12:09:59 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": "ram",
        "id": 6,
        "lastName": "gurram"
    },
    {
        "firstName": "ram",
        "id": 7,
        "lastName": "ponnam"
    }
]



Previous                                                    Next                                                    Home

No comments:

Post a Comment