Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] api? rest maybe?



On Wed, May 22, 2013 at 2:41 PM, Eric Chadbourne
<eric.chadbourne at 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



BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org