你猜对了,HTTP头不是URL的一部分.
当你在浏览器中输入一个URL时,请求将以标准标题发出.无论如何,REST API不应该通过在浏览器的地址栏中键入端点来使用.
The most common scenario is that your server consumes a third party REST Api.
要做到这一点,服务器端代码forges将正确的GET(/PUT/POST/DELETE)请求指向给定的端点(URL)设置(在需要时,如您的情况)headers,并最终(可能)发送一些数据(例如POST请求中通常发生的情况).
The code to forge the request, send it and finally get the response back depends on your server side language.
如果您想使用REST Api,可以从命令行使用100工具.
curl
发出请求并将响应输出到标准输出(除非另有指示).
在您的情况下,测试请求将按如下方式发出:
$curl -H "Accept: application/json" 'http://localhost:8080/otp/routers/default/plan?fromPlace=52.5895,13.2836&toPlace=52.5461,13.3588&date=2017/04/04&time=12:00:00'
The H
or --header
directive sets a header and its value.