How to retrieve Session key from Skyscanner API post request - Ruby

烂漫一生 提交于 2019-12-05 22:50:39

As per the doc:

A successful response contains no content. The URL to poll the booking details is specified in the Location header of the response

so try this:

sessionkey_request["location"]

I have test it on my system and it returns me:

http://partners.api.skyscanner.net/apiservices/pricing/v1.0/8e28260becd3441ca4e865396e224e7d_ecilpojl_EC71481935CEBB7EAF661BC24940D01D

last part is your sessionKey which you can use for GET request. If you want only last part(sessionKey) then you can retrieved it by:

 > url = "http://partners.api.skyscanner.net/apiservices/pricing/v1.0/8e28260becd3441ca4e865396e224e7d_ecilpojl_EC71481935CEBB7EAF661BC24940D01D"
 > url.split('/').last
 => "8e28260becd3441ca4e865396e224e7d_ecilpojl_EC71481935CEBB7EAF661BC24940D01D" 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!