Javascript SDK

The official PredictHQ JavaScript Client provides a consistent JavaScript interface to our API.

Example

Installation

npm install predicthq

Setup the SDK

import Client from 'predicthq'

// Initialises PredictHQ client library using your access token
// Note: You can find/create your access token at https://control.predicthq.com/clients
const client = new Client({access_token: 'ACCESS_TOKEN'})

Search Events

Perform a basic search of events using the title parameter.

client.events.search({title: 'Aviation Festival'})
    .then(
        (results) => {
            for (const event of results) {
                console.info(event);
            }
        }
    ).catch(
        err => console.error(err)
    )

Further Examples

Please browse through our use case examples on our GitHub repository.

Found an Issue?

Please log an issue on our GitHub repository.

Last updated

© 2024 PredictHQ Ltd