any idea what could be causing this error?
Compare your request with what official app sends. If it doesn't help, provide request here.
Yup I was using the swagger.io to send the request and was getting the same error. The request was sent as:
curl -X POST "http://myipaddress:8082/api/permissions" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"userId\": 3, \"deviceId\": 632673, \"groupId\": 0, \"geofenceId\": 4, \"calendarId\": 0, \"attributeId\": 0, \"driverId\": 0, \"managedUserId\": 0}"
Have you compared it with what official we app sends?
That led me to the answer Anton!! You're a damn genius.
edit:
for anyone looking I was sending the wrong device ID to the server. Checking the web app helped me tighten up that server call as well as all of the others.
I am try, error 400 also, I am use admin login, some body help me ?
What is the error message?
For any technical person this error message should be pretty clear. Your device id doesn't exist in the database.
hello everyone could support me I have the following problem and I do not understand what the problem is
Referential integrity constraint violation: "FK_USER_DEVICE_USERID: PUBLIC.TC_USER_DEVICE FOREIGN KEY(USERID) REFERENCES PUBLIC.TC_USERS(ID) (5)"; SQL statement: INSERT INTO tc_user_device (userId, deviceId) VALUES (?, ?) [23506-200] - JdbcSQLIntegrityConstraintViolationException (... < QueryBuilder:480 < DataManager:441 < PermissionsResource:63 < ...)
The user with whom you create both the group and the divice is administrator type
Most likely you are using wrong userId
or deviceId
value.
sorry was this mistake :
Table "TC_DEVICE_GROUP" not found; SQL statement: INSERT INTO tc_device_group (deviceId, groupId) VALUES (?, ?) [42102-200] - JdbcSQLSyntaxErrorException (... < QueryBuilder:65 < *:135 < DataManager:438 < PermissionsResource:63 < ...) lo que mando es.
$data='{"deviceId":"'.$deviceId.'","groupId":"'.$groupId.'"}';
return self::curl('/api/permissions','POST',$sessionId,$data,array(self::$jsonC));
I found the problem the table does not exist TC_DEVICE_GROUP,
what if it exists is in the table of TC_DEVICES a field called GROUPID, I suppose that the relation should be saved there.
the problem is that the API in the "Permission: object" method asks me:
deviceId: integer
Device Id, can be first parameter or second only in combination with userId
groupId: integer
Group Id, can be first parameter or second only in combination with userId
and it is who executes and sends me INSERT INTO tc_device_group
Question will it be that you need to update traccar or is there a way to upload the missing tables and that the system does not thunder to enter them manually or what would be your recommendation?
Im having trouble setting permissions for devices. I'm getting a 400 response from the server along with this error message: