Skip to content

Latest commit

 

History

History
 
 

HealthAgentAPI

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Microsoft Health Bot Management API

Note: In order you use this API with the Health Bot secvice, you will need to register with the Health Bot Team. Please refer to Microsoft Health Bot for a private preview and details.

Background

The Microsoft Health Bot provides API to enable programmatic management actions. For example, programmatic import and export of scenarios from the scenario editor.

How to use the API

Code samples

The provided code samples demonstrate how to use the API.

API Structure

The API is implemented with REST architecture, enabling to perform CRUD operations on resources that are represented as URLs.

API Security

The API is protected with standard JWT tokens. The JWT tokens contain two claims:

  • "tenantName": Taken from the management portal in the keys tab
  • "iat": timestamp as an UNIX epoch value

The JWT token is signed with an API secret, called API_JWT_secret. The secret is taken from the management portal, as shown in the following screenshot:

An exemplary JWT token payload before encoding is shown here:

{
  "tenantName": "myTenant",
  "iat": "1507056900"  
}

The JWT token is placed in the authorization header, according to the following example:

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnROYW1lIjoibXlUZW5hbnQiLCJpYXQiOiIxNTA3MDU2OTAwIn0.MN4DcxO2mLsltEYNpXbC6T6Bjxj3-rxIAObngZIw4-U

It is recommended to implement the JWT tokens with standard libraries, for example: Node.js "jsonwebtoken" library.More information at https://jwt.io/.

API URL

The fully qualified domain name(FQDN) should match the FQDN of the portal used to log into the health bot admin panel for example:

URL: https://us.healthbot.microsoft.com/

API Resources

Export Scenarios

**URL: **https://healthbot.microsoft.com/api/account/YourTenantName/scenarios

Method: GET

Special headers: Authorization: Bearer <JWT Token>

Request Parameters: None

Response: An array of JSON objects in the response body. Every object represents a Health Bot scenario

Examples:

GET https://healthbot.microsoft.com/api/account/healthagentprod/scenarios HTTP/1.1

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnROYW1lIjoiaGVhbHRoYWdlbnRwcm9kIiwiaWF0IjoxNTA2OTYwODAwfQ.x9oyA4kgfIgV5R1CpvMQeUYuP6FSlI65lx7Og8nMuWw

Host: healthbot.microsoft.com

HTTP/1.1 200 OK

[exported scenarios will appear in the response body]

Comments: N/A

Import Scenarios

URL: https://healthbot.microsoft.com/api/account/YourTenantName/scenarios

Method: POST

Special headers: Authorization: Bearer <JWT Token> , Content-type: application/json

Request Parameters: An array of JSON objects in request body. Every object represents a Health Bot scenario

Response: 200 OK in case of success

Examples:

POST https://healthbot.microsoft.com/api/account/healthagentprod/scenarios HTTP/1.1

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnROYW1lIjoiaGVhbHRoYWdlbnRwcm9kIiwiaWF0IjoxNTA2OTYxMzAwfQ.YGayhOc0fOaLRK4cWzRIhSsNH0zWOTy7Pe2PWSY5-cE

Host: healthbot.microsoft.com

Content-type: application/jsonContent-Length: 51116

[scenarios in request body]

Comments: When posting new scenarios, they will be added to the existing scenarios in the scenario editor. Scenario with the same name will be overridden.