Skip to content

An unofficial, simple Go API client for Volvo's vehicle APIs

License

Notifications You must be signed in to change notification settings

jakeisonline/go-volvo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-Volvo

A simple Go API client for Volvo's APIs

Very much work in progress. Hoping to create a small, simple API client for Go.

Getting Started

Get the Volvo Go API Client as a new module in your project:

go get github.com/jakeisonline/go-volvo

Import the package into your project:

import "github.com/jakeisonline/go-volvo/api"

Initialise a new API client:

client := api.NewClient("YourApiToken")
client.setAccessToken("YourAccessToken")

Now, make a call to an endpoint of your choice:

resp, err := client.Call("vehicles", "")
if err != nil {
  fmt.Print(err)
} else {
  body, err := io.ReadAll(resp.Body)
  if err != nil {
    fmt.Print(err)
  }
  defer resp.Body.Close()

  var response *api.VehiclesResponse
  api.UnmarshalAndCheck(body, &response)
  fmt.Println(response.Data)
}

Roadmap

  • Initiate auth code flow
  • Exchange auth code for access token
  • Auto refresh access token
  • Full API Support
    • Connected Vehicle API (in progress)
    • Energy API
    • Extended Vehicle API
    • Location API

Spec vs. Actual Responses

The official Volvo docs are great, and have been invaluable for this project. I have noted a few what appear to be errors in the documentation, however.

  • /connected-vehicle/v2/vehicles/{vin}/doors documents carLocked named object being returned, but actual object name is centralLock
  • /connected-vehicle/v2/vehicles/{vin}/statistics documents averageFuelConsumptionAutomatic and averageEnergyConsumptionAutomatic named objects, but these are seemingly never returned
  • /connected-vehicle/v2/vehicles/{vin}/vehicle documents interiorImageURL named object being returned, but actual object name is internalImageUrl
  • /connected-vehicle/v2/vehicles/{vin}/diagnostics documents serviceTrigger named object being returned, but this seemingly never returns. Additionally, washerFluidLevelWarning returns but is not documented
  • /connected-vehicle/v2/vehicles/{vin}/windows returns a sunroof objects, which is not documented

About

An unofficial, simple Go API client for Volvo's vehicle APIs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages