ibexa

Path

ez publish / technical manual / 4.5 / features / rest api / extension functionality / steps / step 2: understanding rest...


Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

  • Step 2: Understanding REST API versioning

    The resource URIs contain a version token which is build as “v + integer”, for example v1 for REST API version one, v2 for version two and so on. Based on the version information provided in the resource URI the pre-routing filter extracts version information and matches against defined versioned routes.

    The “ezpRestVersionedRoute” is a route wrapper around existing instance of “ezcMvcRoute” object providing multiple versions of it. Find an example of a versioned routes definition below:

    URI: /api/provider/v1/foo

    new ezpRestVersionedRoute( new ezcMvcRailsRoute( '/foo', 'ezxRestController', 'foo' ), 1 )
    

     URI: /api/provider/v2/foo

    new ezpRestVersionedRoute( new ezcMvcRailsRoute( '/foo', 'ezxRestController', 'fooBar' ), 2 )
    

    For the first URI the

    ezxRestController::doFoo()
    

     method will be executed, which is version one. For the second URI which is a version two,

    ezxRestController::doFooBar()
    

    will be called. Both methods can share implementation logic but differ with the output result for instance.

    Geir Arne Waaler (19/01/2011 11:02 am)

    Geir Arne Waaler (21/01/2011 9:42 am)


    Comments

    There are no comments.