@smartlook/rest-api-client

Library for easier integration of the Smartlook REST API

Usage no npm install needed!

<script type="module">
  import smartlookRestApiClient from 'https://cdn.skypack.dev/@smartlook/rest-api-client';
</script>

README

Smartlook REST API Client

npm badge types badge

Smartlook REST API Client is a Typescript library for retrieving data from the Smartlook.

Installation

Use the package manager npm to install the library.

npm install @smartlook/rest-api-client

Usage

At first you need to get an API token for your project. You can do so in settings of your project (managing your project tokens is described in the docs).

import * as SmartlookAPI from '@smartlook/rest-api-client'

const client = SmartlookAPI.createSmartlookClient(<YOUR_API_TOKEN>)

const response = await client.events.getEventDetail({
    dateFrom: '2020-01-01',
    dateTo: '2020-01-10',
    eventId: 'foobar',
    occurrenceHistogramInterval: 'day',
})

The client is using node-fetch on the background. If you want to handle the requests to the Smartlook REST API by yourself, you can pass makeRequest: MakeRequest function to the client factory instead of the API token.

License

MIT