# Games catalog API

The platform can provide Smartico with a simple HTTP REST API to expose the list of Casino games and/or Sports events or expose this information from the DB and provide access to this DB.

This information will be used to associate Missions and Tournaments with exact games on the Platform, show names and images, and link the user to the game page.

<figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-888bb5f31ac20f22dce4b1e7553cff752e329ebc%2Fimage.png?alt=media" alt="" width="336"><figcaption><p>Example of mission widget with related games</p></figcaption></figure>

<figure><img src="https://77049817-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfS5hl0PiysHtKAKMsQTe%2Fuploads%2Fgit-blob-342376deb3111cff276aea66e73059544bd9e95f%2FGamification%20%E2%80%93%20Figma%202024-01-26%2015-13-43.png?alt=media" alt=""><figcaption><p>Tournament setup with related games</p></figcaption></figure>

To have this option, the external system should provide REST HTTP/S API available with GET/POST methods and return a JSON array with the id/name/image/link of all games (or similar information can be provided via DB). Example of response

```json
[
    {
        "id": 123,
        "name": "Super slot",
        "link": "https://sone.com/game1",
        "image": "https://some.com/1.png",
        "enabled": true,
        "game_categories": [
            { "id": 22, "name": "Slots" },
            { "id": 23, "name": "Live" }
        ],
        "game_provider": "RTG",
        "game_provider_id": 33,        
    },
    {
        "id": 124,
        "name": "Super slot 2",
        "link": "https://sone.com/game1",
        "image": "https://some.com/1.png",
        "enabled": true,
        "game_categories": [
            { "id": 24, "name": "Poker" }
        ],        
        "game_provider": "Playtech",
        "game_provider_id": 34,                   
    },
    ....
]
```

Notes:

* API should be publicly available but can be protected with static keys for Basic Authorization of static secret tokens in HTTP headers.
* Game categories and "provider" are optional fields. they are used only to easier search for specific games

The link field can be related to the site's root (to be relative), e.g., "/start-game/game1," or it can be empty. In case the link is empty, the front-end of the casino platform should take responsibility to lauch the game by handling the callback from smartico -

```javascript
_smartico.on('ach_game_opening', (r) => console.log(r));

// the r object will have information about the game in the followign format
r = {
    "ach_game_id": 32, // ID of the game on smartico side
    "game_public_meta": { 
        "image": "https://mysite.com/images/card_2x/1x2gaming-InstantFootball-1674738298.jpg",
        "name": "Instant Football",
        "enabled": true
    },
    "ext_game_id": "56", // the ID of the game on the provider side
    "context": "mission" // context of the callback - mission or tournament
};

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.smartico.ai/welcome/technical-guides/games-catalog-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
