Re: PUT and Idempotency??

Charles Wilt <[email protected]>
Newsgroups gmane.comp.systems.as400.web
Message-ID <CAJ=Tnc5arno08s1Y4nvEOzYwKRH9GbmYCUx4mJORC89h1m8aJQ@mail.gmail.com>
The Idempotency of PUT doesn't usually last for an eternity in real life :)

POST "blah" "Hi"
POST "blah" "Hi"
Creates 2 resources

PUT /blah1 "Hi"
PUT /blah1 "Hi"
replaces a single resource "blah"

PUT /blah1 "Hi"
DELETE /blah1
PUT /blah1 "Hi"
could easily result in a 404 - Not found

Having said that, neither PUT nor POST feel quite right since you're not
saving anything.
It's too bad GET requests aren't really supposed to have a body.  (Though
ElasticSearch makes use of them..)

If it were me, I think I'd stay with POST, and simply add an optional
"quote":true or something in the body...

HTH,
CHarles




On Fri, Feb 4, 2022 at 7:28 AM Dave <[email protected]> wrote:

> Hi,
>
> Having a problem getting my head around this and wondering if I really need
> to understand.
> I'm thinking that if my application receives the same input, then I should
> always return the same output, but I don't see how that's possible. For
> example, if  the customer asks for a quote today, I'm not going to send
> back the same data tomorrow if he sends me the same data and our prices
> have changed since.
>
> My web application is already receiving JSON data via a POST method. It
> calculates and saves an order and sends the details of the payment back.
> Now I have to create a simulation via a PUT method. The application will
> receive the JSON data in the same format and do the same calculation except
> there will be no saving of the order on our system, just the details of the
> customer request.
> So I'm thinking I'll just ignore the fact that the http method is PUT and
> treat it as a POST.
> Am I missing the point?
> Thanks!
> --
> This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
> list
> To post a message email: [email protected]
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/web400
> or email: [email protected]
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/web400.
>
>
-- 
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.