我第一次使用带有机器人框架的Library HttpLibrary.HTTP。
我的api网址类似于:
https://www.app.com:8080/rest/api/customer/phone/personnalData
当我用谷歌浏览器打开此网址时,它会作为响应
{"phone":false}
我尝试对机器人框架做同样的事情:
Create Http Context https://www.app.com:8080/rest/api/customer/phone /personnalData
Set Request Header Content-Type application/json
Set Request Header Accept application/json
HttpLibrary.HTTP.GET https://www.app.com:8080/rest/api/customer/phone /personnalData
${Body}= HttpLibrary.HTTP.Get Response Body
JSON.Save Json ${Body} C:/RESTResponseBody.json
我得到了这个回应:
[ FAIL | InvalidURL: nonnumeric port: '9448/rest/api/customer/phone/personnalData' ]
请帮忙。
答案 0 :(得分:1)
您需要通过以下方式使用http lib。
Create Http Context host=www.app.com:8080 scheme=https
Set Request Header Content-Type application/json
Set Request Header Accept application/json
HttpLibrary.HTTP.GET /rest/api/customer/phone /personnalData
${Body}= HttpLibrary.HTTP.Get Response Body
JSON.Save Json ${Body} C:/RESTResponseBody.json