How do I get or change vehicle name with the SDK?

Applies To

  • MyGeotab SDK
  • Set
  • Name

Procedure

You can pull in a vehicle and it's name field using the below:

api.call("Get", {
    "typeName": "Device",
    "search":{
        "id":"<device id>",
    }
}, function(result) {
    result[0].name = "<Name to be changed>";
}, function(e) {
    console.error("Failed:", e);
});

 

It is recommended to ensure all current data for the entity is first retrieved, modifications done, then everything is sent back together within the entity in a Set() call.