Does anyone have experience implementing an api with Zend framework? I see it's possible to implement index, get, post, put, delete for the api, then implement new and edit actions for the web in the same controller. But is this a good idea? I want to know if this implementation has been tested enough that people don't get problems with it down the road.
1 Answer
I've had success using the Context Helper to give 'API' access using the same URI structure as the 'normal' site. Then API consumers just have to POST data like a normal form. Depending on the complexity of your needs, that might work for you.
Also, it should be noted that Zend provides a REST router that may be useful.
1 Comment
Tim Lytle
@sullivan I wasn't actually using the rest router, in my case the API was added after the initial work was done. So I simply used the context switch to provide an easily parsed format of each 'page'. I've thought of using
.xml but haven't pursued it yet. Seems it would take customizing the route someway.