views:

75

answers:

1

I have an idea for a web application that would be great if it also had a public API for people to use and interact with. I want people to be able to create their own mobile and desktop applications that interact with the API. Specifically, I want to create an iPhone application that will interact with the API.

I will be building the application with the Zend Framework. I have never created an API, so what do I need to know about creating an API using the Zend Framework? Any tutorials, or advice would be appreciated.

Specifically, I am wondering...If I decide to use XML or JSON as the format, how do I return the data in that format for the client application to use?

Update: I realized that I needed to learn what type of API I wanted to implement. REST and RPC are basically the two different kinds of APIs. REST is the most simple and common, so I have decided to implement a RESTful API.

Update: Here are some resources I've collected so far:

+1  A: 

Have a good look at Matthew Weier O'Phinney's presentation on architecting Ajax apps with Zend Framework, it will probably answer many of your questions.

It's hard to make any specific recommendations, but I would create two modules: one for the web, and one for the API. Both modules would talk to a flexible service layer built on top of your domain models that make it easy to represent your data as both HTML and whatever API format you choose.

Bryan M.
that's a good presentation! mentions most of the things I'm interested in. I wish it were a blog post instead. Not a lot of detailed explanation, which is probably what I am looking for.
Andrew
There is! http://weierophinney.net/matthew/archives/227-Exposing-Service-APIs-via-Zend-Framework.html#extended and http://weierophinney.net/matthew/archives/228-Building-RESTful-Services-with-Zend-Framework.html#extended
Andrew