mercredi 26 mai 2021

Pattern for naming query params in REST Api

Is there any guideline or pattern for query params nomenclature in the url of a Rest API?

In my case I have an entity and I want to pass some parameters in the url that refer to the IDs of other entities that compose it. I am uncertain if I should name my query params with the prefix "id" or just the name of the child entity that they refer to.

  1. /foo?idBar=1

  2. /foo?bar=1

Which one is the correct way?

Aucun commentaire:

Enregistrer un commentaire