Marcin Kunert
Marcin Kunert

Reputation: 6285

How to get current logged user data in a RESTful way?

I have some trouble designing my API.

GET /api/training-signups - returns list of signups

GET /api/training-signups/:id - returns list of signups with the given :id

I want to get the signup list for the current logged in user. I've thought of different ways but all seem a bit wacky to me. Here is what I tried and what I don't like about it:

GET /api/training-signups/me - weird, instead of using an :id a "magic" me occurs

GET /api/me/training-signups/me - I would rather start with /api/trainnig-signups as this url is responsible for signups

What would be your approach of doing it?

Upvotes: 0

Views: 212

Answers (1)

J. Vergeer
J. Vergeer

Reputation: 800

How about giving the GET /api/training-signups some optional GET parameters to specify the query?

like:

GET /api/training-signups?userId=123

Upvotes: 2

Related Questions