Search code examples
apirestrestful-urlwebapi

Should I include a slash before a query for my WebAPI endpoint?


I'm creating API endpoints for my app. Which of the following endpoint format is more 'standard'? In the example below I will be returning user id 'john' from my users table.

https://localhost:33170/api/users?id=john

OR

https://localhost:33170/api/users/?id=john

FYI, the following endpoint will return all users:

https://localhost:33170/api/users

Solution

  • It has been determined that it doesn't matter if the trailing slash is on or not.

    I don't know of any framework that treats either case differently... Those two routes are identical in every framework I have ever used.