Table of Contents

Class RestApi

Namespace
Geotab.Checkmate
Assembly
Geotab.Checkmate.ObjectModel.dll
public class RestApi : IRestApi
Inheritance
RestApi
Implements
Inherited Members

Constructors

RestApi(Credentials)

Initializes a new instance of the RestApi class.

public RestApi(Credentials credentials)

Parameters

credentials Credentials

The Credentials.

RestApi(string, string?, string?, string, string?, int, HttpMessageHandler?)

Initializes a new instance of the RestApi class.

public RestApi(string userName, string? password, string? sessionId, string database, string? server = null, int timeout = 300000, HttpMessageHandler? handler = null)

Parameters

userName string

The user name to use for authentication.

password string

The password to use for authentication. Note: password OR sessionId are required. Both can be supplied.

sessionId string

The session ID if user is already authenticated. Note: password OR sessionId are required. Both can be supplied. If only session ID is supplied the API cannot re-authenticate.

database string

The name of the database the user belongs to.

server string

The server federation name. Default: my.geotab.com. Note: this should NOT be a specific server (my3.geotab.com) databases can be moved to different servers to maximize performance without warning.

timeout int

The timeout for the requests in milliseconds (Default 300000).

handler HttpMessageHandler

The HttpMessageHandler to be used with the HttpClient request. The HttpMessageHandler provides additional control over see cref="HttpClient"/> request. The API object will not dispose of this object.

Properties

Database

Gets or sets the specific database on the server to which the API call is being made.

public string Database { get; set; }

Property Value

string

A string database name.

LoginResult

Gets or sets the result of the login request.

public LoginResult? LoginResult { get; set; }

Property Value

LoginResult

LoginResult

Password

Sets the user's password.

public string Password { set; }

Property Value

string

string

Server

Gets or sets the name of the server that the API call is being made to.

public string Server { get; set; }

Property Value

string

string

SessionId

Gets or sets the token generated from the authentication call which can be used to make the API call instead of the password.

public string? SessionId { get; set; }

Property Value

string

string

Timeout

Gets or sets the timeout for the requests in milliseconds.

public int Timeout { get; set; }

Property Value

int

int

UserName

Gets or sets the username (typically an email address) that identifies the user being authenticated.

public string UserName { get; set; }

Property Value

string

string

Methods

AuthenticateAsync(CancellationToken)

Authenticate the user in an async call.

public Task AuthenticateAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The CancellationToken.

Returns

Task

A Task which is a result of calling AuthenticateImplAsync.

Clone()

Creates a new object that is a copy of the current instance.

public object Clone()

Returns

object

A new object that is a copy of this instance.

GetAsync(string, CancellationToken)

Make a GET http request.

public Task<HttpResponseMessage> GetAsync(string url, CancellationToken cancellationToken = default)

Parameters

url string

The url for the REST api.

cancellationToken CancellationToken

The CancellationToken.

Returns

Task<HttpResponseMessage>

The HttpResponseMessage which is the result of the api call.