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 371061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:04:42+00:00 2026-05-12T14:04:42+00:00

I have a resource that has a counter. For the sake of example, let’s

  • 0

I have a resource that has a counter. For the sake of example, let’s call the resource profile, and the counter is the number of views for that profile.

Per the REST wiki, PUT requests should be used for resource creation or modification, and should be idempotent. That combination is fine if I’m updating, say, the profile’s name, because I can issue a PUT request which sets the name to something 1000 times and the result does not change.

For these standard PUT requests, I have browsers do something like:

PUT /profiles/123?property=value&property2=value2

For incrementing a counter, one calls the url like so:

PUT /profiles/123/?counter=views

Each call will result in the counter being incremented. Technically it’s an update operation but it violates idempotency.

I’m looking for guidance/best practice. Are you just doing this as a POST?

  • 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-05-12T14:04:42+00:00Added an answer on May 12, 2026 at 2:04 pm

    An alternative might be to add another resource to the system to track the viewings of a profile. You might call it “Viewing”.

    To see all Viewings of a profile:

    GET /profiles/123/viewings

    To add a viewing to a profile:

    POST /profiles/123/viewings #here, you’d submit the details using a custom media type in the request body.

    To update an existing Viewing:

    PUT /viewings/815 # submit revised attributes of the Viewing in the request body using the custom media type you created.

    To drill down into the details of a viewing:

    GET /viewings/815

    To delete a Viewing:

    DELETE /viewings/815

    Also, because you’re asking for best-practice, be sure your RESTful system is hypertext-driven.

    For the most part, there’s nothing wrong with using query parameters in URIs – just don’t give your clients the idea that they can manipulate them.

    Instead, create a media type that embodies the concepts the parameters are trying to model. Give this media type a concise, unambiguous, and descriptive name. Then document this media type. The real problem of exposing query parameters in REST is that the practice often leads out-of-band communication, and therefore increased coupling between client and server.

    Then give your system a uniform interface. For example, adding a new resource is always a POST. Updating a resource is always a PUT. Deleting is DELETE, and getiing is GET.

    The hardest part about REST is understanding how media types figure into system design (it’s also the part that Fielding left out of his dissertation because he ran out of time). If you want a specific example of a hypertext-driven system that uses and doucuments media types, see the Sun Cloud API.

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

Sidebar

Related Questions

I have a JavaScript resource that has the possibility of being edited at any
If I have a resource that a requesting client doesn't have access to but
I have a resource handler that is Response.WriteFile(fileName) based on a parameter passed through
I have resource dictionary files (MenuTemplate.xaml, ButtonTemplate.xaml, etc) that I want to use in
I have included a resource in my Visual Studio 2005 solution that was a
I have a .ico file that is embedded as a resource (build action set
I have a strange error that has bothered me all day. I have a
I have a JSP page that has 2 forms running on Tomcat 6. One
This has to be a common question that all programmers have from time to
The majority of resources that I have for UI design all deal with the

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.