HTTP put and POST methods

I read
HTTP put idempotent and does not change the state of object and suitable for updating given object.
Whereas and POST method is non idempotent which changes everytime state of object and not suitable for UPDATEs. I have not clearly understood the difference when to us UPDATE and PUT. please advise
LVL 7
gudii9Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gurpsbassiCommented:
Think of them as database CRUD operations

POST = insert
PUT = update
DELETE = delete
GET = select
0
gudii9Author Commented:
POST is for ADD right?
i am bit confused about states of objects how they change and how they do not change due to ADD, UPDATE. please advise
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Think of it this way...

If I "add" 10 items to an empty list, there are now 10 items in the list. Each of those 10 "add" operations changed the list in some way (they increased the size of the list by 1). So "add" is a non-idempotent operation.

If I do the same "update" to the first item in the list 10 times, the first update applies and then the next 9 are redundant as the change has already been applied. The first update changed the state of the object but the next 9 didn't really do anything. So "update" IS idempotent.
0
gudii9Author Commented:
what is literal meaning of idempotent and non-idempotent
it is bit confusing word.

idempotent means non changeable?
0
gurpsbassiCommented:
It means you can replay the operation without causing any side effects.

For example a GET request can be invoked multiple times and should not change the state.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.