Class

BaseOsduClient

(abstract) BaseOsduClient(api_url)

Abstract class that provides the common bones for OSDU API clients.

  • Provides the framework for managing authentication and appending required headers to API requests.
Constructor

# abstract new BaseOsduClient(api_url)

Parameters:
Name Type Description
api_url string

The url for the OSDU API, with or without a trailing /

View Source client/base.js, line 10

Methods

# protected _getHeaders(data_partition) → {Object}

Generate the HTTP headers needed to interact with the OSDU API

Parameters:
Name Type Description
data_partition string

The data partition against which the request is being made

View Source client/base.js, line 46

The common headers required to communicate with the OSDU API

Object

# async protected _makeRequest(data_partition, method, args, iterationopt) → {Promise.<AxiosResponse>}

Common logic to all HTTP requests made to the OSDU API

  • For internal client use only
  • Handles the automatic generation of common headers, authentication, and retries (up to 3) on error conditions
Parameters:
Name Type Attributes Default Description
data_partition string

The data partition against which the request is being made

method function

The axios method reference to call when sending the request (get, post, etc.)

args Object

The arguments used to invoke the API request

path string

The url path to reach out to on the OSDU API (I.E. /path)

body Object <optional>

The JSON HTTP body to include with the request

config Object <optional>

Any additional Axios config to provide with the request. Note that Content-Type, data-partition-id, and Authorization headers will be overwritten

iteration number <optional>
1

The iteration of this request. Used for internal recursion and should not be passed in by an external caller

View Source client/base.js, line 71

The response from the Axios client

Promise.<AxiosResponse>

# protected _refreshAccessToken()

Refresh the access token used to authenticate API Requests

  • Not implemented in the base class

View Source client/base.js, line 35

Error

# delete(path, data_partition) → {Promise.<Object>}

Convenience method for invoking HTTP DELETE requests

Parameters:
Name Type Description
path string

The url path for the HTTP DELETE request (I.E. /path)

data_partition string

The data partition against which the request is being made

View Source client/base.js, line 173

The response data from the Axios client

Promise.<Object>

# get(path, data_partition) → {Promise.<Object>}

Convenience method for invoking HTTP GET requests

Parameters:
Name Type Description
path string

The url path for the HTTP GET request (I.E. /path)

data_partition string

The data partition against which the request is being made

View Source client/base.js, line 163

The response data from the Axios client

Promise.<Object>

# post(path, body, data_partition) → {Promise.<Object>}

Convenience method for invoking HTTP POST requests

Parameters:
Name Type Description
path string

The url path for the HTTP POST request (I.E. /path)

body Object

The JSON body to send with the HTTP POST request

data_partition string

The data partition against which the request is being made

View Source client/base.js, line 142

The response data from the Axios client

Promise.<Object>

# put(path, body, data_partition) → {Promise.<Object>}

Convenience method for invoking HTTP PUT requests

Parameters:
Name Type Description
path string

The url path for the HTTP PUT request (I.E. /path)

body Object

The JSON body to send with the HTTP PUT request

data_partition string

The data partition against which the request is being made

View Source client/base.js, line 153

The response data from the Axios client

Promise.<Object>