Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions docs/common-workflows/analytics/auto-bot-api/auto-bot-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: Next-Gen AI
description: This page contains a summary of REST APIs for the "auto bots" endpoint. You can use REST API requests to interact with Auto Bots.
---

<Available since="Strategy ONE (March 2025)" />

With the release of Strategy ONE (March 2025), we have introduced an enhanced set of APIs designed to leverage the capabilities of Next-Gen AI. These APIs are built on top of the existing question APIs and are compatible with both the Next-Gen AI and the legacy Auto Bots.

The Next-Gen AI APIs provide a seamless way to interact with Next-Gen AI, allowing you to ask questions, retrieve answers, and get historical chat messages from specific bots. Additionally, the APIs offer the ability to get suggested questions, enhancing the user experience by providing relevant queries and answers efficiently.

Starting from Strategy ONE (June 2025), we've added support for retrieving images within answers, allowing for richer, more visual responses from the Next-Gen AI system. This feature includes customizable resolution settings to optimize image quality based on your specific needs.

### Key Features

- **Ask a question to a specific bot**: Submit a question to the specific Auto Bot. This API has been enhanced from the existing question API.
- **Get answer by the question ID**: Retrieve the answer to a specific question using its ID. This API has been enhanced from the existing question API.
- **Get chat history from a specific bot**: Obtain all historical chat messages from a specific bot.
- **Get suggested questions from a specific bot**: Get recommended questions based on the context from a specific bot.
- **Image support in answers**: Request and retrieve images as part of answers from Next-Gen AI, with customizable resolution settings. (Available from Strategy ONE (June 2025))

For further details on how to use these APIs, please refer to the following sections of this manual:

- [Ask a question to a specific bot](./post-question.md)
- [Get answer by the question ID](./get-question-by-id.md)
- [Get chat history from a specific bot](./get-questions-by-bot.md)
- [Get suggested questions from a specific bot](./post-suggestion.md)
- [Get image from an answer](./get-image-of-answer.md)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
sidebar_label: Get an image in the answer of a specific question
title: Get an image in the answer of a specific question
description: This workflow sample demonstrates how to get an image in the answer of a specific question.
---

<Available since="Strategy ONE (June 2024)" />

This workflow sample demonstrates how to get an image in the answer of a specific question.

:::info

Obtain the authorization token needed to execute the request using [POST /api/auth/login](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Authentication/postLogin).

:::

## Get an image of an answer related to a question with bot routing

Endpoint: [GET /api/questions/\{questionsId}/answers/images/\{imageId}](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Next-Gen%20AI/getMessageImage)

:::note
Replace `{questionsId}` in `GET /api/questions/{questionsId}/answers/images/{imageId}` with the question ID from `POST /api/questions` and `{imageId}` with your image ID from `GET /api/questions/{questionId}`.
:::

Sample Curl:

```bash
curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/questions/862D61DE2EDD4937B31139B7F574E8EE/answers/images/32A0F79BB4374D4792253B38C1177A6D' \
-H 'accept: image/png' \
-H 'X-MSTR-AuthToken: t40ltbk411923ipk85r8r0tace' \
```

Sample Response:

| Response Code | Status |
| ------------- | ------------------------------- |
| 200 | Successfully returned the image |
| 400 | Error in getting the image |
| 401 | Authorization failed |
| 403 | Forbidden |
| 404 | Image not found |
83 changes: 83 additions & 0 deletions docs/common-workflows/analytics/auto-bot-api/get-question-by-id.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
sidebar_label: Get answer by the question ID
title: Get answer by the question ID
description: This workflow sample demonstrates how to get a question's answer by the question ID.
---

<Available since="Strategy ONE (March 2025)" />

This workflow sample demonstrates how to get a question's answer by the question ID.

:::info

Obtain the authorization token needed to execute the request using [POST /api/auth/login](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Authentication/postLogin).

:::

## Get a question with question ID

Endpoint: [GET /api/questions/\{questionId}](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Next-Gen%20AI/queryMessage_1)

:::note
Replace `{questionId}` in `GET /api/questions/{questionId}` with your question ID from `POST /api/questions`.
:::

Sample Request Body:
No request body.

Sample Curl:

```bash
curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/questions/9161386651E84054A6230796C84E12C5:68696ADB633946B4B430ABD959433B3B:FCC1C28296014AB19ABD877E60590890' \
-H 'accept: */*' \
-H 'X-MSTR-AuthToken: evvk84kcucn8abon6c1qfbud7' \
```

Sample Response Code:

| Response Code | Status |
| ------------- | ------------------------------------------------------------------------------ |
| 200 | Successfully returned the question from the bot that has been answered |
| 202 | Successfully returned the question from the bot which is still being processed |
| 400 | Error in getting the question from the bot |
| 401 | Authorization failed |
| 404 | Question does not exist |

## Response Body on Success

The response is the question and answer with the specific ID.

### Response when the question is still being processed

If the response code is 202, indicating that the question is still being processed, continue calling this API to check the status of the question.

If the question is being processed, the response is:

```json
{
"id": "9161386651E84054A6230796C84E12C5:68696ADB633946B4B430ABD959433B3B:FCC1C28296014AB19ABD877E60590890",
"text": "Analyze the distribution of cooking times for recipes",
"answers": [],
"creationDate": "2024-03-08T09:01:43.154+0000"
}
```

### Response when all data is ready

If the status code is 200, indicating that the question has been answered.

```json
{
"id": "9161386651E84054A6230796C84E12C5:68696ADB633946B4B430ABD959433B3B:FCC1C28296014AB19ABD877E60590890",
"text": "Analyze the distribution of cooking times for recipes",
"answers": [
{
"bot": { "id": "68696ADB633946B4B430ABD959433B3B" },
"text": "#Title 1\nThe distribution of cooking times for recipes is as follows:\n- The shortest cooking time is -1 minute.\n- The majority of recipes have cooking times ranging from 2 to 60 minutes.\n- There are a few recipes with longer cooking times, such as 75, 90, 120, and 720 minutes.\n- The exact distribution of cooking times can be seen in the visualization result.",
"images": [{ "id": "79FD176AEAD9446395B083B5931E9EC7", "width": 800, "height": 600 }],
"route": "sql"
}
],
"creationDate": "2024-03-08T09:01:43.154+0000"
}
```
102 changes: 102 additions & 0 deletions docs/common-workflows/analytics/auto-bot-api/get-questions-by-bot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
sidebar_label: Get chat history from a specific bot
title: Get chat history from a specific bot
description: This workflow sample demonstrates how to get the historical chat messages from a specific bot.
---

<Available since="Strategy ONE (March 2025)" />

This API is used to get the historical questions from a specific bot for the current user, which can be used as the `history` parameter in the `Ask a question to a specific bot` API.

:::info

Obtain the authorization token needed to execute the request using [POST /api/auth/login](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Authentication/postLogin).

:::

## Get Questions by Bot

Endpoint: [GET /api/questions/](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Next-Gen%20AI/getChats_1)

Sample Request Headers:

| Header | Required | Description | Sample Value |
| ---------------- | -------- | -------------------------- | -------------------------------- |
| X-MSTR-AuthToken | Yes | Authorization Token | t40ltbk411923ipk85r8r0tace |
| X-MSTR-ProjectID | Yes | Project ID | B7CA92F04B9FAE8D941C3E9B7E0CD754 |
| Content-Type | Yes | Type of content being sent | application/json |

Sample Request Query Strings:

| Query String | Required | Description | Sample Value |
| ------------ | -------- | ---------------------------------------------------------- | -------------------------------- |
| botId | Yes | The ID of the bot whose chat history you want to retrieve. | 065B007500614D158B41B0D020C96966 |

Sample Curl:

```bash
curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/questions?botId=065B007500614D158B41B0D020C96966' \
-H 'accept: */*' \
-H 'X-MSTR-AuthToken: evvk84kcucn8abon6c1qfbud7' \
-H 'X-MSTR-ProjectID: B7CA92F04B9FAE8D941C3E9B7E0CD754' \
```

Sample Response Code:

| Response Code | Status |
| ------------- | ------------------------------------------------ |
| 200 | Successfully returned the questions from the bot |
| 400 | Error in getting the questions from the bot |
| 401 | Authorization failed |
| 404 | Bot does not exist |

## Response Body on Success

The response is a list of questions and answers from the specific bot.

### Sample Response

```json
{
"questions": [
{
"id": "B7CA92F04B9FAE8D941C3E9B7E0CD754:065B007500614D158B41B0D020C96966:1BA14D43628D40ABA5DF6616843C611F",
"text": "Show the revenue in euros per month of the highest-grossing branch in Germany in 2024 in a gid.",
"answers": [
{
"bot": {
"id": "065B007500614D158B41B0D020C96966",
"projectId": "B7CA92F04B9FAE8D941C3E9B7E0CD754"
},
"text": "The highest-grossing branch in Germany in 2024 generated the following revenue in euros per month:\n- August: €11,327,719\n- September: €10,847,290\n- October: €12,609,864\n- November: €13,793,524\n- December: €12,002,767",
"route": "sql"
}
],
"creationDate": "2025-03-06T06:07:47.272+0000",
"snapshot": false,
"type": "snapshots"
},
{
"id": "B7CA92F04B9FAE8D941C3E9B7E0CD754:065B007500614D158B41B0D020C96966:75262B7346CC469EA7B874E49888040E",
"text": "What was the Umsatz in Euro in Kristallhöhle during 2024/10 Okt?",
"answers": [
{
"bot": {
"id": "065B007500614D158B41B0D020C96966",
"projectId": "B7CA92F04B9FAE8D941C3E9B7E0CD754"
},
"text": "Der Gesamtumsatz in Euro (Umsatz in Euro) für die Region 'kristallhöhle' im Oktober 2024 betrug €92.541.045.",
"route": "sql"
}
],
"creationDate": "2025-03-07T02:56:53.708+0000",
"snapshot": false,
"type": "history"
}
]
}
```

:::note
Questions with `type` as `snapshots` should not be used as history in the `Ask a Specific Bot a Question` API.
:::
Loading