The Smartcar API lets you read vehicle data (location, odometer, fuel, etc.) and send commands to vehicles (lock, unlock) using HTTP requests.
go get github.com/smartcar/go-sdk-v2
package main
import(
"context"
"log"
gosdkv2 "github.com/smartcar/go-sdk-v2"
"github.com/smartcar/go-sdk-v2/pkg/models/shared"
"github.com/smartcar/go-sdk-v2/pkg/models/operations"
)
func main() {
s := gosdkv2.New(
gosdkv2.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
ctx := context.Background()
res, err := s.Vehicles.GetLocation(ctx, operations.GetLocationRequest{
VehicleID: "36ab27d0-fd9d-4455-823a-ce30af709ffc",
})
if err != nil {
log.Fatal(err)
}
if res.Location != nil {
// handle response
}
}
- GetChargeTime - Retrieve charging completion time for a Cadillac.
- GetVoltage - Retrieve charging voltmeter time for a Cadillac.
- GetChargeTime - Retrieve charging completion time for a Chevrolet.
- GetVoltage - Retrieve charging voltmeter time for a Chevrolet.
- ListCompatibility - Compatibility
- GetBatteryCapacity - EV Battery Capacity
- GetBatteryLevel - EV Battery Level
- GetChargingLimit - EV Charging Limit
- GetChargingStatus - EV Charging Status
- SetChargingLimit - Set EV Charging Limit
- StartStopCharge - Start or stop charging an electric vehicle.
- GetAmmeter - Retrieve charging ammeter time for a Tesla.
- GetChargeTime - Retrieve charging completion time for a Tesla.
- GetCompass - Retrieve compass heading for a Tesla.
- GetExteriorTemperature - Retrieve exterior temperature for a Tesla.
- GetInteriorTemperature - Retrieve interior temperature for a Tesla.
- GetSpeedometer - Retrieve speed for a Tesla.
- GetVoltage - Retrieve charging voltmeter time for a Tesla.
- GetWattmeter - Retrieve charging wattmeter time for a Tesla.
- SetAmmeter - Set charging ammeter time for a Tesla.
- GetInfo - User Info
- DeleteManagementVehicleConnections - Delete vehicle connections by user_id or vehicle_id
- GetManagementVehicleConnections - Retrieve vehicle connections
- Batch - Batch
- LockStatus - Returns the lock status for a vehicle and the open status of its doors, windows, storage units, sunroof and charging port where available. The open status array(s) will be empty if a vehicle has partial support. The request will error if lock status can not be retrieved from the vehicle or the brand is not supported.
- Disconnect - Revoke Access
- Get - Vehicle Info
- GetEngineOil - Engine Oil Life
- GetFuelTank - Fuel Tank (US Only)
- GetLocation - Location
- GetOdometer - Odometer
- GetPermissions - Application Permissions
- GetTirePressure - Tire Pressure
- GetVin - Returns the vehicle’s manufacturer identifier.
- ListVehicles - All Vehicles
- LockUnlock - Lock/Unlock Vehicle
- Subscribe - Subscribe Webhook
- Unsubscribe - Unsubscribe Webhook
Some of the endpoints in this SDK support pagination. To use pagination, you make your SDK calls as usual, but the
returned response object will have a Next
method that can be called to pull down the next group of results. If the
return value of Next
is nil
, then there are no more pages to be fetched.
Here's an example of one such pagination call:
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release !