问题
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
- Applied filters to given resource:
Query parameters are used for filtering resources.
来源:https://stackoverflow.com/questions/60119161/what-is-extra-in-url-while-working-with-get-request