Do you know that WebAPI and table names should be consistent?

Last updated by MattGoldman over 3 years ago.See history

When creating WebAPIs for your applications, it is useful to keep the naming consistent all the way from the back-end to the front-end.

Table name: Employees Endpoint: /api/Users

Bad Example: The endpoint is different to the table name

Table name: Employees Endpoint: /api/Employees

Good Example: Table name is the same as the WebAPI endpoint

By making the endpoint name the same as the table name, you can simplify development and maintenance of the WebAPI layer.

In some circumstances you may not have direct control over the database, and sometimes you may be exposing a resource that doesn't have a meaningful analogue in the database. In these situations, it may make sense to have different endpoint names - if doing so will simplify development for consumers of your WebAPI endpoints.

We open source. Powered by GitHub