What is extra in URL while working with GET request? [closed]

允我心安 提交于 2020-02-08 10:59:44

问题


https://newsapi.org/v2/top-headlines?sources=bbc-news&apiKey=4e96bad47fc04e949a484544f7f74e6ff1

I'm working with retrofilt and this get request to fetch data. Now in this above url,

Base URL is: https://newsapi.org/v2/

then what is end point in this case?

top-headlines or bbc-news ?

And what is the technical name for other name which is not end point?


回答1:


Base URL: https://newsapi.org

API version: v2

API endpoint: top-headlines

Everything after the ? are URL Parameters

Parameter Key 1: sources

Parameter Value 1: bbc-news

Parameter Separator: &

Parameter Key 2: apiKey

Parameter Value 2: 4e96bad47fc04e949a484544f7f74e6ff1




回答2:


https://newsapi.org/ is base url

/v2/top-headlines is endpoint

sources is restricting to particular news source




回答3:


Look at this from Resource perspective:

  • Base URL: https://newsapi.org/ is base url
  • Resource Path: /v2/top-headlines
  • Resource requested: top-headlines
    • Applied filters to given resource: sources, apiKey

Query parameters are used for filtering resources.



来源:https://stackoverflow.com/questions/60119161/what-is-extra-in-url-while-working-with-get-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!