Andrew
Andrew

Reputation: 238717

How to create a public API using the Zend Framework?

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:

Upvotes: 8

Views: 6708

Answers (2)

Imwota
Imwota

Reputation: 11

Try out this book, http://aarce.com/resources/ebooks/Pro-Zend-Framework-Techniques.pdf . Chapter 9 explain in details how to implement Restful web-service for a Zend Application.

Upvotes: 1

Bryan M.
Bryan M.

Reputation: 17322

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.

Upvotes: 4

Related Questions