HTTP is one thing – Resource Oriented Application Framework – Everything is a resource



HTTP is one thing – Resource Oriented Application Framework – Everything is a resource

0 0


http-is-one-thing


On Github koriym / http-is-one-thing

HTTP is one thing

Resource Oriented Application Framework

Akihito Koriyama / @koriym

APPLICATION

PROGRAMING

INTERFACE

We all know how important API’s are.

APIs rule everything around us

  • as a hub
  • as a core value
Companies are developing api's as the core part of their online infrastructure.

ADD

API Driven Development

So this means the API service is also core when programming.

HADD

Hypermedia API Driven Development

API's are great but in order to gain a richer service environment then going the next step of introducing hypermedia into our API's is important. We could call this HADD.

BEAR.Sunday

A resource oriented framework

Three frameworks inside

  • DI
  • AOP
  • Hypermedia

BEAR.Resource

Hypermedia framework for object as a service

REST Constraints

  • Addressability
  • Unified Interface
  • Stateless Request
  • Connectedness

...to Object

Everything is a resource

  • MVC
  • [R]

Object as a service

class Order
{
    /**
     * @Link(rel="payment", href="app://self/payment{?order_id, card_number}", method="put")
     */
    public function onPost($drink)
    {
        // component layer (business logic)
        ...
        $this->code = 201;
        return $this;

                        

HypermediaAs The Engine Of Application State

$order = $resource
    ->post
    ->uri('app://self/order')
    ->withQuery(['drink' => 'latte'])
    ->eager
    ->request();

$payment = [
    'credit_card_number' => '123456789'
];

$response = $resource->href('pay', $payment);

echo $response->code; // 201 Created
                    

Representation

    echo $resourceObject;

    // html / json / xml
                    

Screen

The Key of success of web

  • URI
  • Unified Interface
  • Hyper Link

Hypermedia for productivity

  • Sequence management
  • Marshaling tool
  • Decoupling components
It’s easy to manage relationships between resources

"HTTP is one thing"

Why should we separate the API and HTML ?

HTTP is a single entity.

The API is core, REST is central.

Resource oriented framework ? REST application framework ? REST centered architecture.

bearsunday.github.io