API result:failed

Started by stuckoff, February 02, 2025, 10:14:48 AM

Previous topic - Next topic
Hi

I'm trying to automate some simple tasks on OPNSense via the API, but for some reason here is my cURL commnad:
curl -H Accept: application/json -k -u  XXXXXXXXX:XXXXXXXXX https://192.168.100.3/api/interfaces/vlan_settings/addItem  -d '{vlanif:vlan0.777,if: lagg1,tag: 777,pcp:0,proto:,descr:VLAN_777_TEST}'
The result of this is:
{"result":"failed"}
At the same time if I change the request to:
curl -H Accept: application/json -k -u  XXXXXXXXX:XXXXXXXXX https://192.168.100.3/api/interfaces/vlan_settings/get
the system returns correct response.

Do I need to change the data format?