Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8915663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:01:24+00:00 2026-06-15T05:01:24+00:00

(Pardon the question title; hard to summarize this question.) On Facebook, you like things.

  • 0

(Pardon the question title; hard to summarize this question.)

On Facebook, you like things. On Twitter, you follow people. On GitHub, you also follow people and star repos and gists.

All of these cases are pretty similar: those connections are lightweight, not really “resources” themselves. E.g. none of those three APIs expose public IDs for such connections.

This raises the question: what’s the “best” (in terms of REST) way to expose an API for creating/querying/deleting those connections?


Facebook does [1]:

  • GET /:id/likes to query an object’s likes (more precisely, the users that like that object)

  • POST /:id/likes to like something (on behalf of the auth’ed user; no req body needed)

  • DELETE /:id/likes to unlike something (on behalf of the auth’ed user)

The querying and creating make sense, but the DELETE is a bit “unRESTful”, because you’re not actually deleting the /:id/likes resource (an array of users that like that object).

This discrepancy shows itself in another case [2]:

  • GET /me/likes/:id to query whether you like something

So querying your connection is querying a totally different resource than creating or deleting it.


GitHub leans to the /me/likes/:id style for following users and starring repos [3]:

(Note that GitHub’s /user represents the auth’ed user, like Facebook’s /me.)

  • GET /user/starred/:owner/:repo for querying whether you have a repo starred (returns 204 or 404, no body either way)

  • PUT /user/starred/:owner/:repo for starring a repo (no body needed in request)

  • DELETE /user/starred/:owner/:repo for unstarring a repo

This is much more consistent, but unfortunately this separates individual “stars” from the group:

  • GET /repos/:owner/:repo/stargazers to query the users who’ve starred a repo

GitHub, interestingly, uses a different style for starring gists [4]:

  • GET /gists/:id/star for querying whether you have a gist starred

  • PUT /gists/:id/star for starring a gist

  • DELETE /gists/:id/star for unstarring a gist

This keeps the starring action with the gist resource, like Facebook, rather than the user resource.

GitHub doesn’t publicly expose gists’ stargazers, but presumably it’d be e.g.:

  • GET /gists/:id/stargazers to query the users who’ve starred a gist

While “stargazers” is indeed a different resource/name than “star”, the names are similar and clearly related, and they’re both on the same resource.

The only downside I can think of to this is naming the resource. Something like star works, but actions like follow or like are trickier.


(Not bothering to include the Twitter API as an example since it’s hardly RESTful.)

There’s clearly no perfectly RESTful API for creating/querying/deleting things that aren’t proper resources, but are there other pros/cons I’m not seeing, or other styles to consider?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:01:25+00:00Added an answer on June 15, 2026 at 5:01 am

    One thing I liked about the /me/likes/:id style is that the likes do feel like individual, addressable resources — e.g. they have individual IDs (that happen to be the same as the things I’m liking).

    GitHub’s repo API uses this nicely for creating/querying/deleting “star” connections to repos, but there’s a discrepancy for fetching all “star” connections for a given repo.

    Perhaps the discrepancy could be addressed by changing the way you address these connections: instead of relying solely on the object ID, use the (auth’ed) user’s ID too. E.g.:

    • GET /:owner/:repo/stargazers to query all the users who’ve starred this repo

    • GET /:owner/:repo/stargazers/:id to query whether user :id has the repo starred — this can be the auth’ed user by specifying me!

    • PUT /:owner/:repo/stargazers/me to star a repo — this’ll only work for the auth’ed user

    • DELETE /:owner/:repo/stargazers/me to unstar a repo — ditto

    Now all the resources/actions are together, the actions are consistent, and naming is easy.

    Edit: Another benefit of this approach is that you can easily and efficiently query whether other users like/follow/star an object, as well.

    Edit: But a downside is that the resources aren’t technically correct anymore — GET .../stargazers returns a list of users, but GET .../stargazers/:id returns a connection, not a user. Oh well?

    [Edited again to support passing me as the :id here too.]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Pardon if this is a n00b question, I'm a n00b to grails... I have
Pardon my title guys. I tried thinking hard but couldn't think of better title.
Pardon me if this is a noob question, I'm overextending myself a bit with
Please pardon me asking this rudimentary question, but let me know if anyone knows
Pardon me, this really is a noob question but please understand that I do
This is really a pardon my ignorance question so apologies if it doesn't meet
I am no expert in network security, so pardon if this question is not
Pardon me if this is a n00b-ish question but if the shoe fits I'll
pardon my question title, I'm not sure what should I put it, I have
Please pardon the beginner question.I met this code fragment on the internet: public class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.