Skip to content

Commit

Permalink
Update api-access.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ashlynbain authored Oct 2, 2024
1 parent 6ca1e05 commit 917d806
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions docs/watsonx-assistant/api-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ This page will demonstrate how to access watsonx Assistant via an API call.

1. Access watsonx Assistant from Resource List in the IBM Cloud Account

![test](../assets/api-access/resource.png)
![test](../assets/api-access/resource.png)

2. Get API Key for watsonx Assistant from Launch webpage
![test](../assets/api-access/api.png)
![test](../assets/api-access/api.png)

3. Get Serice Instance URL from Launch webpage
![test](../assets/api-access/url.png)
![test](../assets/api-access/url.png)

4. Copy the Assistant ID and the Skill ID from the Assistant settings

Expand All @@ -37,20 +37,21 @@ This page will demonstrate how to access watsonx Assistant via an API call.

5. Obtain the Session ID from CLI CURL

```{}
curl -X POST -u "apikey:{apikey}" "{url}/v2/assistants/{environment_id}/sessions?version=2021-11-27"
```
```{}
curl -X POST -u "apikey:{apikey}" "{url}/v2/assistants/{environment_id}/sessions?version=2021-11-27"
```

6. Get all parameters from CLI CURL

```{}
curl -X GET -u "apikey:{apikey}" "{url}/v2/assistants/{assistant_id}/skills/{skill_id}?version=2021-11-27"
```
```{}
curl -X GET -u "apikey:{apikey}" "{url}/v2/assistants/{assistant_id}/skills/{skill_id}?version=2021-11-27"
```

7. Run Query from CLI CURL as API call to watsonx Agent

```{}
curl -X POST -u "apikey:{apikey}" --header "Content-Type:application/json" --data "{\"input\": {\"text\":
\"Hello\"}}" "{url}/v2/assistants/{environment_id}/sessions/{session_id}/message?version=2024-08-25"
```
```{}
curl -X POST -u "apikey:{apikey}" --header "Content-Type:application/json" --data "{\"input\": {\"text\":
\"Hello\"}}" "{url}/v2/assistants/{environment_id}/sessions/{session_id}/message?version=2024-08-25"
```

Cheers! Now you can chat with your watsonx Assistant via API.

0 comments on commit 917d806

Please sign in to comment.