On 05/22/2013 03:00 PM, Daniel C. wrote:
On Wed, May 22, 2013 at 2:41 PM, Eric Chadbourne
<eric.chadbou...@gmail.com> wrote:
Hi All,

I've written a little web application and a friend of mine has asked for an
api.  I don't know much about this subject though rest looks understandable.
Any suggestions for something to read?  All clues welcome.

REST should be fine.  I may be old school, but I personally would
consider implementing a REST API to be "making it fancy".  When I
write one-off web apps and I want to add an API, I just publicly
expose some of the functionality (with proper security measures in
place, of course) via a page that expects a POST and which returns
some formatted text.  For example if I want an API for a personal
finance "app" (fancy word for a mish-mash of scripts) I might have the
following "API calls" (really just web pages that are more
programmer-friendly):

- login.php: post credentials to this to get authenticated
- transaction.php: you can POST to this with a couple of fields that
define the transaction amount, a short description and optionally a
category.  It prints out a simple success or failure message.
- balance.php: GET only, returns your current balance as an integer in text form

If I'm already using these filenames for the "normal" UI then I might
prepend them with api_.

-Dan

Thanks for the info Dan.  Think this is the way I'll go.

- Eric

_______________________________________________
Discuss mailing list
Discuss@blu.org
http://lists.blu.org/mailman/listinfo/discuss

Reply via email to