[Discuss] api? rest maybe?
Daniel C.
dcrookston at gmail.com
Wed May 22 15:00:51 EDT 2013
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
More information about the Discuss
mailing list