7 ms·
Idempotent Web APIs: What benefit do I get?
- latch 13y agoI like the idea. Have you considered adding weights? I'd also consider linking to a more detailed source (wikipedia?) when available. On the topic of idempotence..we recently made our platform distributed across 4 datacenters using queues. None of us really knew what we were doing. Recognizing this very early on, we made all calls idempotent. Pretty sure that single decision is what made the entire system work.
- mfenniak 13y agoI have absolutely considered adding weights. But, it quickly leads to the idea that my priorities are not necessarily the same as everyone else's, and that leads to user-customizing, and that leads to... well, it got to some cool ideas, but I figured first I should shove this out the door in a simple form and see if people like the concept. If the concept is well-received, I'll continue to develop it and explore other API best practices in a similar manner.
- mattacular 13y agoCould somebody explain how DELETE can be idempotent? Ex. "Request = DELETE ID 1" First request, ID 1 is deleted. Second request, ID 1 has already been deleted. Third request, ID 1 has already been deleted.
- dscrd 13y agoCouldn't we find a nicer word for "idempotent"?
- daviddaviddavid 13y agoIndeed. It's a very clunky word, not least because it's unclear which syllable to stress. I've variously heard people say both i-dem-PO-tent and i-DEM-po-tent. (In the latter, the "o" in "po" gets reduced to a schwa.)
- riquito 13y agoSince when a noun pronounce should be obvious?
- msg 13y agoWhen I don't want to sound snooty, I say rerunnable. Fixed point is another way to get at it, although it requires your listener to know what that is.
- bmm6o 13y agoThe term is very well-established in mathematics (for e.g. matrices and transformations) that is the precisely correct term for this, and it is already widely used in CS. Inventing a new word would not be helpful in the long run.
- dscrd 13y agoI find a world where we're locked into using words mathematicians invent a very bleak one indeed.
- apalmer 13y agoWhat do you mean by 'nicer' word? I really honestly don't get it. I mean if it were some consumer property, like say the size of a hard drive or such, then yeah makes some sense, for a term used in strictly in technical circles to describe a precise technical property, I don't understand what 'nicer' means.
- j-m-o 13y agoAwesome idea. I know they don't get too much love on HN, but it would be cool to see this done for a set of enterprise integration patterns. See: http://www.eaipatterns.com/toc.html http://www.eaipatterns.com/toc.html http://camel.apache.org/enterprise-integration-patterns.html http://camel.apache.org/enterprise-integration-patterns.html
- mfenniak 13y agoThanks! The enterprise integration patterns links are interesting to me; thanks for point those out. I can definitely see how they could use a connection to reality. I can look at a random one and see what it is, but understanding why you'd use it is a mile above my head.
- j-m-o 13y agoSome of the EIPs suffer from the same 'head-in-the-sky' issues as the GoF design patterns, but there's a few that have come in handy (like the idempotent receiver!). The link to Apache Camel is a bit more informative with actual examples with code snippets.
- nahname 13y agoIf you have to explain this to your boss, why is that person your boss?
- GFischer 13y agoIf you think technical prowess is a requirement for being a boss, reality is going to be quite shocking for you. And, I don't even think it should be a requirement (depending on the role), if said boss hired you because you have the technical experience needed and trusts you, and is willing to learn, I wouldn't mind working for him. http://management.fortune.cnn.com/2011/06/01/why-bosses-dont-need-to-know-all-the-answers/ http://management.fortune.cnn.com/2011/06/01/why-bosses-dont...
- nahname 13y agoI should have clarified, I fully appreciate that most bosses do not actually know the technical minutia of their underlings. That is how hierarchies work... My question was really, given this shared understanding. Why is this limited level of autonomy so common? How much longer can work that requires deep technical knowledge be directed and controlled by those who do not understand it. In short, why are bosses not mentors. I don't mean in the general sense, I mean literally. My boss should be the person I respect, not who I answer to.
- mcherm 13y agoThen what term, if not "boss", do you use for someone who lacks technical skills but has the skills to decide how to manage the investments and balance profit against growth opportunities and for those reasons gives you direction and instructions?
- apalmer 13y agoEhhh dont disagree with you on a theoretical level, but are the average software development manager management skills sooooooo strong that it totally overrides basic technical proficiency? definitely there are a individuals that this is true for... but most development managers naw...
- amiheines 13y agoInteresting, Seems like the Haskel benefits but implemented in mortal technologies.
- mambodog 13y agoSome usability feedback: It seems like the most useful information is contained in the links between nodes, but at first it was not obvious to me that they were clickable, or that clicking the text links at the bottom of node descriptions would actually show the 'link' description, rather than just taking me to the next node. I'd recommend you make it clearer that the linking lines between nodes are clickable. Even better, rather than using a modal dialogue to display node contents, you could use a popover with an arrow pointing to it's owner. Clicking a link a the bottom of an item would simply move the popover, making the relationships between various items of content clearer.
- mfenniak 13y agoThanks for the feedback. There are usability issues, and as you point out, the importance of the links is not evident at a first glance. I like the popover idea; I'll have to give that a try.
- RyanMcGreal 13y agoReply to mattacular, whose comment was deaded: Idempotence (literally "same power) in a REST API means a given request produces the same result whether you execute it once or multiple times. Given the URL: /resource/1 Whether you execute the DELETE method on that resource once or ten times, the resource is deleted. Therefore, it is idempotent.
- jmcqk6 13y agoThis is something I've wondered about. So you get a DELETE request against /resource/1 and you delete the resource. When you get the second DELETE request, shouldn't that give a 404, since the resource no longer exists?
- mcintyre1994 13y agoI'm not entirely sure about what error code to return, but that wouldn't affect idempotency, as long as it remains deleted.
- RyanMcGreal 13y agoIt makes sense to return a 404 for DELETE request on an already-deleted resource, but the response to a request is simply a representation of the resource. My point was to note that DELETE is idempotent - the resource itself is similarly deleted no matter how many DELETE requests you submit to its URL. Edit mfenniak suggests using HTTP 410 Gone instead, which makes more sense than 404 Not Found if you can configure your server to remember that a resource was deleted.
- mfenniak 13y ago"410 Gone" is probably preferable to 404, as it would indicate there used to be a resource at that URL.
- dpark 13y ago410 Gone means that the URL is permanently gone. It would generally be inappropriate as a response to DELETE, because a client with permissions to delete likely has permissions PUT, and could therefore cause the given URL to become valid again.
- jamesaguilar 13y agoVery interesting, but I would say your tradeoffs aren't really accurate. Idempotency should decrease testing and maintenance costs because it is simpler.
- ExpiredLink 13y agoWhat Is Idempotent in REST? http://www.infoq.com/news/2013/04/idempotent http://www.infoq.com/news/2013/04/idempotent
- hcarvalhoalves 13y agoI don't get why there should be an intrinsic higher development cost since you're building a simpler, saner and better-defined system. If anything, it would decrease development costs.
- akiselev 13y agoIt will decrease development costs for the end users, but most times when you say you want a simple api, you mean you want to take a really complicated system and wrap it up in a far simpler interface (hence the "abstract" part). Making good abstractions for a complicated system is always harder than just a 1:1 API.
- losethos 13y agoGod says... 22:6 And he returned to be healed in Jezreel because of the wounds which were given him at Ramah, when he fought with Hazael king of Syria. And Azariah the son of Jehoram king of Judah went down to see Jehoram the son of Ahab at Jezreel, because he was sick. 22:7 And the destruction of Ahaziah was of God by coming to Joram: for when he was come, he went out with Jehoram against Jehu the son of Nimshi, whom the LORD had anointed to cut off the house of Ahab. 22:8 And it came to pass, that, when Jehu was executing judgment upon the house of Ahab, and found the princes of Judah, and the sons of the brethren of Ahaziah, that ministered to Ahaziah, he slew them. 22:9 And he sought Ahaziah: and they caught him, (for he was hid in Samaria,) and brought him to Jehu: and when they had slain him, they buried him: Because, said they, he is the son of Jehoshaphat, who sought the LORD with all his heart. So the house of Ahaziah had no power to keep still the kingdom. ---- God says... handle devil hi flung countermanding sailors recommended that's_no_fun fetched I_forgot understanding 64-6221541 lofty suppose (C64 1541)