idempotent

Idempotent PUT in a concurrent environment

♀尐吖头ヾ 提交于 2019-12-06 01:02:54
问题 Context I have a REST API where multiple clients (applications) can update the state of a resource with PUT. For the example, this resource is a lamp that you can turn ON or OFF . This resource is also automatically updated by the system when it detects that an electricity failure has occurs, leading to have a lamp in a BROKEN state. I want to made the distinction between BROKEN and OFF , a lamp in BROKEN can not be turn ON ! Problem I use PUT method to do this, something like PUT http:/

Client side id generation strategy for REST web service

眉间皱痕 提交于 2019-12-05 10:34:35
Let's say I want to build a REST service for making notes that looks something like this: GET /notes/ // gives me all notes GET /notes/{id} // gives the note identified by {id} DELETE /notes/{id} // delete note PUT /notes/{id} // creates a new note if there is no note identified by {id} // otherwise the existing note is updated Since I want my service to be indempotent I'm using PUT to create and update my notes, which implies that the ids of new notes are set/generated by the Client. I thought of using GUIDs/UUIDs but they are pretty long and would make remembering the URLs rather dificult.

RESTful idempotence

此生再无相见时 提交于 2019-12-05 00:13:16
问题 I'm designing a RESTful web service utilizing ROA(Resource oriented architecture). I'm trying to work out an efficient way to guarantee idempotence for PUT requests that create new resources in cases that the server designates the resource key. From my understanding, the traditional approach is to create a type of transaction resource such as /CREATE_PERSON. The the client-server interaction for creating a new person resource would be in two parts: Step 1: Get unique transaction id for

RESTful idempotence

限于喜欢 提交于 2019-12-03 15:20:36
I'm designing a RESTful web service utilizing ROA(Resource oriented architecture). I'm trying to work out an efficient way to guarantee idempotence for PUT requests that create new resources in cases that the server designates the resource key. From my understanding, the traditional approach is to create a type of transaction resource such as /CREATE_PERSON. The the client-server interaction for creating a new person resource would be in two parts: Step 1: Get unique transaction id for creating the new PERSON resource::: **Client request:** POST /CREATE_PERSON **Server response:** 200 OK

ansible ignore the run_once configuration on task

…衆ロ難τιáo~ 提交于 2019-12-03 11:03:33
I am using Ansible and I want to run a task only once. I follow the documentation about how to configure and run a task only once - name: apt update shell: apt-get update run_once: true But when I run Ansible, it always runs this task. How can I run my task only once. The run_once option will run every time your Playbook/tasks runs, but will only run it once during the specific run itself. So every time you run the play, it will run, but only on the first host in the list. If you're looking for a way to only run that command once, period, you'll need to use the creates argument. Using your

How to keep an API idempotent while receiving multiple requests with the same id at the same time?

送分小仙女□ 提交于 2019-12-03 10:14:35
问题 From a lot of articles and commercial API I saw, most people make their APIs idempotent by asking the client to provide a requestId or idempotent-key (e.g. https://www.masteringmodernpayments.com/blog/idempotent-stripe-requests) and basically store the requestId <-> response map in the storage. So if there's a request coming in which already is in this map, the application would just return the stored response. This is all good to me but my problem is how do I handle the case where the second

What's the correct way to view idempotency in terms of HTTP DELETE?

半世苍凉 提交于 2019-12-03 09:00:45
问题 I have spent a lot of time recently reading the HTTP 1.1 specification and relating it to REST. I have found that there are two interpretations of the HTTP DELETE method in regards to its "idempotency" and safety. Here are the two camps: If you delete a resource with HTTP DELETE, and it succeeds (200 OK), and then you try to delete that resource N number of times, you should get back a success message (200 OK) for each and every one of those delete calls. This is its "idempotencyness". If you

Consequences of POST not being idempotent (RESTful API)

旧时模样 提交于 2019-12-03 01:58:13
问题 I am wondering if my current approach makes sense or if there is a better way to do it. I have multiple situations where i want to create new objects and let the server assign an ID to those objects. Sending a POST request appears to be the most appropriate way to do that. However since POST is not idempotent the request may get lost and sending it again may create a second object. Also requests being lost might be quite common since the API is often accessed through mobile networks. As a

How to keep an API idempotent while receiving multiple requests with the same id at the same time?

笑着哭i 提交于 2019-12-03 00:45:14
From a lot of articles and commercial API I saw, most people make their APIs idempotent by asking the client to provide a requestId or idempotent-key (e.g. https://www.masteringmodernpayments.com/blog/idempotent-stripe-requests ) and basically store the requestId <-> response map in the storage. So if there's a request coming in which already is in this map, the application would just return the stored response. This is all good to me but my problem is how do I handle the case where the second call coming in while the first call is still in progress? So here is my questions I guess the ideal

What's the correct way to view idempotency in terms of HTTP DELETE?

只愿长相守 提交于 2019-12-02 23:07:14
I have spent a lot of time recently reading the HTTP 1.1 specification and relating it to REST. I have found that there are two interpretations of the HTTP DELETE method in regards to its "idempotency" and safety. Here are the two camps: If you delete a resource with HTTP DELETE, and it succeeds (200 OK), and then you try to delete that resource N number of times, you should get back a success message (200 OK) for each and every one of those delete calls. This is its "idempotencyness". If you delete a resource with HTTP DELETE, and it succeeds (200 OK), and then you try to delete that resource