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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:40:34+00:00 2026-05-17T15:40:34+00:00

Sorry for the strange title. Here is my situation. I have a table of

  • 0

Sorry for the strange title. Here is my situation.

I have a table of products with the name and display order of each product. The client can change the display order of the products. The table is generated using jQuery.tmpl and the data is pulled using GET under WCF. The products pulled from the db are by CategoryID.

When the user changes the display order of a product in the grid the product needs to be updated using POST. Once the data has been updated the server needs to send back an updated json object to update the table.

QUESTION: How do I structure my POST uri for this scenario? Here is what I have now.

 [OperationContract]
        [WebInvoke(
            Method = "POST",
            RequestFormat = WebMessageFormat.Json,
            ResponseFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.Bare,
            UriTemplate = "product/form/{categoryId}")]
        [return: MessageParameter(Name = "products")]
        List<Product> UpdateProduct(string categoryId);

I believe my uri for updating the resource is correct as I am updating a single product by a category id. However, I want to return a new set of products based on the changes made by the POST and not have to make a separate GET call.

Not sure if this is ‘right’. Those restafarians have me spooked!

Thanks.

UPDATE
I started thinking a bit more about my code above and realized there is more going on here.
The reality of my situation is that I am trying to update a specific product by ProductID and THEN return a list of products by CategoryID. Essentially a POST and a GET. So would my URI look like this?

[WebInvoke(
Method = "POST",
UriTemplate = "product/form/{productId}/products/{categoryId}")]
[return: MessageParameter(Name = "products")]
List<Product> UpdateProduct(string productId, string categoryId);

With my method like this?

public static List<Product> UpdateProduct(string productId, string categoryId)
{
ProductManager.UpdateProduct(int.Parse(productId));
return ProductManager.GetProducts(int.Parse(categoryId));
}

UPDATE2

This question has been addressed here with a link Daniel provided. Although handling everything in one POST call appears to make sense, I don’t think it conforms to the spirit of REST and using Uri’s as resources. Using a POST and then a GET call appears to be the answer. Thanks to Daniel. His comments are good.

  • 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-17T15:40:35+00:00Added an answer on May 17, 2026 at 3:40 pm

    A POST or PUT request to update the display order should not return back anything, except for the status code that indicates the status of the request. You should issue a separate GET request to receive the new list of top 15/25/50/etc products:

    If a new resource is created, the origin server MUST inform the user agent
    via the 201 (Created) response. If an existing resource is modified,
    either the 200 (OK) or 204 (No Content) response codes SHOULD be sent
    to indicate successful completion of the request. If the resource
    could not be created or modified with the Request-URI, an appropriate
    error response SHOULD be given that reflects the nature of the
    problem.

    From: Section 9.6 of the HTTP 1.1 Specification

    You may also be interested in checking out the HTTP Spec (Sections 9.5 and 9.6) and the following Stack Overflow post:

    • Is it ok by REST to return content after POST?

    That said, I can think of two ways to update the display order of the products:

    1. Send a move-up or move-down request for a particular product_id. This request can be invoked whenever an up/down button is clicked.

    2. Send the complete order_rank list for a whole category.

    I believe the latter is more practical, but you may want to expose both operations. For the first approach the POST verb seems appropriate, but for the second one I would use a PUT.

    For the first approach, I would imagine URIs like the following:

    POST /products/{productId}/move-up
    POST /products/{productId}/move-down
    

    The above suggests that we’re creating a “move-up” or a “move-down” command. The verb POST means “create” and the noun (the action) is “move-up” or “move-down” command, which acts on a particular product_id.

    For the second approach, I would see a URI like the following:

    PUT /categories/{categoryId}/order-rank
    

    To which we can pass a JSON/XML/etc representation for each product_id with the order_rank number. The verb PUT means “update” and the noun is the “order-rank” for a particular category_id.

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

Sidebar

Related Questions

Sorry about the strange title. I really have no idea how to express it
sorry for the cryptic question title. I'm having a strange problem and i have
sorry for the strange title. I have a quite large website written in pure
(Sorry for strange title, haven't come up with anything better..) Background I use nunit-console
Sorry about the strange title, but I am having a small issue if the
There is this strange situation I'm fighting on. I have 3 pages, les call
Sorry for the strange title, I'm not really sure how to classify this issue.
Sorry for the ambiguous title, but this is a strange issue. I'm using the
Sorry for the, strange title, but I couldnt quite get it across. Basically what
Sorry for my English. I have a strange problem. When user click adword link,

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.