On-demand Rides and Deliveries Solution is currently available only to select partners.

Client libraries

Client libraries are highly language idiomatic and provide a better developer experience over raw REST or gRPC.

If instructions do not exist in your application's language, using gRPC or the Fleet Engine REST endpoints are recommended.

A signed JWT, in the format described in Authentication and Authorization, must be present in order to authenticate with Fleet Engine. You can generate tokens from your terminal that are valid for one hour which can be helpful when testing either your gRPC or REST client for the first time. To learn more, see the Generating a JWT for testing section on the Authentication and Authorization page.

Java

Java libraries are published under google.maps.fleetengine.v1.

Gradle

plugins {
  id "maven-publish"
  id "com.google.cloud.artifactregistry.gradle-plugin" version "2.1.4"
}

publishing {
  repositories {
    maven {
      url "artifactregistry://us-maven.pkg.dev/fleetengine-gapic/maven"
    }
  }
}

repositories {
  maven {
    url "artifactregistry://us-maven.pkg.dev/fleetengine-gapic/maven"
  }
}

dependencies {
  implementation 'com.google.maps:gapic-google-maps-fleetengine-v1-java:0.0.197'
}

Maven

<project>
  <distributionManagement>
    <snapshotRepository>
      <id>artifact-registry</id>
      <url>artifactregistry://us-maven.pkg.dev/fleetengine-gapic/maven</url>
    </snapshotRepository>
    <repository>
      <id>artifact-registry</id>
      <url>artifactregistry://us-maven.pkg.dev/fleetengine-gapic/maven</url>
    </repository>
  </distributionManagement>

  <repositories>
    <repository>
      <id>artifact-registry</id>
      <url>artifactregistry://us-maven.pkg.dev/fleetengine-gapic/maven</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <build>
    <extensions>
      <extension>
        <groupId>com.google.cloud.artifactregistry</groupId>
        <artifactId>artifactregistry-maven-wagon</artifactId>
        <version>2.1.4</version>
      </extension>
    </extensions>
  </build>

  <dependency>
    <groupId>com.google.maps</groupId>
    <artifactId>gapic-google-maps-fleetengine-v1-java</artifactId>
    <version>0.0.197</version>
  </dependency>
</project>

Node.js / TypeScript

npm

You may specify the library URL in the dependencies section of package.json:

{
  "dependencies": {
    "@googlemaps/fleetengine": "https://storage.googleapis.com/fleetengine-gapic/dist/793/2022-07-19/maps-fleetengine-v1-nodejs.tar.gz",
    "google-auth-library": "^7.14.0"
  }
}

Sample code:

const fleetengine = require("@googlemaps/fleetengine");
const { GoogleAuth } = require('google-auth-library');

const token = process.env.FLEETENGINE_TOKEN;
const project_id = 'change-me';

async function main() {
    let auth = new GoogleAuth();
    auth.cachedCredential = new AuthorizationHeaderProvider();
    const vehicleClient = new fleetengine.VehicleServiceClient({ auth: auth });

    vehicleClient.listVehicles({parent: `providers/${project_id}`}).then(function(resp) {
      console.log(resp);
    }, function(err) {
      console.log(err);
    });
}

class AuthorizationHeaderProvider {
    getRequestMetadata(url, callback) {
        callback(null, {'authorization': `Bearer ${token}`});
    }
}

main().catch(console.error);

Go

The Go library is packages as a module at https://pkg.go.dev/google.golang.org/genproto/googleapis/maps/fleetengine/v1

package main

import (
  "context"
  "fmt"
  "os"
  "google.golang.org/grpc"
  "google.golang.org/grpc/credentials"
  "google.golang.org/grpc/metadata"
  fleetengine "google.golang.org/genproto/googleapis/maps/fleetengine/v1"
)

func main() {
  provider := "gcp-project-id"
  trip := "trip-id"
  token := os.Getenv("FLEETENGINE_TOKEN")

  opts := []grpc.DialOption{
    grpc.WithTransportCredentials(credentials.NewClientTLSFromCert(nil, "")),
  }
  auth_header := string(fmt.Sprintf("Bearer %s", token))

  address := "fleetengine.googleapis.com:443"
  ctx := context.Background()
  ctx = metadata.AppendToOutgoingContext(ctx, "authorization", auth_header)
  conn, _ := grpc.DialContext(ctx, address, opts...)

  request := &fleetengine.GetTripRequest {
    Name: fmt.Sprintf("providers/%s/trips/%s", provider, trip),
  }
  svc := fleetengine.NewTripServiceClient(conn)

  response, err := svc.GetTrip(ctx, request)

  if (err != nil) {
    fmt.Println(err)
    return
  }

  fmt.Println(response)
}

Python

pip

pip install https://storage.googleapis.com/fleetengine-gapic/dist/793/2022-07-19/maps-fleetengine-v1-py.tar.gz

C#

The C# library can be downloaded from https://storage.googleapis.com/fleetengine-gapic/dist/793/2022-07-19/google-maps-fleetengine-v1-csharp.tar.gz

PHP

The PHP library can be downloaded from https://storage.googleapis.com/fleetengine-gapic/dist/793/2022-07-19/google-maps-fleetengine-v1-php.tar.gz

Ruby

The Ruby library can be downloaded from https://storage.googleapis.com/fleetengine-gapic/dist/793/2022-07-19/google-maps-fleetengine-v1-ruby.tar.gz