swagger: "2.0"
schemes:
  - https
host: sandbox.whapi.com
basePath: /v2/numbers
info:
  contact:
    x-twitter: WilliamHill
  description: The William Hill Numbers API uses a single method that allows you to generate random numbers for your application. Numbers can either be unique or can be produced with the chance that some might be the same. For example, you can have a highest value of 6 and a lowest value of 1 with a count of 2 with a unique value of false - this will give you two numbers between 1 and 6 which are independent, just like two dice being rolled.<br /><br />The Numbers API is a Private API and therefore not automatically available to developers. To use this API, contact your business manager who will guide you through the separate Terms and Conditions of use before you can have the API assigned to your application.
  license:
    name: William Hill Online
    url: https://www.williamhill.com/
  title: Numbers API
  version: "2.0"
  x-apisguru-categories:
    - entertainment
  x-logo:
    url: https://twitter.com/WillHillHelp/profile_image?size=original
  x-origin:
    - format: swagger
      url: https://developer.williamhill.com/wh-docs/docs-sdks/numbers/swagger/docs
      version: "2.0"
  x-providerName: whapi.com
  x-serviceName: numbers
consumes:
  - application/json
produces:
  - application/json
paths:
  /generate/integers:
    get:
      description: This method is used to generate random numbers for your app. Within the request, you can specify the lowest number, the highest number and the amount of numbers returned. There is also an option to generate a unique set of numbers with no repetition of the same numbers allowed in the return.
      operationId: getRandomNumbers
      parameters:
        - description: A unique identifier of your application that is generated by the API portal and presented in the header.
          in: header
          name: apiKey
          required: true
          type: string
          x-eg: l7xx999dd7276c4e4ff7b6aa810cb106xxxx
        - description: Another unique identifier for your application. The secret must never be sent over HTTP.
          in: header
          name: apiSecret
          required: true
          type: string
          x-eg: 04d2db4f6baa456489774afc121exxxx
        - description: "The authentication ticket associated with the user session. The getRandomNumbers method operates in two different ways – ‘Demo’ mode and ‘Live’ mode. In Demo mode, where no money is involved, the ticket is not required and can be used without it. In Live mode, when there is a financial outcome, the developer must supply a valid authentication and the ticket must be supplied. Important: The service should not be used in Live mode without a ticket."
          in: header
          name: apiTicket
          required: false
          type: string
          x-eg: TGT-619-Ei7EcapNaeKiopvNEYke6PIlPKihKZHYb0lKjrsyDqpJRgEyw3-brsuxxxx
        - description: Identifier that indicates the game for which the RNG (Random Number Generator) has been used.
          in: query
          name: gameCode
          pattern: ^[a-zA-Z0-9#/_.-]{1,30}$
          required: true
          type: string
          x-eg: POKER
        - description: Highest possible value to be returned.
          in: query
          maximum: 9999999999
          minimum: 1
          name: highest
          required: true
          type: integer
          x-eg: 100
        - description: Lowest possible value to be returned.
          in: query
          maximum: 9999999999
          minimum: 1
          name: lowest
          required: true
          type: integer
          x-eg: 0
        - description: Number of values to be returned.
          in: query
          maximum: 99
          minimum: 1
          name: count
          required: true
          type: integer
          x-eg: 7
        - description: Should the numbers returned be unique
          in: query
          name: unique
          required: true
          type: boolean
          x-eg: true
      produces:
        - application/json
      responses:
        "200":
          description: Success
          examples:
            application/json: |
              { 
                "sessionID": "10.1.29.232/6859", 
                "randomNumbers": [ "17","91","22"] 
              } 
          schema:
            $ref: "#/definitions/success"
        "400":
          description: Error
          examples:
            application/json: |
              {
                "errors" : [
                            {
                              "code":"10070",
                              "message":"Missing Parameter",
                              "field":"apiKey"
                            }
                          ]
              }
          schema:
            $ref: "#/definitions/numbersErrors"
      tags:
        - Numbers
      x-returnserrors:
        - 20201
        - 20202
definitions:
  error:
    properties:
      code:
        description: A unique William Hill identifier for the error
        type: string
      field:
        description: To help pinpoint the exact parameter where a request has failed
        type: string
      message:
        description: A unique William Hill text string to enable you to identify the error (in English only)
        type: string
    type: object
  numbersErrors:
    properties:
      errors:
        items:
          $ref: "#/definitions/error"
        type: array
    type: object
  success:
    properties:
      randomNumbers:
        description: An array of random numbers
        items:
          type: integer
        type: array
      sessionId:
        description: This is either the IP address of the customer if not authenticated, or if used in ‘Live’ mode, when there is a financial outcome, it is the IP address and customerId for the account the ticket was generated for. This is used for audit purposes in case of financial query about a game outcome.
        type: string
    type: object
x-customerrors:
  - code: 20201
    message: Lowest parameter greater than or equal to highest parameter
    status: 400
  - code: 20202
    message: Count parameter too large
    status: 400
x-docchapters:
  - fieldSelection
  - apiSummary
  - headAndOptions
  - docsAndSdks
  - errorHandling
  - statusCodes
