npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@datafire/whapi_sessions

v5.0.0

Published

DataFire integration for Sessions API

Downloads

16

Readme

@datafire/whapi_sessions

Client library for Sessions API

Installation and Usage

npm install --save @datafire/whapi_sessions
let whapi_sessions = require('@datafire/whapi_sessions').create();

.then(data => {
  console.log(data);
});

Description

The William Hill Sessions API uses a central authentication service (CAS*) on all resources that require access to a customer’s account or betting functionality. To authenticate, you’ll need to supply a sportsbook username and password, in return you will be given an authentication ticket, which you can use on the majority of requests found within our services. The Sessions API should be used whenever you want to login a customer and: continue to use the William Hill API for that customer’s transactions use other CAS-enabled William Hill services outside the suite of APIs CAS is an enterprise Single Sign-On solution for web services (see https://wiki.jasig.org/display/CAS/Home). It is used by many William Hill services. Note: all requests must be executed over HTTPS and include an API key and secret. Authentication Ticket Expiration Times When a customer is logged in using the Sessions API, they are given an Authentication Ticket; using this ticket on subsequent API requests gives you access to account activities (such as placing a bet, deposits, etc). However, this ticket is only valid for a given period of time depending on how it is used. If the ticket is used and then has a period of inactivity longer than 7,200 seconds (2 hours), then the ticket will expire and further requests using the ticket will be denied - in effect, a customer has been logged out and will need to authenticate again. Normally, any ticket issued only has a maximum life expectancy of 28,000 seconds (8 hours) after which it can no longer be used, even if it has been used regularly. The customer again will be effectively logged out and will need to authenticate again. If you wish to avoid this, you need to set the query parameter extended to Y, which will enable your application to generate a ticket valid for 60 days without expiring due to inactivity.

Actions

logIn

Logs in a customer by obtaining an authentication ticket. It can then be used directly with the other William Hill APIs to access a customer’s sportsbook account, place a bet, etc.

whapi_sessions.logIn({
  "apiKey": "",
  "apiSecret": "",
  "login": {
    "username": "",
    "password": ""
  }
}, context)

Input

  • input object
    • apiKey required string: A unique identifier of your application that is generated by the API portal.
    • apiSecret required string: Another unique identifier for your application.
    • fields array: Specify an absolute field list to return (Comma Separated List)
    • include array: Specify fields in addition to the default to return (Comma Separated List)
    • exclude array: Specify fields from the default to exclude (Comma Separated List)
    • territory string: Territory from which request originates
    • languageAsPerTerritory string: Defines response field name language, true (default) returns in language defined by territory, false returns in English
    • login required loginRequest

Output

logOut

Logs out a customer.

whapi_sessions.logOut({
  "apiKey": "",
  "apiSecret": "",
  "tgt": ""
}, context)

Input

  • input object
    • apiKey required string: A unique identifier of your application that is generated by the API portal.
    • apiSecret required string: Another unique identifier for your application.
    • tgt required string: Ticket Granting Ticket obtained from a previous request
    • territory string: Territory from which request originates
    • languageAsPerTerritory string: Defines response field name language, true (default) returns in language defined by territory, false returns in English

Output

validateSession

Checks the validity of a session ticket.

whapi_sessions.validateSession({
  "apiKey": "",
  "apiSecret": "",
  "tgt": ""
}, context)

Input

  • input object
    • apiKey required string: A unique identifier of your application that is generated by the API portal.
    • apiSecret required string: Another unique identifier for your application.
    • tgt required string: Ticket Granting Ticket obtained from a previous request
    • territory string: Territory from which request originates
    • languageAsPerTerritory string: Defines response field name language, true (default) returns in language defined by territory, false returns in English

Output

getServiceTicket

Obtains a one-time Service Ticket that can be used to access other CAS enabled William Hill services that are not available through the standard suite of APIs. You first need to have logged in a customer to obtain an Authentication Ticket.

whapi_sessions.getServiceTicket({
  "apiKey": "",
  "apiSecret": "",
  "tgt": "",
  "target": ""
}, context)

Input

  • input object
    • apiKey required string: A unique identifier of your application that is generated by the API portal.
    • apiSecret required string: Another unique identifier for your application.
    • tgt required string: Ticket Granting Ticket obtained from a previous request
    • territory string: Territory from which request originates
    • languageAsPerTerritory string: Defines response field name language, true (default) returns in language defined by territory, false returns in English
    • target required string: The target URL of the CAS enabled service that you want to use with the service ticket.
    • fields array: Specify an absolute field list to return (Comma Separated List)
    • include array: Specify fields in addition to the default to return (Comma Separated List)
    • exclude array: Specify fields from the default to exclude (Comma Separated List)

Output

Definitions

error

  • error object
    • code string: A unique William Hill identifier for the error
    • field string: To help pinpoint the exact parameter where a request has failed
    • message string: A unique William Hill text string to enable you to identify the error

loginRequest

  • loginRequest object
    • extended boolean: Whether extended login or normal login is required. If the parameter is set to Y your application will generate an authentication ticket valid for a period of 60 days, without expiring due to inactivity. If the parameter is left blank or set to N this means your application will support the normal expiry times for tickets: The ticket expires after 2 hours of inactivity. The ticket is valid for a maximum of 8 hours after it has been issued.
    • password required string: Customer Password
    • username required string: Customer Username

logoutresponse

  • logoutresponse object
    • success boolean

serviceTicket

  • serviceTicket object
    • location string: This is the URL of the target service sent in the request. This is a combination of the endpoint and the ticket for future operations such as DELETE.
    • ticket required string: The TGT ticket

session

  • session object
    • expiryDateTime required string: The UTC time when the ticket expires.
    • extended boolean: The value you have selected previous to executing the request. If the value is Y, this enables your application to generate a ticket valid for 60 days without expiring due to inactivity.
    • location string: This is the URL of the target service sent in the request. This is a combination of the endpoint and the ticket for future operations such as DELETE.
    • temporaryPassword boolean: Indicates that the account has a temporary password set and hence the user must be prompted to change their password.
    • temporaryPasswordUrl string: Url for user to change password. A TGT must be added to the URL
    • ticket required string: The TGT ticket

sessionsErrors

  • sessionsErrors object

ticketvalidityresponse

  • ticketvalidityresponse object
    • valid boolean