background preloader

API Programming

Facebook Twitter

RESTful services with Zend Framework (Part 1) — Code in Chaos Inc. Creating a PHP REST API Using the Zend Framework « Chris Danielson's Blog. I don’t know about you, but I spent hours pouring over the Zend documentation and searching the Internet for some sort of understanding or example regarding how to do REST the correct way in PHP. I found a handful of one-offs, where everyone was writing their own core REST engine from scratch. I figure why write all the code to handle this, if you already have the Zend Framework in your code base. I believe that the ideal solution will effectively use the the Zend_Rest_Controller and ContextSwitch objects as well as offering JSON and XML formatting options.

My goal here is simple. This code example will support REST data in the format of XML and JSON . Prerequisites: PHP version > 5 Zend Framework 1.9.2 (at the minimum) The generic download page can found here . Download ZendRestExample Source . Basic Directory Structure: URLS used in this example: One of the tricky things with REST is that the URLs need to be formatted properly. And that is all there is to it. BRob On Tech » Blog Archive » Open Source Testing Tool Smackdown for REST Web Services. Recently I’ve been working on a REST API for reporting workflow status information in Alfresco. After getting some of the functionality nailed down, it really bothered me that I wasn’t able to use Test Driven Development (TDD) in the process. So I went looking, and I found quite a few open source tools out there in the wild that made good prospects for acceptance testing these REST APIs that I was working on.

It was time for a SMACKDOWN! OOOOOOOH YEAAAAAAAH! Contender #1 – Selenium I heard of Selenium in the past and have wanted to tinker with it for a long time, so I tried this one out first. Note that Selenium is really just the “brand name”; there are actually several inter-related offerings here. That was very cool, but I needed to test result sets with dynamic data, so I had to take a look at Selenium-RC, which has APIs that enable the use of your favorite programming language: Java, C#, Perl, PHP, Python, or Ruby. Oh, one other note. Contender #2 – HTMLUnit Contender #3 – JWebTest. Short List of RESTful API Frameworks for PHP. Having a web API is an essential part of doing business online today. We wanted to help get you started. So we took some time to pull together a list of the RESTful or RESTish (however you choose to view it) API frameworks, that can help you deploy your API faster. Today we are going to take a look at seven RESTful API frameworks for PHP: Dave - DAVE is a minimalist, multi-node, transactional API framework written in PHP. which contains an end-to-end API test suite for TDD, a Task model, an Active Database Model, and a stand-alone development server to get you started.

DAVE is an acronym that stands for Delete, Add, Edit, and View. These 4 methods make up the core functionality of many transactional web applications. The DAVE API aims to simplify and abstract may of the common tasks that these types of APIs require. Epiphany – A micro PHP framework that’s fast, easy, clean and RESTful. Recess - Recess is a RESTful PHP framework that can be used by both beginner and seasoned developers. Create a REST API with PHP « Gen X Design | Ian Selby.

Your apps never had it so good One of the latest (sort of) crazes sweeping the net is APIs, more specifically those that leverage REST. It’s really no surprise either, as consuming REST APIs is so incredibly easy… in any language. It’s also incredibly easy to create them as you essentially use nothing more than an HTTP spec that has existed for ages. One of the few things that I give Rails credit for is its well thought-out REST support, both for providing and consuming these APIs (as its been explained by all the Rails fanboys I work with).

Seriously, if you’ve never used REST, but you’ve ever had to work with (or worse, create) a SOAP API, or simply opened a WSDL and had your head explode, boy do I have good news for you! So, What on Earth is REST? Before we get into writing some code, I want to make sure everyone’s got a good understanding of what REST is and how its great for APIs. Requests All APIs need to accept requests. Getting Started with REST and PHP So, let’s dig in! How to Add an API to your Web Service. Introduction APIs are a great way to extend your application, build a community, excite your users and get in on the Mashup Mania spreading across the web. While there’s plenty out there wanting in on the action, there’s a lot of questions about how to actually go about creating an API for a web application.

Like everything else technical on the web these days, there are tons of complicated and scary documents out there ready to intimidate the unprepared. In an attempt to get everyone on the bus in one piece, we’ve tried to filter through the hard stuff and give an easy to understand starting point for anyone on a quest to API’ify their web service. An API, or Application Programming Interface, is a set of functions that one computer program makes available to other programs (or developers) so they can talk to it directly without having to give it access to the source code. The most popular APIs are from operating systems like Windows XP or Mac OS X. The Basics Making The Request.