cocoggu
cocoggu

Reputation: 391

Deal with Restler versioning

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).

Upvotes: 0

Views: 191

Answers (1)

Arul Kumaran
Arul Kumaran

Reputation: 993

  • 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)

Upvotes: 2

Related Questions