Skip to content

Commit d073117

Browse files
ziyuheheziyuhehe
andauthored
Update Document (#59)
* Update Document * Update --------- Co-authored-by: ziyuhehe <[email protected]>
1 parent 582f359 commit d073117

17 files changed

+2865
-3420
lines changed

README.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ Documentation for REST API
88

99
### Requirements
1010

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

1416
### Step one
@@ -27,30 +29,40 @@ yarn
2729
yarn start
2830
```
2931

30-
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. 💥
32+
This command will start a local server and you'll be able to work on your site with hot reloads and
33+
some nice Browsersync features. 💥
3134

3235
---
3336

3437
## Contributing
3538

3639
### Start contributing right now
3740

38-
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.
41+
We accept a lot of [different contributions](CONTRIBUTING.md/#types-of-contributions-memo),
42+
including some that don't require you to write a single line of code.
3943

4044
#### Click **Edit** from docs
4145

42-
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.
46+
As you're using Embedding SDK Docs, you may find something in an article that you'd like to add to,
47+
update, or change. Click on **Edit** button, which could be found on the top right corner of the
48+
article, to navigate directly to that article in the codebase, so that you can begin making your
49+
contribution.
4350

4451
#### Open an issue
4552

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

4856
#### Solve an issue
4957

50-
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).
58+
If you have a solution to one of the open issues, you will need to fork the repository and submit a
59+
pull request. For more details about this process, please check out
60+
[Getting started with contributing](CONTRIBUTING.md).
5161

5262
#### And that's it
5363

54-
That's how you can get started easily as a member of the MicroStrategy Embedding SDK Documentation community. :sparkles:
64+
That's how you can get started easily as a member of the MicroStrategy Embedding SDK Documentation
65+
community. :sparkles:
5566

56-
If you want to know more, or you're making a more complex contribution, check out [Getting started with contributing](CONTRIBUTING.md).
67+
If you want to know more, or you're making a more complex contribution, check out
68+
[Getting started with contributing](CONTRIBUTING.md).

contributing/content-style-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ The list below shows the usage of emojis in our Docs site:
119119
- 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:
120120

121121
```md
122-
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.
122+
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.
123123
```
124124

125125
## Naming conventions
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
sidebar_label: Ask a question with bot routing
3+
title: Ask a question with bot routing
4+
description: This workflow sample demonstrates how to ask a question with bot routing.
5+
---
6+
7+
<Available since="MicroStrategy ONE (June 2024)" />
8+
9+
Use this API to identify the most suitable bot to answer your question based on the application, content group, and specific bots.
10+
11+
:::info
12+
13+
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).
14+
15+
:::
16+
17+
## Ask a question with bot routing
18+
19+
Endpoint: [POST /api/questions](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/AI%20Chatbot/createQuestion)
20+
21+
Sample Request Headers:
22+
23+
| Header | Required | Description | Sample Value |
24+
| ---------------- | -------- | ----------------------------------------------- | -------------------------- |
25+
| X-MSTR-AuthToken | Yes | Authorization Token | t40ltbk411923ipk85r8r0tace |
26+
| Prefer | Yes | The response mode, which must be respond-async. | respond-async |
27+
| Content-Type | Yes | Type of content being sent | application/json |
28+
29+
Sample Request Query Strings:
30+
31+
| Query String | Required | Description | Sample Value |
32+
| --------------- | -------- | ------------------------------------------------------ | ----------------------------------------------------------------- |
33+
| applicationId | No | Application ID. If not specified, the default is used. | CDC07694B5F844EC0DA0073EAD71928E |
34+
| botIds | No | Bot IDs, split by commas | FF50752ED8CA586C641492F29DF4D6E7,075D0CD44EEB6B82B3B9EF03F6ED705B |
35+
| contentGroupIds | No | Content Group IDs, split by commas | 820E261D28705ED6494D200D98457626,0791486376B37445DEB502AF6951072B |
36+
| useHistory | No | Use history or start a new chat | false |
37+
38+
Sample Request Body:
39+
40+
| Field | Required | Description | Sample Value |
41+
| -------------- | -------- | --------------------------------------------------------------------------- | --------------------------------------- |
42+
| text | Yes | The question text | Which customer has the highest revenue? |
43+
| answers.images | No | Optional. If not specified, the image is not generated. Supports one image. | [\{"width": 200, "height": 300\}] |
44+
45+
```json
46+
{
47+
"text": "Which customer has the highest revenue?",
48+
"answers.images": [
49+
{
50+
"width": 720,
51+
"height": 405
52+
}
53+
]
54+
}
55+
```
56+
57+
Sample Curl:
58+
59+
```bash
60+
curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/questions' \
61+
-X 'POST' \
62+
--header 'X-MSTR-AuthToken: t40ltbk411923ipk85r8r0tace' \
63+
--header 'X-MSTR-ProjectID: FCC1924411EAABC39C6C0080EFA54501' \
64+
--header 'Prefer: respond-async' \
65+
--header 'Content-Type: application/json' \
66+
--data '{
67+
"text": "Which customer has the highest revenue?",
68+
"answers.images": [
69+
{
70+
"width": 720,
71+
"height": 405
72+
}
73+
]
74+
}'
75+
```
76+
77+
Sample Response:
78+
79+
| Response Code | Status |
80+
| ------------- | ---------------------------------- |
81+
| 202 | Successfully accepted the question |
82+
| 400 | Error in accepting the question |
83+
| 401 | Authorization failed |
84+
| 404 | No bot found |
85+
86+
Sample Response Body on success:
87+
88+
```json
89+
{
90+
"id": "9161386651E84054A6230796C84E12C5:68696ADB633946B4B430ABD959433B3B:FCC1C28296014AB19ABD877E60590890"
91+
}
92+
```
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
sidebar_label: Ask suggested questions with bot routing
3+
title: Ask suggested questions with bot routing
4+
description: This workflow sample demonstrates how to ask suggested questions with bot routing.
5+
---
6+
7+
<Available since="MicroStrategy ONE (June 2024)" />
8+
9+
This workflow sample demonstrates how to ask suggested questions with bot routing.
10+
11+
:::info
12+
13+
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).
14+
15+
:::
16+
17+
## Ask suggested questions with bot routing
18+
19+
Endpoint: [POST /api/question/suggestions](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/Question%20Suggestions/createSuggestions_1)
20+
21+
Sample Request Header:
22+
23+
| Header Name | Required | Description |
24+
| ---------------- | -------- | -------------------------------------------------------- |
25+
| X-MSTR-AuthToken | Yes | Authorization token obtained from `POST /api/auth/login` |
26+
| Content-Type | Yes | The body request type, which must be `application/json` |
27+
28+
Sample Request Query String:
29+
30+
| Query Parameter | Required | Description |
31+
| --------------- | -------- | ------------------------------------------------------ |
32+
| applicationId | No | Application ID. If not specified, the default is used. |
33+
| botIds | No | Bots IDs, split by commas (`,`) |
34+
| contentGroupIds | No | Content Group IDs, split by commas (`,`) |
35+
| useHistory | No | Use history or start a new chat |
36+
37+
Sample Request Body:
38+
39+
```json
40+
{
41+
"count": 5 // Number of suggested questions to return (1 to 5)
42+
}
43+
```
44+
45+
Sample Curl:
46+
47+
```bash
48+
curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/question/suggestions' \
49+
-X 'POST' \
50+
--header 'X-MSTR-AuthToken: t40ltbk411923ipk85r8r0tace' \
51+
--header 'X-MSTR-ProjectID: FCC1924411EAABC39C6C0080EFA54501' \
52+
--header 'Content-Type: application/json' \
53+
--data '{
54+
"count": 5
55+
}' \
56+
--get \
57+
--data-urlencode 'applicationId=CDC07694B5F844EC0DA0073EAD71928E' \
58+
--data-urlencode 'botIds=FF50752ED8CA586C641492F29DF4D6E7,075D0CD44EEB6B82B3B9EF03F6ED705B' \
59+
--data-urlencode 'contentGroupIds=820E261D28705ED6494D200D98457626,0791486376B37445DEB502AF6951072B' \
60+
--data-urlencode 'useHistory=false'
61+
```
62+
63+
Sample Response:
64+
65+
| Response Code | Status |
66+
| ------------- | --------------------------------------------- |
67+
| 200 | Successfully returned the suggested questions |
68+
| 400 | Error in generating the suggested questions |
69+
| 401 | Authorization failed |
70+
| 404 | No bot or bot instance found |
71+
72+
Sample Response Body on Success:
73+
74+
```json
75+
{
76+
"suggestions": [
77+
{
78+
"bot": {
79+
"id": "05C0E560558D4EBF83E60875EA2D2A15"
80+
},
81+
"project": {
82+
"id": "F821C717E9E843728867BF79DE441DC3"
83+
},
84+
"text": "Which income bracket contributes to most revenue?"
85+
},
86+
{
87+
"bot": {
88+
"id": "05C0E560558D4EBF83E60875EA2D2A15"
89+
},
90+
"project": {
91+
"id": "F821C717E9E843728867BF79DE441DC3"
92+
},
93+
"text": "Show me the elements of Customer Age."
94+
},
95+
{
96+
"bot": {
97+
"id": "05C0E560558D4EBF83E60875EA2D2A15"
98+
},
99+
"project": {
100+
"id": "F821C717E9E843728867BF79DE441DC3"
101+
},
102+
"text": "What is the total USS_Revenue for each month?"
103+
}
104+
]
105+
}
106+
```
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
sidebar_label: Get an image of an answer related to a question with bot routing
3+
title: Get an image of an answer related to a question with bot routing
4+
description: This workflow sample demonstrates how to get an image of an answer related to a question with bot routing.
5+
---
6+
7+
<Available since="MicroStrategy ONE (June 2024)" />
8+
9+
This workflow sample demonstrates how to get an image of an answer related to a question with bot routing.
10+
11+
:::info
12+
13+
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).
14+
15+
:::
16+
17+
## Get an image of an answer related to a question with bot routing
18+
19+
Endpoint: [GET /api/questions/\{questionsId}/answers/images/\{imageId}](https://demo.microstrategy.com/MicroStrategyLibrary/api-docs/index.html#/AI%20Chatbot/getMessageImage)
20+
21+
:::note
22+
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}`.
23+
:::
24+
25+
Sample Curl:
26+
27+
```bash
28+
curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/questions/862D61DE2EDD4937B31139B7F574E8EE/answers/images/32A0F79BB4374D4792253B38C1177A6D' \
29+
-H 'accept: image/png' \
30+
-H 'X-MSTR-AuthToken: t40ltbk411923ipk85r8r0tace' \
31+
```
32+
33+
Sample Response:
34+
35+
| Response Code | Status |
36+
| ------------- | ------------------------------- |
37+
| 200 | Successfully returned the image |
38+
| 400 | Error in getting the image |
39+
| 401 | Authorization failed |
40+
| 403 | Forbidden |
41+
| 404 | Image not found |

0 commit comments

Comments
 (0)