A Go SDK and CLI tool for the Mercedes-Benz Connect Your Fleet APIs, and Vehicle Specification APIs.
- Support for the Vehicle Management API
- Support for the Services Catalog API
- Support for the Push API
- Support for the Vehicle Specification API
$ go get github.com/way-platform/mbz-goctx := context.Background()
// Create a Mercedes-Benz API client.
client, err := mbz.NewClient(
ctx,
mbz.WithRegion(mbz.RegionECE),
mbz.WithClientID(os.Getenv("MBZ_CLIENT_ID")),
mbz.WithClientSecret(os.Getenv("MBZ_CLIENT_SECRET")),
)
if err != nil {
panic(err)
}
// List vehicles in the account.
response, err := client.ListVehicles(ctx, &mbz.ListVehiclesRequest{})
if err != nil {
panic(err)
}
for _, vehicle := range response.Vehicles {
fmt.Println(vehicle.VIN)
}
// For all available methods, see the API documentation.The project is built using Mage, see tools/magefile.go and the tools/mage helper script.
$ ./tools/mage buildFor all available build tasks, see:
$ ./tools/mage -lThe mbz CLI tool enables interaction with the APIs from the command line.
go install github.com/way-platform/mbz-go/cmd/mbz@latestPrebuilt binaries for Linux, Windows, and Mac are available from the Releases.
The CLI tool has a simple Kafka consumer that can read from a Push API Kafka topic.
$ mbz consume-vehicle-signals --consumer-group $MBZ_CONSUMER_GROUP --topic $MBZ_TOPIC
{
"messageId": "54979700-c5c3-44ff-9ffa-5e961d7da84b",
"vin": "S0FTCARMB00000001",
"timestamp": 1753362541271,
"messageType": "vehiclesignal",
"version": "1.0",
"serviceId": "1003",
"sendingBehaviour": "ON_CHANGE",
"data": {
"signals": [
{
"name": "Driving.Range.Fuel.Warning",
"timestamp": 1753362541025,
"value": "false",
"type": "boolean"
},
{
"name": "Tank.Fuel.Level.Absolute",
"timestamp": 1753362541025,
"value": "36",
"type": "integer"
},
{
"name": "Tank.Fuel.Level.Warning",
"timestamp": 1753362541025,
"value": "false",
"type": "boolean"
}
]
}
}This SDK is published under the MIT License.
Security researchers, see the Security Policy.
Be nice. For more info, see the Code of Conduct.
