CakeDC / cakephp-api

API Plugin for CakePHP
Other
61 stars 33 forks source link

exisiting v1 api no longer works #48

Closed birdy247 closed 5 years ago

birdy247 commented 6 years ago

We have an api/v1 prefix which we used for our 1st api version.

We have since used this plugin and created a v2. The calls to v2 work fine, but all calls to our v1 (exisitng) api now result in a class not found. We have placed the ApiMiddleware at the end of the middleware queue.

Without changing the version prefix, is there a solution to this?

Thanks

skie commented 6 years ago

Here is an example of working parallel two api versions.

http://localhost:8765/api/v1/posts returns

...

    "data": [
        {
            "id": 1,
            "title": "test",
            "author": "author",
            "body": "message",
            "created": null,
            "modified": null,
            "version": "v1"
        }
    ],
...

and

http://localhost:8765/api/v2/posts returns

...

    "data": [
        {
            "id": 1,
            "title": "test",
            "author": "author",
            "body": "message",
            "created": null,
            "modified": null,
            "version": "v2"
        }
    ],
...
skie commented 6 years ago

See how versions code organized in App/Service folder.