openwisp-controller icon indicating copy to clipboard operation
openwisp-controller copied to clipboard

undocumented endpoints and swagger API access

Open dberardo-com opened this issue 2 years ago • 4 comments

i was going through the openwisp-config script and found out that the core endpoints, such as download-configuration: https://github.com/openwisp/openwisp-config/blob/master/openwisp-config/files/openwisp.agent#L920 are undocumented on the openwisp-controller doc. indeed it seems the controller doc is actually using a different API spec: https://github.com/openwisp/openwisp-controller/tree/1.0#download-device-configuration since the config endpoints are flagged as legacy in the code: https://github.com/openwisp/openwisp-controller/blob/master/openwisp_controller/config/utils.py#L153

why is there a discrepancy between the 2 APIs and how could one access the API documentation currently in use by the controller to serve openwisp-config clients?

also: is there an online version of the swagger API available via the demo: https://openwisp.org/demo.html ?

dberardo-com avatar Oct 22 '23 14:10 dberardo-com

also, it seems that some endpoints, such as "checksum" are undocumented in this repo. where to find those ?

dberardo-com avatar Oct 22 '23 14:10 dberardo-com

The logic is here: https://github.com/openwisp/openwisp-controller/blob/master/openwisp_controller/config/utils.py#L113-L180 https://github.com/openwisp/openwisp-controller/tree/master/openwisp_controller/config/controller

It's been developed before django-rest-framework and swagger were integrated, it's not REST API but some HTTP endpoints designed specifically for the OpenWrt agent, which retain some logic which was previosuly built in ruby on rails (2008-2016).

nemesifier avatar Oct 23 '23 07:10 nemesifier

ok, are you planning to release a new version of the agent to adapt to the new API or is it not planned yet?

t's been developed before django-rest-framework and swagger were integrated, it's not REST API but some HTTP endpoints designed specifically for the OpenWrt agent, which retain some logic which was previosuly built in ruby on rails (2008-2016).

i understand that this API is therefore undocumented right ? is there any hint of what needs to be bundled in the configuration compressed folder ?

dberardo-com avatar Oct 23 '23 08:10 dberardo-com

ok, are you planning to release a new version of the agent to adapt to the new API or is it not planned yet?

It's been working well enough so far so if it's not broken we shouldn't fix it. In the future we may look at impementing something more performant and scalable but we need to secure funding beause it requires months of work.

t's been developed before django-rest-framework and swagger were integrated, it's not REST API but some HTTP endpoints designed specifically for the OpenWrt agent, which retain some logic which was previosuly built in ruby on rails (2008-2016).

i understand that this API is therefore undocumented right ? is there any hint of what needs to be bundled in the configuration compressed folder ?

Yes, it's not documented because it's not supposed to be used by humans. Developers wanting to use these endpoints are expected to be able to read the code. I don't understand the question, if you could be more specific I can try to help.

nemesifier avatar Oct 23 '23 08:10 nemesifier