What is the need for ‘discoverability’ in a REST API when the clients are not advanced enough to make use of it anyway?

The various talks I have watched and tutorials I scanned on REST seem to stress something called ‘discoverability’. To my limited understanding, the term seems to mean that a client should be able to go to http://URL – and automatically get a list of things it can do.

What I am having trouble understanding – is that ‘software clients’ are not human beings. They are just programs that do not have the intuitive knowledge to understand what exactly to do with the links provided. Only people can go to a website and make sense of the text and links presented and act on it.

So what is the point of discoverability, when the client code that accesses such discoverable URLs cannot actually do anything with it, unless the human developer of the client actually experiments with the resources presented? This looks like the exact same thing as defining the set of available functions in a Documentation manual, just from a different direction and actually involving more work for the developer. Why is this second approach of pre-defining what can be done in a document external to the actual REST resources, considered inferior?

The need for discoverability may not be relevant, but the links that allow discoverability serve more purposes. The most important of these, to my mind, is that providing full URI’s in the responses to the client, means that no client will ever need to “compose” an URI. That means that no client will ever need knowledge about how the URI’s are structured. And that in turn allows the server developers to change the URI scheme whenever it suits them as they do not need to consider older clients still relying on an old way of structuring URI’s.

4

“Clients” may not be advanced enough to make use of it, but the users of clients can. A client can be something as simple as a web browser, after all. The discoverability is all about enabling people to learn and use the API.

For example, Jenkins (the CI server) has a REST-like interface. Go to any page, postfix the URL with “/api”, and you get a page describing everything you can do. It makes learning the API trivial. For example, http://ci.jruby.org takes you to the jenkins server for jruby, and http://ci.jruby.org/api takes you to the api for that specific page.

NOTE: I’m no expert on the subject, but I went through a similar process of trying to reconcile the different nuances of people’s interpretations of “REST” a few years ago, and this is the takeaway I got from looking into it at the time.

To my understanding, this stems from Roy Fielding’s Hypermedia as the Engine of Application State aka “HATEOAS”, which then becomes an enabler of the idea of a “semantic web”.

So…basically, and again as I understand it, you make your RESTful application basically self describing such that the consumer does not have to have prior knowledge of a formal contract to consume your content / functionality. They are able to engage from some defaulted root endpoint and then walk contextually relevant links that your app provides as the consumer interacts. The consumer, of course, can be a person or a systemic agent.

If you are just using “REST” for pretty urls mapped to CRUD operations that a consumer must have prior knowledge of and calls according to a well known contract, Roy Fielding would deem it not truly RESTful.

That’s not to say that a REST flavored RPC service set up can’t be useful / an improvement over a more elaborate RPC model and suitable for limited / controlled usage, but the hardliners will look down their noses at it and consider it to be degenerate / not really REST.

I had the pleasure a while ago to work with an API that had documentation that was very, very hard to understand.

Once I managed to get an actual reply from the server, it was possible to compare the documentation with the server reply and use that to decipher the documentation (and yes, deciphering it was the right term). The problem was that if a request was sent to the server that wasn’t exactly correct according to the spec, you would just get an error, and with the unreadable documentation, figuring out how to send the correct requests was close to impossible. There were also different versions of the API documentation which didn’t agree with each other and probably didn’t agree with the API itself; that didn’t help.

If there had been one command that I could send to the server, returning a list of all possible commands and how exactly to send them, that would have been extremely helpful. Discoverability is not just for clients, it’s also useful for software developers.

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật