Sunday 18 August 2019

HTTPie: Redirect response to a file


You can redirect response to a file using ‘>’ operator.

$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 11:59:26 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": "Bikash",
        "id": 1,
        "lastName": "Prakash"
    },
    {
        "firstName": "rashika",
        "id": 6,
        "lastName": "gun"
    }
]


Let’s redirect all the guests data to allGuests.json.

$http  http://localhost:8080/public/v1/guests/ > allGuests.json
$
$cat allGuests.json 
[{"id":1,"firstName":"Bikash","lastName":"Prakash"},{"id":6,"firstName":"rashika","lastName":"gun"}]



Previous                                                    Next                                                    Home

No comments:

Post a Comment