Topic: Writing an API

Hello,
I have my application in ruby on rails (3.2),  and now I want to expose some API to allow other developers to use some functionality.
How cai I do it? somebody knows a very good tutorial?
Thanks to all.

Re: Writing an API

It depends on what you really mean.

Do you have some code you developed during the construction of your app that you want to package up so others can use that code?

Or do you want to allow other developers to be able to visit various URLs on your site and make use of the functionality of your running website.

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Writing an API

The second purpose is what i mean.
I want to build something like the facebook open graph API, I want to male some functionality available by restfull calls

Re: Writing an API

One the one hand it's a matter of documentation.  If you like the Facebook API,  I'd use their documentation format as the basis for how you document your API.  The API already exists,  you just need to document it.

Keep in mind your API can really only document GET requests,  POST, PUT and DELETE are protected by the csrf meta token.   You can turn off the check,  but then you expose your site to csrf attack.  You'd have to do something like implement a key to send to users, like Google used to do for googlemaps, if you want external users to be able to modify any resources in your application.

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.