OPNsense Forum

English Forums => Development and Code Review => Topic started by: kahrens on April 18, 2024, 04:59:54 PM

Title: API Error 400 - Controller not found
Post by: kahrens on April 18, 2024, 04:59:54 PM
Hi,
we are planning to automate a few different tasks on our OPNsense and use the API for the first time.

When trying to execute API Calls, for some controllers I get "{"message":"controller OPNsense\\Interfaces\\Api\\LaggSettingsController not found","status":400}"

But some other ones work and send a result.. no problems for routes/gateway, proxy/service or firewall/alias_util.

Some that don't work: VlanSettingsController, LaggSettingsController or BackupController

An example of the Request with LaggSettingsController: curl -k -u KEY:SECRET https://IP/api/interfaces/lagg_settings/get which results in the error above.

Am I missing something obvious? It's pretty confusing as for some it works and for some it doesnt. I have just updated the system to the newest version, it didnt work before or after the updates.
Thanks for your help in advance.

Regards,
Kevin
Title: Re: API Error 400 - Controller not found
Post by: franco on July 10, 2024, 08:28:51 AM
Hi Kevin,

What version are you using? LAGG API is available since 23.7 so that's a bit ago but just checking.

Grepping reveals that the url should be correct, but the action is getItem:

% git grep lagg_settings/get
src/opnsense/mvc/app/views/OPNsense/Interface/lagg.volt:                get:'/api/interfaces/lagg_settings/getItem/',


Cheers,
Franco