Updating virtualParameters via API, fails

Hi,
trying to do a PUT or DELETE on the virtualParameters collection, fails with 404 Not Found error. The GET however, works without any problems and I couldn’t figure out why this happens. @zaidka , could you please have a look over this?
thanks

It would be helpful if you provided more information than “it doesn’t work.” Maybe provide the full URL or full curl command. What version of GenieACS you are using is helpful too…

sorry about that. I’ve tested with 1.2.0-beta.0+20200630081734 and also 1.2.5+20210521105922.

Working GET for virtualParameters collection:

$ curl -i "http://localhost:7557/virtualParameters"
HTTP/1.1 200 OK
GenieACS-Version: 1.2.5+20210521105922
Content-Type: application/json
total: 1
Date: Tue, 01 Jun 2021 19:33:45 GMT
Connection: keep-alive
Transfer-Encoding: chunked

[
{"_id":"unified_mac","script":"// Example: Unified MAC parameter across different device models\nlet m = \"00:00:00:00:00:00\";\nlet d = declare(\"Device.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.MACAddress\", {value: Date.now()});\nlet igd = declare(\"InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.MACAddress\", {value: Date.now()});\n\nif (d.size) {\n  for (let p of d) {\n    if (p.value[0]) {\n      m = p.value[0];\n      break;\n    }\n  }\n}\nelse if (igd.size) {\n  for (let p of igd) {\n    if (p.value[0]) {\n      m = p.value[0];\n      break;\n    }\n  }\n}\n\nreturn {writable: false, value: [m, \"xsd:string\"]};"}
]

Not working PUT or DELETE:

$ curl -X PUT -i "http://localhost:7557/virtualParameters/myNewVirtualParameter" --data 'return {writable: false, value: ["1", "xsd:string"]};'
HTTP/1.1 404 Not Found
GenieACS-Version: 1.2.5+20210521105922
Date: Tue, 01 Jun 2021 19:36:06 GMT
Connection: keep-alive
Transfer-Encoding: chunked

404 Not Found

$ curl -X DELETE -i "http://localhost:7557/virtualParameters/unified_mac"
HTTP/1.1 404 Not Found
GenieACS-Version: 1.2.5+20210521105922
Date: Tue, 01 Jun 2021 19:43:47 GMT
Connection: keep-alive
Transfer-Encoding: chunked

404 Not Found

Try using /virtual_parameters

curl -X DELETE -i "http://localhost:7557/virtual_parameters/unified_mac
1 Like

Thank you Dan, this works perfectly …