LSEG Data Library for TypeScript

getData

The getData function is used to send a request with the parameters to the endpoint defined by Delivery.EndpointRequest.Definition.

Syntax

definition.getData<T>(session?: Session)

Parameters

Value Description Data type Optional Default value
session Session object. If it's not passed the default session will be used. Session Yes -

Returned value

Promise<EndpointResponse<T>> object.

EndpointResponse properties

Value Description Data type Optional Default value
data The data returned by the endpoint. T (the type specified with getData method, default: any) No -
httpStatus The HTTP status code from the endpoint response. number No -
httpHeaders The headers that the endpoint responded with. object No -

Usage

The following example demonstrates how to get data from new analyze endpoint:

import { Delivery } from '@lsegroup/data';

const definition = Delivery.EndpointRequest.Definition({
    url: '/data/news/v1/analyze',
    queryParameters: { query: 'USA' },
});

const response = await definition.getData();

console.log(response.data);

None.

107 words (0:34 mins)