Skip to Content
Technical Articles

Repeatable Requests for REST APIs

Everyone is using REST APIs nowadays, despite the fact that HTTP is an inherently unreliable protocol. So how to deal with “lost requests” and “lost responses”? Not a problem for GET requests: just repeat them if you get no answer – GET is “safe” and should not have side-effects.

Not so easy for POST, which is typically used to create something, or to trigger an action: you might end up with more than you wanted:

To solve this problem the SOAP world introduced WS-RM, RM meaning Reliable Messaging. As with many things in the SOAP world this specification slightly overdid it, providing

  1. At least once
  2. At most once
  3. Exactly once (the combination of 1 and 2), and
  4. In order

Number 4 is the tricky part, and it is actually often not needed.

So here’s a light-weight subset, just providing 1 and 2 (and thus 3), and avoiding the tricky bit: Repeatable Requests for REST APIs.

This mechanism can easily be combined with any REST dialect or flavor because it only relies on sending some additional headers – nothing OData-specific in it, despite being provided by the OASIS OData Technical Committee.

An early version of this mechanism, called Idempotent Services, is available in SAP Netweaver Gateway for OData V2 since 2013.

So problem solved – again 🙂

/
Be the first to leave a comment
You must be Logged on to comment or reply to a post.