Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Api Url Parts Nomenclature

Tags:

naming

api

I have an api like

http://api.mycompany.com/products/bycategory/{category_id}

How the ending part /products/bycategory/{category_id} is named? If I remove the domain part, how can I name the rest if I put it in web.config, for instance?

URI? I looked at some articles but I was confused. Sometimes the full Url seems to be the URI others the mentioned remaining part.

Thanks.

like image 312
Jeova Almeida Avatar asked Jan 01 '23 01:01

Jeova Almeida


1 Answers

An URL is made up of these parts:

  • the protocol, e.g., http://
  • the domain, e.g., api.mycompany.com
  • the path, e.g., /products/bycategory/{category_id}
  • possibly a query string, e.g., ?key=value&otherKey=otherValue

It's up to the server how to interpret the path and query string. A simple web server may just serve the file pointed to by the path. An application server may interpret the path as a query.

The REST resource naming guide talks about "resources" which makes sense since first a URL is-a uniform resource identifier (URI). URIs also use the term "path".

See this question on REST API naming guidelines and its answers, the term used there is "path" as well.

I'd also use "path".

like image 73
Robert Avatar answered Jan 08 '23 00:01

Robert