Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matthew Weier O'Phinney:
Apigility: Using RPC with HAL
Mar 28, 2014 @ 15:48:37

Matthew Weier O'Phinney has a new post sharing some of the details about using RPC and HAL in the Apigility API tool from Zend. HAL stands for "Hypermedia Access Language" and basically provides a way to define objects in an API and what they relate to.

A few days ago, we released our first beta of Apigility. We've started our documentation effort now, and one question has arisen a few times that I want to address: How can you use Hypermedia Application Language (HAL) in RPC services? Hypermedia Application Language is an IETF proposal for how to represent resources and their relations within APIs. Technically, it provides two mediatypes, application/hal+json and application/hal+xml; however, Apigility only provides the JSON variant.

He introduces some of the basics of HAL and includes an example of JSON output showing metadata about the current object such as a full link to the resource. He also includes an example of the "embedded" data, additional related data, other objects, with their own structure and links. He also briefly mentions what RPC is and how it works before getting into how to set up the endpoints in your Apigility API with the help of "ContentNegotiation" functionality.

tagged: apigility hal rpc tutorial introduction

Link: http://mwop.net/blog/2014-03-26-apigility-rpc-with-hal.html

Matthew Weier O'Phinney:
RESTful APIs with ZF2, Part 1
Feb 12, 2013 @ 17:40:26

Matthew Weier O'Phinney has posted the first part of a new series he's been working on about creating RESTful APIs with the help of Zend Framework v2. In this part, he looks at things like the "Richardson Maturity Model" and "Hypertext Application Language" as parts of development of the API too.

RESTful APIs have been an interest of mine for a couple of years, but due to circumstances, I've not had much chance to work with them in any meaningful fashion until recently. Rob Allen and I proposed a workshop for PHP Benelux 2013 covering RESTful APIs with ZF2. When it was accepted, it gave me the perfect opportunity to dive in and start putting the various pieces together.

After going over the "Richardson Maturity Model" for the REST structure he spends the rest of the post looking at HAL ("Hypertext Application Language") structure and examples. He mentions the media types it uses, how it handles links between resources and how to embed a resource into the resulting response.

tagged: restful rest api zendframework2 richardson maturity model hal tutorial hypertext application language

Link:


Trending Topics: