Can't get the device paramater via API

Good day,

we have an a peculiar device from china brand (VSOL) that was so messy that its device id can’t be queried via API because most likely for the encoded + symbol part of its device id

curl --location --request POST ‘http://10.0.63.10:7557/devices/1CEF03-XPON%2B2GE%2B2WIFI-123451CEF032957C2/tasks?timeout=3000&connection_request
–header ‘Content-Type: application/json’
–data-raw ‘{
“name”: “getParameterValues”,
“parameterNames”: [
“InternetGatewayDevice.ManagementServer.ConnectionRequestPassword”
]
}’

No such device

we manage to fix this by editing one liner code in genieacs, we are willing to contribute the code if needs to be @zaidka

1 Like

Actually this is the correct behavior. You need to percent-encode the device ID in your HTTP request. It’ll look like it’s double encoded but it’s not really because the percent symbol is part of the ID string.

You’re right we reverted the code and in our wrapper script we make a JavaScript equivalent of encodeURIComponent in PHP and encode the device id and it work flawlessly thanks for the hint

Hi dude, I have the same trouble, please, can u tell me how to fix it ?

use this function to encode device id and it should work

function encodeURIComponent($str) {
    $revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')');
    return strtr(rawurlencode($str), $revert);
}