|Keep It Simple, Stupid|
Re: modern ways of doing web servicesby Rhandom (Curate)
|on Sep 26, 2013 at 13:47 UTC||Need Help??|
If I had any recommendation to make for an API it would be: use JSON POSTing over HTTPS. Always.
Please do not use SOAP or any other XML based transport again. Ever.
Please do not use REST. REST ends up being wildly inconsistent and offers nearly no benefit. Do not use PUT or DELETE which are supposed to have obtuse HTTP statuses and truncated response data. And for consistency, don't use GET. Always use POST.
If you need to Create, Read, Update, Delete (CRUD), then simply consistently name your methods (server_add, server_info, server_update, server_delete, user_add, user_info, user_update, user_delete). Attach those on your endpoint (https://$host/$endpoint/server_info) and be done with it.
Consistency is one hallmark of a well designed API.
Update: The JSON bit isn't required - just trendy. Replace with sereal, amqp, storable and whatever the flavor of the decade is (as long as the flavor is not XML). But make sure you justify why you're not using JSON - which is widely more usable from other languages and platforms.
my @a=qw(random brilliant braindead); print $a[rand(@a)];