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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:58:48+00:00 2026-05-11T07:58:48+00:00

Background Information Analysis: According to RFC 2616, § 9.5 , POST is used to

  • 0

Background Information Analysis:

According to RFC 2616, § 9.5, POST is used to create a resource:

The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line.

According to RFC 2616, § 9.6, PUT is used to create or replace a resource:

The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI.

My Question:

So, which HTTP method should be used to create a resource? Or should both be supported?

  • 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-11T07:58:49+00:00Added an answer on May 11, 2026 at 7:58 am

    Overall:

    Both PUT and POST can be used for creating.

    You have to ask, "what are you performing the action upon?", to distinguish what you should be using. Let’s assume you’re designing an API for asking questions. If you want to use POST, then you would do that to a list of questions. If you want to use PUT, then you would do that to a particular question.

    Great, both can be used, so which one should I use in my RESTful design:

    You do not need to support both PUT and POST.

    Which you use is up to you. But just remember to use the right one depending on what object you are referencing in the request.

    Some considerations:

    • Do you name the URL objects you create explicitly, or let the server decide? If you name them then use PUT. If you let the server decide then use POST.
    • PUT is defined to assume idempotency, so if you PUT an object twice, it should have no additional effect. This is a nice property, so I would use PUT when possible. Just make sure that the PUT-idempotency actually is implemented correctly in the server.
    • You can update or create a resource with PUT with the same object URL
    • With POST you can have 2 requests coming in at the same time making modifications to a URL, and they may update different parts of the object.

    An example:

    I wrote the following as part of another answer on SO regarding this:

    POST:

    Used to modify and update a resource

    POST /questions/<existing_question> HTTP/1.1 Host: www.example.com/ 

    Note that the following is an error:

    POST /questions/<new_question> HTTP/1.1 Host: www.example.com/ 

    If the URL is not yet created, you should not be using POST to create it while specifying the name. This should result in a ‘resource not found’ error because <new_question> does not exist yet. You should PUT the <new_question> resource on the server first.

    You could though do something like this to create a resources using POST:

    POST /questions HTTP/1.1 Host: www.example.com/ 

    Note that in this case the resource name is not specified, the new objects URL path would be returned to you.

    PUT:

    Used to create a resource, or overwrite it. While you specify the resources new URL.

    For a new resource:

    PUT /questions/<new_question> HTTP/1.1 Host: www.example.com/ 

    To overwrite an existing resource:

    PUT /questions/<existing_question> HTTP/1.1 Host: www.example.com/ 

    Additionally, and a bit more concisely, RFC 7231 Section 4.3.4 PUT states (emphasis added),

    4.3.4. PUT

    The PUT method requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload.

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

Sidebar

Ask A Question

Stats

  • Questions 76k
  • Answers 76k
  • 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
  • added an answer You can try jquery UI accordion. It has a lot… May 11, 2026 at 3:15 pm
  • added an answer Have you considered using Git? You can host open source… May 11, 2026 at 3:15 pm
  • added an answer Depends on the transaction isolation level (http://en.wikipedia.org/wiki/Isolation_(database_systems)) you're using, but… May 11, 2026 at 3:15 pm

Related Questions

Some Background information We have developed the application against the two most popular standards
Some background information, for a homework assignment I had to write a polish notation
As usual, some background information first: Database A (Access database) - Holds a table
Let me pose a bit of background information before asking my question: I recently

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.