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

  • Home
  • SEARCH
  • 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 98287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:10:02+00:00 2026-05-11T00:10:02+00:00

I’m doing research into a web API for my company, and it’s starting to

  • 0

I’m doing research into a web API for my company, and it’s starting to look like we might implement a RESTful one. I’ve read a couple of books about this now (O’Reilly’s ‘RESTful web services’ seeming the most useful) and have come up with the following set of URIs and operations for an object that can be commented on, tagged, and rated.

It doesn’t really matter what the object is, as this scenario applies to many things on the net, but for the sake of argument lets say it’s a movie.

Some of these seem to fit quite naturally, but others seem a bit forced (rating and tagging particularly) so does anybody have any suggestions about how these could be improved? I’ll list them with the URI and then the supported verbs, and what I propose they would do.

/movies 

GET = List movies

/movies/5 

GET = Get movie 5

/movies/5/comments 

GET = List comments on movie 5

POST = Create a new comment on movie 5

/movies/5/comments/8 

GET = Get comment 8 on movie 5

POST = Reply to comment 8 on movie 5

PUT = Update comment 8 on movie 5

/movies/5/comments/8/flag 

GET = Check whether the movies is flagged as inappropriate (404 if not)

PUT = Flag movie as inappropriate

/movies/5/rating 

GET = Get the rating of the movie

POST = Add the user rating of the movie to the overall rating

Edit: My intention is that the movie object would contain its rating as a property, so I wouldn’t really expect the GET method to be used here. The URI really exists so that the rating can be an individual resource that can be updated using the POST verb. I’m not sure if this is the best way of doing it, but I can’t think of a better one

/movies/5/tags/tagname 

GET = Check whether the movies is tagged with tagname (404 if not; but if it is tagged with the tag name should it return the actual tag resource by redirecting to something like /tags/tagname?)

PUT = Add tag tagname to the movie, creating the tag resource /tags/tagname if required

DELETE = Remove tag tagname from the movie, deleting the tag resource tags/tagname if nothing is tagged with it after this removal


Note that these wouldn’t be the entire URIs, for example the URI to list the movies would support filtering, paging and sorting. For this I was planning on something like:

/movies/action;90s/rating,desc/20-40 

Where:

action;90s is a semi-colon delimited set of filter criteria

rating,desc is the sort order and direction

20-40 is the range of item indices to get

Any comments about this API scheme too?


Edit #1

This post is getting quite long now! After reading some of the answers and comments, this is the changes from above I’m planning on making:

Tags will be handled as a group rather than individually, so they will be at:

/movies/5/tags 

GET = List tags

POST = Union of specified tags and existing tags

PUT = Replace any current tags with specified tags

DELETE = Delete all tags

I’m still really not sure how to handle flagging a comment though. One option is that instead of POSTing to a comment replying to it, a comment object will include its parent so it can be POSTed to the general URI, i.e.

/movie/5/comment 

POST = Create a new comment (which may be a reply to a comment)

I could then use the POST to a comment to flag it. But this still doesn’t feel quite right.

/movie/5/comment/8 

POST = Flag comment

  • 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. 2026-05-11T00:10:03+00:00Added an answer on May 11, 2026 at 12:10 am

    Most of what you have looks good. There were just a couple of strange things I saw. When I put my URLs together, I try to follow these four principles.

    Peel the onion

    If you make the R in REST really be a resource then the resource URL should be able to be peeled back and still be meaningful. If it doesn’t make sense you should rethink how to organize the resource. So in the case below, each makes sense. I am either looking at a specific item, or a collection of items.

    /movies/horror/10/ /movies/horror/ /movies/ 

    The following seems funny to me because flag isn’t a resource, it’s a property of the movie.

    /movies/5/comments/8/flag -> Funny /movies/5/comments/8/     -> Gives me all properties of comment including flag 

    Define the View

    The last peice of the URL describes how to show the resource. The URL /movies/horror/ tells me I will have a collection of movies refined by horror. But there might be different ways I want to display that collection.

    /movies/horror/simple /movies/horror/expanded 

    The simple view might just be the title and an image. The expanded view would give a lot more information like description, synopsis, and ratings.

    Helpers

    After the resource has been limited and the proper view figured out, query string parameters are used to help the UI with the little stuff. The most common query string parameters I use are

    p => Page n => number of items to display sortby => field to sort by asc => sort ascending 

    So I could end up with a URL like

    /movies/horror/default?p=12&n=50&sortby=name 

    This will give me the list of movies limited to horror movies with the default view; starting on page 12 with 50 movies per page where the movies are sorted by name.

    Actions

    The last thing needed are your action on the resource. The action are either collection based or item based.

    /movies/horror/ GET -> Get resources as a list POST -> Create, Update  /movies/horror/10/ GET -> Get resource as item POST -> Update 

    I hope this helps.

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

Sidebar

Ask A Question

Stats

  • Questions 79k
  • Answers 79k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer String.Join May 11, 2026 at 4:10 pm
  • Editorial Team
    Editorial Team added an answer You can use '@' instead of the @, but thats… May 11, 2026 at 4:10 pm
  • Editorial Team
    Editorial Team added an answer If your app is not running, then no, it's not… May 11, 2026 at 4:10 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.