Content Encoding

API Documentation / Content Encoding

How to compress the content of the response body

If you are connected with a mobile app or you are initially synchronising all reservations for a hotel chain to your system using the DataExtract API, sometimes bandwidth still counts nowadays. The hetras API allows you to also get the response in gzip format. You just need to set the Accept-Encoding header to gzip and you done.

The following example shows how you could request a specific booking using the demo application credentials in a compressed form.

Get compressed response for a specific booking

$ curl -v -X GET --header "Accept: application/json" --header "Accept-Encoding: gzip" --header "App-Id: 4a939f04" --header "App-Key: 1e0a955a6b03781bd601e693b0ba6f4d" "https://api.hetras-certification.net/api/booking/v0/bookings/041894"

Request

> GET /api/booking/v0/bookings/041894 HTTP/1.1
> User-Agent: curl/7.35.0
> Host: api.hetras-certification.net
> Accept: application/json
> Accept-Encoding: gzip
> App-Id: 4a939f04
> App-Key: 1e0a955a6b03781bd601e693b0ba6f4d

Response

< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Cache-Control: no-cache
< Content-Encoding: gzip
< Content-Type: application/json; charset=utf-8
< Date: Tue, 31 May 2016 14:06:58 GMT
< Expires: -1
< Hetras-Processing-Time: 28ms
< Hetras-Tracking-Id: 1d04c41fba94456db17798936d608920
< Pragma: no-cache
< Content-Length: 1096
< Connection: keep-alive

Response in zipped format