Am I the only one who doesn't like receiving direct orders from article titles?
Stop Writing REST API Clients
71–80 of 137 posts
Re: Stop Writing REST API Clients
#72All that these sorts of description produce is a low-level API. That can be useful, but what's really needed are high-level APIs that provide meaningful semnatics: my $me = Facebook->new( username => 'autarch' ); $me->post_status("I'm on Hacker News writing this comment"); my $friend = Facebook->new( username => 'imaginary' ); $me->post_on_wall( $friend, "Hey buddy, I am on Hacker News writing this comment" );
Re: Stop Writing REST API Clients
#73Substitute "XML" for "JSON" and we've now come full circle. The point about REST is that it is self-describing. And ideally should be using the same URIs as the version people clicking around in Firefox or Chrome see. The API is just the XML or JSON or whatever is flavour of the week version of the HTML version. (Or we could use embedded data—microformats, microdata, RDFa—and get rid of that distinction.)
Yes my argument is simply that we publish API specs in a machine-readable format to avoid wasting time implementing clients repeatedly. WSDL and WADL had good intentions at heart, but XML is ugly. JSON is nice since it's human-readable and light. Why not publish JSON versions openly for REST APIs, reducing implementation cost for clients?
...
> ... XML is ugly. JSON is nice since it's human-readable and light.
???
Re: Stop Writing REST API Clients
#74Earlier quoted context omitted.
I don't think there is a well-known way to self-describe available and required parameters nor any other validation requirements, or am I wrong?
I agree. The promise of REST APIs is that will be self describing, but for that benefit to be realized, we need general purpose REST clients that can "discover" everything they need to know given just a root uri. Are there any such clients? And no, web browsers do not count.
OPTIONS /somePath?
Re: Stop Writing REST API Clients
#75Am I the only one who doesn't like receiving direct orders from article titles?
Re: Stop Writing REST API Clients
#76While this has some benefits, it seems like a slippery slope leading back to SOAP.
From someone who is unexperienced in soap, what is the problem with it?
Re: Stop Writing REST API Clients
#77Re: Stop Writing REST API Clients
#78Substitute "XML" for "JSON" and we've now come full circle. The point about REST is that it is self-describing. And ideally should be using the same URIs as the version people clicking around in Firefox or Chrome see. The API is just the XML or JSON or whatever is flavour of the week version of the HTML version. (Or we could use embedded data—microformats, microdata, RDFa—and get rid of that distinction.)
Yes my argument is simply that we publish API specs in a machine-readable format to avoid wasting time implementing clients repeatedly. WSDL and WADL had good intentions at heart, but XML is ugly. JSON is nice since it's human-readable and light. Why not publish JSON versions openly for REST APIs, reducing implementation cost for clients?
Re: Stop Writing REST API Clients
#79Earlier quoted context omitted.
Well, to be fair, JSON is at least a lot less verbose than WSDL. So there's that.
WSDL describes a pact between a client and a server so they can't screw it up. Comparing WSDL to WADL would make sense. JSON just describes objects in compact notation. Comparing JSON to XML would make sense when XML is only used to describe objects and nothing more. WSDL and WADL and HTML are all XML derivatives. WSDL and WADL could never exist or HTML for that matter if trying to use JSON to describe them since tha…
Oh, and it's perfectly feasible to translate a well formed HTML document into some sort of JSON object. After all, HTML is just a set of tags with values, no?
Re: Stop Writing REST API Clients
#80That's the path I've been using in all projects lately - because frankly - I don't want to deal with a bunch of different API clients for Twitter, Facebook, Soundcloud, Instagram or whatever sites it is that I integrate with - all those different syntaxes and all that duplicated code etc doesn't help me - I want all of their individual differences hidden away for me and colleagues behind a single well known syntax which I myself can extend to expose the resources and methods that I need - like if I need it a method for posting a photo for the API:s that support that and so on.
My advice today would be: Pick a good HTTP client, preferably with good OAuth support, and then build your own extendable API-client on top of that and integrate all the different API-resources you need with that client whenever you need them.