Home Forums Traccar API PHP Integration assignUserGeofence

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #219
    José FelizbertoJosé Felizberto
    Participant

    Hello James,

    I am trying to create a new method called “assignUserGeofence” in “traccar Api-1.1.php” , but, unfortunately it is NOT working:

    public static function assignUserGeofence($sessionId,$userId,$geofenceId){
    $data='{“userId”:”‘.$userId.'”,”geofenceId”:’.$geofenceId.’}’;
    return self::curl(‘/api/permissions’,’POST’,$sessionId,$data,array(self::$jsonC));
    }

    Can you help-me?

    JB

    #221
    José FelizbertoJosé Felizberto
    Participant

    I am recivining this erro:

    Codigo erro: 400
    Cannot add or update a child row: a foreign key constraint fails (traccaroficial.tc_user_geofence, CONSTRAINT fk_user_geofence_geofenceid FOREIGN KEY (geofenceid) REFERENCES tc_geofences (id) ON DELETE CASCADE) – SQLIntegrityConstraintViolationException (… < QueryBuilder:480 < DataManager:441 < PermissionsResource:63 < …)

    Help please

    #224
    James JosephJames
    Keymaster

    Hi,

    What database are you using? and has anything been changed in the database or any customizations done?

    Based on the error, it is something to do with the database.

    #229
    José FelizbertoJosé Felizberto
    Participant

    Thank you. I will do double check in MySQL database.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.