background preloader

Rest API

Facebook Twitter

 Building a Decent API. PHP developers are increasingly moving over to API development, as are a lot of server-side developers.

 Building a Decent API

It's a trend thats been happening for the last few years and it's getting to the point where everyone and their dog are putting articles showing off how to build "awesome" API's. Unfortunately most of these are either woefully inadequate or are promoting bad practices. I'm not going to link to any bad examples because that's just rude, but here are some golden rules that I stick to when building out API's. Never Expose DB Results Directly If you rename a field, then your users are fucked. Use the URI sparingly, and correctly Use the query string for paired params instead of /users/id/5/active/true. Resources are EVERYTHING You're always either asking for one resource, or multiple. JSON, XML or shut up Don't spend forever trying to make your system output everything under the sun. Authentication OAuth 2 is the shit.

Caching Background all the things Pagination Do this. Response Codes Testing. One More Game-Dev and Programming Blog. My primary programming project is the game I am creating with my friends Jeff and Jesse.

One More Game-Dev and Programming Blog

But I also have to work on other projects to make a living because our game will make us no money until its completion. Some of those recent side-projects involve building PHP applications based around REST APIs. So today I want to talk about some third-party libraries and packages I have examined for use in such projects. Laravel 4: A Start at a RESTful API (Updated)

RESTful API's are hard!

Laravel 4: A Start at a RESTful API (Updated)

There are a lot of aspects to designing and writing a successful one. For instance, some of the topics that you may find yourself handling include authentication, hypermedia/HATEOS, versioning, rate limits, and content negotiation. Rather than tackling all of these concepts, however, let's instead focus on the basics of REST. Short List of RESTful API Frameworks for PHP. Having a web API is an essential part of doing business online today.

Short List of RESTful API Frameworks for PHP

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. Short List of RESTful API Frameworks for PHP. Laravel 4: A Start at a RESTful API (Updated) PHP Restful Frameworks. Short List of RESTful API Frameworks for PHP.

Nettuts+ - Part 3. Laravel 4: A Start at a RESTful API (Updated) Créer son propre "framework" PHP, pourquoi ? — Ange Chierchia. Cela fait maintenant presque deux ans que je suis entré dans la vie active en tant que développeur et designer Web.

Créer son propre "framework" PHP, pourquoi ? — Ange Chierchia

Et en tant que tel, je suis souvent (comprenez : tout le temps) amené à faire quasiment les mêmes choses, bien que chaque projet soit différent. Personnellement j’aime passer du temps à peaufiner un design. je déteste réécrire les mêmes fonctions pour chaque projet. Alors oui, il a les framework, mais pourquoi utiliser un bazooka lorsqu’on doit abattre une mouche ? Attention, l’article est un chouilla trop long (beaucoup de lignes de code). Oui utiliser une CMS déjà tout fait c’est bien, oui utiliser un framework en PHP Objet c’est bien. Ces dernier mois, au fil des projets qui le permettaient, j’ai pu me construire ma propre bibliothèque de fonctions, en essayant de l’améliorer à chaque itérations, tout en restant le plus générique possible pour permettre une très bonne portabilité de projet en projet.

Mes fonctions de CRUD Ajouter un enregistrement dans une table Fin ! Create a REST API with PHP « Gen X Design. 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.

Create a REST API with PHP « Gen X Design

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? Create a RESTful Services API in PHP. Are you working with multiple devices like iPhone, Android and Web then take a look at this post that explains you how to develop a RESTful API in PHP.

Create a RESTful Services API in PHP.

Representational state transfer (REST) is a software system for distributing the data to different kind of applications. The web service system produce status code response in JSON or XML format. Making RESTful Requests in PHP « Gen X Design. How to GET, POST, PUT, & DELETE in PHP APIs have become a very commonplace part of many popular web sites and services… especially REST APIs.

Making RESTful Requests in PHP « Gen X Design

I’ve already discussed how you can roll your own REST API for your PHP apps, but I’ve also received countless requests to go over how to actually make RESTful requests. Create a REST API with PHP « Gen X Design. Representational State Transfer. Un article de Wikipédia, l'encyclopédie libre.

Representational State Transfer

HTTP Status Codes. The 511 status code indicates that the client needs to authenticate to gain network access.

HTTP Status Codes

The response representation SHOULD contain a link to a resource that allows the user to submit credentials (e.g. with a HTML form). Note that the 511 response SHOULD NOT contain a challenge or the login interface itself, because browsers would show the login interface as being associated with the originally requested URL, which may cause confusion. The 511 status SHOULD NOT be generated by origin servers; it is intended for use by intercepting proxies that are interposed as a means of controlling access to the network.