Any changes on API

Synergy Dave8 months ago

Hello,
I just upgraded from 4.x to 6.1
Everything seems to be working fine except sending commands via TCP to devices

/devices?uniqueId=xxxxxxxxxxxxxxxxx

returns status 200 but response is empty.
same for the /devices command

I used to have this code working:

....
if (response.status >= 200 && response.status < 300) {
                const messageData = await response.json();
                return messageData[0];  //will contain all device details
 }

now messageData contains [] and thus messageData[0] is undefined

Anton Tananaev8 months ago

It should still work. Make sure you have permissions for that device.

Synergy Dave8 months ago

same code here https://github.com/traccar/traccar-web/blob/de420d4088ee8c34d463e2614f759702e11803e1/src/Navigation.jsx#L77

When upgrading the mySQL DB was migrated too, should I recreate it?

Synergy Dave8 months ago

I'm using default admin credentials: admin/admin as email and password to open session
and getting my session: JSESSIONID=node0ofid40ejzis41tpoa06rz7zv55.node0; Path=/

as mentionned earlier even, the /devices call returns empty list

Anton Tananaev8 months ago

The device still needs to be linked to the user for this to work.

Synergy Dave8 months ago

well, any query to do it
when I run select id,uniqueid from tc_devices where uniqueid=353701097550129;
the device is there.
How to link all devices to admin, they used to work for this db, it was an upgrade.

Anton Tananaev8 months ago
Synergy Dave8 months ago
 select * from tc_user_device;

is empty

I did:

insert into tc_user_device(deviceid, userid) select id , 1 from tc_devices;

and now it's working:
I wonder why update emptied the tc_user_device device?

and are the new devices will be linked automatically, I've this config:

    <entry key='database.ignoreUnknown'>false</entry>
    <entry key='database.registerUnknown'>true</entry>
    <entry key='database.saveEmpty '>false</entry>
Anton Tananaev8 months ago

They won't be linked automatically, but you can automatically add them to a group. That way they will be accessible through the group.