Skip to content

Commit

Permalink
Update Document (#59)
Browse files Browse the repository at this point in the history
* Update Document

* Update

---------

Co-authored-by: ziyuhehe <[email protected]>
  • Loading branch information
ziyuhehe and ziyuhehe authored Jun 21, 2024
1 parent 582f359 commit d073117
Show file tree
Hide file tree
Showing 17 changed files with 2,865 additions and 3,420 deletions.
28 changes: 20 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Documentation for REST API

### Requirements

- [Node.js](https://nodejs.org/en/download/) version 16.14 or above (which can be checked by running `node -v`). You can use [nvm](https://github.com/nvm-sh/nvm) for managing multiple Node versions on a single machine installed.
- [Node.js](https://nodejs.org/en/download/) version 16.14 or above (which can be checked by running
`node -v`). You can use [nvm](https://github.com/nvm-sh/nvm) for managing multiple Node versions
on a single machine installed.
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.

### Step one
Expand All @@ -27,30 +29,40 @@ yarn
yarn start
```

This command will start a local server and you'll be able to work on your site with hot reloads and some nice Browsersync features. 💥
This command will start a local server and you'll be able to work on your site with hot reloads and
some nice Browsersync features. 💥

---

## Contributing

### Start contributing right now

We accept a lot of [different contributions](CONTRIBUTING.md/#types-of-contributions-memo), including some that don't require you to write a single line of code.
We accept a lot of [different contributions](CONTRIBUTING.md/#types-of-contributions-memo),
including some that don't require you to write a single line of code.

#### Click **Edit** from docs

As you're using Embedding SDK Docs, you may find something in an article that you'd like to add to, update, or change. Click on **Edit** button, which could be found on the top right corner of the article, to navigate directly to that article in the codebase, so that you can begin making your contribution.
As you're using Embedding SDK Docs, you may find something in an article that you'd like to add to,
update, or change. Click on **Edit** button, which could be found on the top right corner of the
article, to navigate directly to that article in the codebase, so that you can begin making your
contribution.

#### Open an issue

If you've found a problem, you can open an issue [here](https://github.com/MicroStrategy/rest-api-docs/issues).
If you've found a problem, you can open an issue
[here](https://github.com/MicroStrategy/rest-api-docs/issues).

#### Solve an issue

If you have a solution to one of the open issues, you will need to fork the repository and submit a pull request. For more details about this process, please check out [Getting started with contributing](CONTRIBUTING.md).
If you have a solution to one of the open issues, you will need to fork the repository and submit a
pull request. For more details about this process, please check out
[Getting started with contributing](CONTRIBUTING.md).

#### And that's it

That's how you can get started easily as a member of the MicroStrategy Embedding SDK Documentation community. :sparkles:
That's how you can get started easily as a member of the MicroStrategy Embedding SDK Documentation
community. :sparkles:

If you want to know more, or you're making a more complex contribution, check out [Getting started with contributing](CONTRIBUTING.md).
If you want to know more, or you're making a more complex contribution, check out
[Getting started with contributing](CONTRIBUTING.md).
2 changes: 1 addition & 1 deletion contributing/content-style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ The list below shows the usage of emojis in our Docs site:
- If the description of the link is in the middle of the sentence and it is a brief explanation of what the link is, use proper cases as needed. For example:

```md
You can use the following REST APIs to [filter the data that is returned when you create or update an instance of a dossier](filter-dossier-instances/filter-dossier-instances.md), including clearing the filter selections.
You can use the following REST APIs to [filter the data that is returned when you create or update an instance of a dashboard](filter-dossier-instances/filter-dossier-instances.md), including clearing the filter selections.
```

## Naming conventions
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
sidebar_label: Ask a question with bot routing
title: Ask a question with bot routing
description: This workflow sample demonstrates how to ask a question with bot routing.
---

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

Use this API to identify the most suitable bot to answer your question based on the application, content group, and specific bots.

:::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).

:::

## Ask a question with bot routing

Endpoint: [POST /api/questions](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/AI%20Chatbot/createQuestion)

Sample Request Headers:

| Header | Required | Description | Sample Value |
| ---------------- | -------- | ----------------------------------------------- | -------------------------- |
| X-MSTR-AuthToken | Yes | Authorization Token | t40ltbk411923ipk85r8r0tace |
| Prefer | Yes | The response mode, which must be respond-async. | respond-async |
| Content-Type | Yes | Type of content being sent | application/json |

Sample Request Query Strings:

| Query String | Required | Description | Sample Value |
| --------------- | -------- | ------------------------------------------------------ | ----------------------------------------------------------------- |
| applicationId | No | Application ID. If not specified, the default is used. | CDC07694B5F844EC0DA0073EAD71928E |
| botIds | No | Bot IDs, split by commas | FF50752ED8CA586C641492F29DF4D6E7,075D0CD44EEB6B82B3B9EF03F6ED705B |
| contentGroupIds | No | Content Group IDs, split by commas | 820E261D28705ED6494D200D98457626,0791486376B37445DEB502AF6951072B |
| useHistory | No | Use history or start a new chat | false |

Sample Request Body:

| Field | Required | Description | Sample Value |
| -------------- | -------- | --------------------------------------------------------------------------- | --------------------------------------- |
| text | Yes | The question text | Which customer has the highest revenue? |
| answers.images | No | Optional. If not specified, the image is not generated. Supports one image. | [\{"width": 200, "height": 300\}] |

```json
{
"text": "Which customer has the highest revenue?",
"answers.images": [
{
"width": 720,
"height": 405
}
]
}
```

Sample Curl:

```bash
curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/questions' \
-X 'POST' \
--header 'X-MSTR-AuthToken: t40ltbk411923ipk85r8r0tace' \
--header 'X-MSTR-ProjectID: FCC1924411EAABC39C6C0080EFA54501' \
--header 'Prefer: respond-async' \
--header 'Content-Type: application/json' \
--data '{
"text": "Which customer has the highest revenue?",
"answers.images": [
{
"width": 720,
"height": 405
}
]
}'
```

Sample Response:

| Response Code | Status |
| ------------- | ---------------------------------- |
| 202 | Successfully accepted the question |
| 400 | Error in accepting the question |
| 401 | Authorization failed |
| 404 | No bot found |

Sample Response Body on success:

```json
{
"id": "9161386651E84054A6230796C84E12C5:68696ADB633946B4B430ABD959433B3B:FCC1C28296014AB19ABD877E60590890"
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
sidebar_label: Ask suggested questions with bot routing
title: Ask suggested questions with bot routing
description: This workflow sample demonstrates how to ask suggested questions with bot routing.
---

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

This workflow sample demonstrates how to ask suggested questions with bot routing.

:::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).

:::

## Ask suggested questions with bot routing

Endpoint: [POST /api/question/suggestions](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Question%20Suggestions/createSuggestions_1)

Sample Request Header:

| Header Name | Required | Description |
| ---------------- | -------- | -------------------------------------------------------- |
| X-MSTR-AuthToken | Yes | Authorization token obtained from `POST /api/auth/login` |
| Content-Type | Yes | The body request type, which must be `application/json` |

Sample Request Query String:

| Query Parameter | Required | Description |
| --------------- | -------- | ------------------------------------------------------ |
| applicationId | No | Application ID. If not specified, the default is used. |
| botIds | No | Bots IDs, split by commas (`,`) |
| contentGroupIds | No | Content Group IDs, split by commas (`,`) |
| useHistory | No | Use history or start a new chat |

Sample Request Body:

```json
{
"count": 5 // Number of suggested questions to return (1 to 5)
}
```

Sample Curl:

```bash
curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/question/suggestions' \
-X 'POST' \
--header 'X-MSTR-AuthToken: t40ltbk411923ipk85r8r0tace' \
--header 'X-MSTR-ProjectID: FCC1924411EAABC39C6C0080EFA54501' \
--header 'Content-Type: application/json' \
--data '{
"count": 5
}' \
--get \
--data-urlencode 'applicationId=CDC07694B5F844EC0DA0073EAD71928E' \
--data-urlencode 'botIds=FF50752ED8CA586C641492F29DF4D6E7,075D0CD44EEB6B82B3B9EF03F6ED705B' \
--data-urlencode 'contentGroupIds=820E261D28705ED6494D200D98457626,0791486376B37445DEB502AF6951072B' \
--data-urlencode 'useHistory=false'
```

Sample Response:

| Response Code | Status |
| ------------- | --------------------------------------------- |
| 200 | Successfully returned the suggested questions |
| 400 | Error in generating the suggested questions |
| 401 | Authorization failed |
| 404 | No bot or bot instance found |

Sample Response Body on Success:

```json
{
"suggestions": [
{
"bot": {
"id": "05C0E560558D4EBF83E60875EA2D2A15"
},
"project": {
"id": "F821C717E9E843728867BF79DE441DC3"
},
"text": "Which income bracket contributes to most revenue?"
},
{
"bot": {
"id": "05C0E560558D4EBF83E60875EA2D2A15"
},
"project": {
"id": "F821C717E9E843728867BF79DE441DC3"
},
"text": "Show me the elements of Customer Age."
},
{
"bot": {
"id": "05C0E560558D4EBF83E60875EA2D2A15"
},
"project": {
"id": "F821C717E9E843728867BF79DE441DC3"
},
"text": "What is the total USS_Revenue for each month?"
}
]
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
sidebar_label: Get an image of an answer related to a question with bot routing
title: Get an image of an answer related to a question with bot routing
description: This workflow sample demonstrates how to get an image of an answer related to a question with bot routing.
---

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

This workflow sample demonstrates how to get an image of an answer related to a question with bot routing.

:::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#/AI%20Chatbot/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 |
Loading

0 comments on commit d073117

Please sign in to comment.