-
Notifications
You must be signed in to change notification settings - Fork 594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add API route for a check plugin #703
Comments
I tried adding this to my from rest_framework import routers, serializers, viewsets, mixins
from cabot import create_viewset, status_check_fields
router = routers.DefaultRouter()
router.register(r'status_go_checks', create_viewset(
arg_model=StatusGoStatusCheck,
arg_fields=status_check_fields + (
'node_type',
'enode',
),
)) But worker fails to start with:
|
Worker shows in logs this:
|
I think I figured it out, based on looking at this method: Lines 174 to 187 in eb0b354
Specifically this part: urlpatterns += [
url(r'^plugins/%s/' % plugin, include('%s.urls' % plugin))
] Which means that the contents of |
I managed to get a route working by adding this: from django.conf.urls import include, url
from rest_framework.routers import DefaultRouter
from cabot.rest_urls import create_viewset, status_check_fields
from .models import StatusGoStatusCheck
api_router = DefaultRouter()
api_router.register(r'status_go_checks', create_viewset(
arg_model=StatusGoStatusCheck,
arg_fields=status_check_fields + (
'node_type',
'enode',
),
))
urlpatterns = [
url(r'^api/', include(api_router.urls)),
# other routes omitted
] And by doing this I managed to find my route using the
Which showed me that I can now access the API under: |
I'm not sure if there is an easy way to put this directly under |
@jakubgs I'm not sure you meant to post this on this repo? |
Heh, true, that's what happens when you have too many tabs and working on too many issues at the same time. |
I've created a custom check plugin for my use case:
https://github.com/status-im/cabot-check-status-go
And it works great, but the problem is that there is no API route available to programatically create the checks.
How would one go about adding the API route to a plugin? Is this even doable within a plugin?
Or would it require changes to Cabot itself?
The text was updated successfully, but these errors were encountered: