Custom endpoint

Hi !

Could you please point me to the doc that details how to have a custom endpoint ?

Using my studio addon, my tests work all right, and the following url returns the correct data.
But I don’t find a way to get rid of the addon version (0.1.2 here) in the url.
(we don’t want to change the calls everytime the addon version changes)
http://myserverayon:5000/api/addons/myaddon/0.1.2/get-test-data/myProjectName

.

.

I have used the method found in those examples :

Paths to addon endpoints always contain the addon name and version, since all endpoints from all versions are always exposed. In the future, we might add placeholders that you could use (for example /api/addons/my_addon/production/my_endpoint but we’re not there yet. If you need to add a top level endpoint, you may try a different approach (addon-less).

Check, how API routes are constructed in ayon-backend/api - each directory contains one or more endpoints and in the __init__.py exports “router” object. If you implement your endpoints that way, you can then either build your own Ayon image or mount this directory as a volume to your existing container:

volumes:
  - /path/to/my/router:/backend/api/my_router
1 Like

Thanks Martin.

Here is why I’m asking :

If we code a custom endpoint, to be used by other departments, we can’t tell them it’s a moving target, they need a fixed url, as in usual REST APIs.
Because other departments can’t use self.version or similar, as the calls are done from other softwares.

The future “production” placeholder solution that you described, would be perfect !

Thanks !
:heart_eyes:

Do I need to create a feature request on the ayon-backend repo ?

1 Like

I have created a feature request :