1

I have interesting situation here, which I'd like to draw your opinions upon. I'm designing a REST API and here are the Resources pertaining to this question.

  1. I have an User Entity, which I create through POST /users/ and Read-Update-Delete(RUD) by /users/:user-id

  2. I have an Event Entity which I create through POST /events/ and Read-Update-Delete(RUD) by /events/:event-id

  3. Now, multiple Users can be associated to multiple Events. This is why, there is a Member Entity which references a user-id and event-id. Basically, every time a User attends an Event, he as a unique Member profile for that Event. Member is created through /events/:event-id/members and modified through /events/:event-id/members/:member-id

  4. I have Mini Events which are parts of Events. A Mini Event is NOT an Event, but instead a part of an Event. They are created through /events/:event-id/minievent and modified through /events/:event-id/minievent/:minievent-id

Here's my question

I wish to associate Members of an Event to a Mini Event of naturally, the same Hackathon.

The first way that comes to mind is POST event/event:id/minievents/:minievents/members BUT the Member entity I wish to associate to this Mini Event has been created when I created this Member for this Event. Naturally, you cannot associate a Member to a Mini-Event before creating a Member for the main Event in the first place.

I believe using POST event/event:id/minievents/:minievents/members would be incorrect as it would mean creating members but they have already been created.

I wish to associate Members of an Event to a Mini Event. What would be the most RESTful way to do this?

Note: Mini Events have a different schema than Events, they are different entities and not interchangeable. Don't suggest making Mini Events and Events the same thing.

4
  • Naturally, you cannot associate a Member to a Mini-Event before creating a Member for the main Event in the first place. -- So you need two REST calls, right? Nov 18, 2017 at 18:34
  • The other thing you can do is drop REST for this specific situation, and just make a non-REST-ful POST. REST is primarily document-oriented CRUD; if what you are doing is not document-oriented CRUD, REST might not be the best fit. Nov 18, 2017 at 18:35
  • ^^Yes, one to create a Member for the Event and then associate that Member to a Mini Event that exists for that Hackathon
    – tsaebeht
    Nov 18, 2017 at 19:02
  • @RobertHarvey ^^Could you write an answer instead?
    – tsaebeht
    Nov 18, 2017 at 19:02

0

Browse other questions tagged or ask your own question.