0

I'm trying to use Restler versioning but there is something i don't get.

On the BMI example it's written that:

Only integers are supported for versioning. When not specified explicitly the version is assumed to be one.

But in your example, the v2 is explicitly specified with:

$r->setAPIVersion(2);

... and the default version when accessing /_011_versioning/bmi.json is still v1 !

So I don't get it, what the setAPIVersion() function really do ? Maybe I miss some documentation part (my English isn't that fluent)

Thanks you again for your quick and efficient support (not the first time I'm asking questions here).

Cœur
  • 37,241
  • 25
  • 195
  • 267
cocoggu
  • 401
  • 7
  • 18

1 Answers1

2
  • By calling setAPIVersion we are setting the maximum api version we support
  • We want to support existing api users with out braking their app, thats why we need to serve version 1 when the api user does not specify a version
  • Once the user is ready to user v2 of the api, they will request for v2 by
    • specifying version in the url, if we support url based versioning
    • specifying version in the header, if we support vendor media type (which is the next example)
Arul Kumaran
  • 983
  • 7
  • 23
  • 1
    Thank you ! Exactly as I expected ! Another question : Do you know if there is a way to avoid to set all the classes and functions into a "v1" or "v2" namespace ? Thank you again – cocoggu Apr 01 '14 at 13:47
  • By default, all the classes belongs only in their versions. RC5 adds sine flexibility with `iProvideMultiVersionApi` interface by implementing it in your api, you can set the maximum supported version. So if v1 of a class needs no change for v2 but needed in v2 api you can make it available – Arul Kumaran Apr 02 '14 at 03:58