Home Forums Traccar API PHP Integration Unable to disable or enable device using PHP API

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #285
    AnkitaAnkita
    Participant

    Hi
    I am trying to enable or disable the device from a username. I am using below function:

    public static function deviceUpdate($sessionId,$id,$name,$uniqueId,$phone,$model,$contact,$category,$attributes,$disabled){
    $id = $id;
    $attributes = $attributes;
    if($disabled == 1) {
    $disabled = ‘true’;
    }
    else {
    $disabled = ‘false’;
    }
    $data='{“id”:’.$id.’,”name”:”‘.$name.'”,”uniqueId”:”‘.$uniqueId.'”,”phone”:”‘.$phone.'”,”model”:”‘.$model.'”,”category”:”‘.$category.'”,”contact”:”‘.$contact.'”,”disabled”:”‘.$disabled.'”,”attributes”:’.$attributes.’}’;

    return self::curl(‘/api/devices/’.$id,’PUT’,$sessionId,$data,array(self::$jsonC));
    }

    #286
    James JosephJames
    Keymaster

    Please share the part of code that you are calling this function as well!

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