Table of Contents

Class MapsBaseRequest

Namespace
GoogleMapsApi.Entities.Common
Assembly
GoogleMapsApi.dll

Base class for all Google Maps Web Service requests. Provides API key, SSL, and URL composition.

public abstract class MapsBaseRequest
Inheritance
MapsBaseRequest
Derived
Inherited Members

Constructors

MapsBaseRequest()

Initializes a new request with no API key.

public MapsBaseRequest()

Properties

ApiKey

Your application's API key. This key identifies your application for purposes of quota management and so that Places added from your application are made immediately available to your app. Visit the APIs Console to create an API Project and obtain your key.

public string? ApiKey { get; set; }

Property Value

string

BaseUrl

Base URL (without scheme) for the Google Maps Web Service endpoint this request targets. Derived requests append their service-specific path.

protected virtual string BaseUrl { get; }

Property Value

string

IsSSL

Always true. The Google Maps Web Services are served over HTTPS only, so this is no longer a choice. Assigning false throws rather than silently downgrading the request.

[Obsolete("All Google Maps Web Services requests use HTTPS. This property is ignored and will be removed in 3.0.")]
public virtual bool IsSSL { get; set; }

Property Value

bool

Methods

GetQueryStringParameters()

Builds the list of query-string parameters that will be sent with the request. Derived classes override to contribute their service-specific parameters.

protected virtual QueryStringParametersList GetQueryStringParameters()

Returns

QueryStringParametersList

The parameters to include in the request URL.

GetRequestBody()

Builds the body to send with this request, or null for endpoints that use GET with query-string parameters only. Derived requests that target POST-based endpoints (for example, Address Validation) override this to return a JSON HttpContent; when the engine sees a non-null body it issues a POST instead of a GET.

protected virtual HttpContent? GetRequestBody()

Returns

HttpContent

The HTTP content to send, or null for a GET request.

GetUri()

Builds the absolute request URI, including scheme, base URL, and serialized query-string parameters.

public virtual Uri GetUri()

Returns

Uri

The fully composed URI to send to the Google Maps API.