What makes the Flickr API not RESTful?

I'm going to start developing a REST API for a client site, and I'm doing some research. I came across this useful question on the gold API standard.

Before reading this post, I thought about using the Flickr API as a reference point. However, this commentary on the above question made me think twice:

The Flickr API is particularly hilarious, for example. It advertises itself as RESTful and yet is nothing of the sort! - NathanE

I am particularly interested in what makes the Flickr API not RESTful and what does not affect these RESTful elements.

+4
source share
2 answers
+4
source

Another important reason this API will be considered unRESTful is that it does not use hypertext. Hypertext simply uses links (and links) to move clients in your applications, rather than requiring them to programmatically "construct" URIs.

This is not RESTful:

Get / collection
200 OK

 <collection> <item> <id>1</id> </item> </collection> 

This is RESTful:

Get / collection
200 OK

 <collection> <item href="/collection/1" /> </collection> 

An advantage of the last RESTful approach is that your server can move the item resource wherever it wants - for example, move it to / item / 1 - change the href value and find out that all clients will control this change. The first approach is not capable of this, because the server cannot guarantee that all clients will confirm this change; this is part of what is called client / server communication, and in large distributed systems where your API has many clients that you want to minimize - this is the main goal of REST.

Roy Fielding refers to this part of REST as a “hypertext constraint,” and he wrote the following blog post about it:

http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven

+6
source

Source: https://habr.com/ru/post/1300388/


All Articles