Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Example: Party Invites in Rest
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Kevin Wiggen  
View profile  
 More options Oct 27 2012, 12:46 pm
From: Kevin Wiggen <kwig...@gmail.com>
Date: Sat, 27 Oct 2012 09:46:18 -0700 (PDT)
Local: Sat, Oct 27 2012 12:46 pm
Subject: Example: Party Invites in Rest

Imagine I am creating a party planning service that allows people to
accept/reject invitations to parties (think evite).  I have the following
Rest API

POST /parties  -- create party
GET /parties/:id -- get info about a party
GET /parties/:id/attendees -- people who are coming
GET /parties/:id/invitees -- people who are invited but have not decided yet

I don't care about people who don't want to come

I then need a way for people to see all the parties they are invited to

GET /users/:id/invites

There are two related problems:

1)  How do I have a user accept/deny a party?  
  - Do I leave /users/:id/invites as read only and have the API allow the
user to
       PUT  /parties/:id/attendees/:userId to accept
       DELTE  /parties/:id/invitees/:userId to DENY?
  -  I could add a "Status" to /users/:id/invites/:id with
<undecided><accept><deny> and have the user
       POST  /users/:id/invites/:id and update the status field -- which
technically will update the party and  remove the invite object as I don't
want to keep the invite forever

2)  This gets a little more complicated when we want a BATCH which allows
the user to accept/decline lots of invites at the same time
  - POST /users/:id/invites seems like a place to put the batch command

I don't really like anything I have come up with so far.  Any suggestions?

Thanks,
Kevin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Kelly  
View profile  
 More options Oct 27 2012, 2:27 pm
From: Mike Kelly <mikekelly...@gmail.com>
Date: Sat, 27 Oct 2012 19:27:09 +0100
Local: Sat, Oct 27 2012 2:27 pm
Subject: Re: [api-craft] Example: Party Invites in Rest

How about for each individual invitation just expose it as a resource and have the client update it as accepted?

PUT /invitations/123
{ "accepted": true }

If you need a batch acceptance you can do something like:

POST /users/234/bulk-accept-invites
.. a list of invite URIs ..

Sent from my iPhone

On 27 Oct 2012, at 17:46, Kevin Wiggen <kwig...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »