get

http://api.brainshop.ai/get?bid=[bid]&key=[key]&uid=[uid]&msg=[msg]

Description

This API returns a contextual reply (robot message) to a user message. You should use this API to deploy a brain to your own system.

Parameters

  • bid: The brain ID.
  • key: The access key for the brain.
  • uid: The ID you assign to end user, an alphanumeric text string.
  • msg: The message from user.

To obtain the bid and key for a brain,

  1. Click the brain in the left side bar.
  2. Click Settings tab.

The bid and key can be found there.

The uid is the unique identifier for each end user. It is created and maintained by your application. Technically it can be any text string made up of letters and numbers.

Return Values

This API returns a JSON string structured as below

{
  "cnt":"[value]"
}

The JSON includes only one datum, 'cnt', the content of reply given by the brain. The reason to use JSON for a single datum here is we are extending the API and it will deliver more data in the future. The below is an example of possible JSON with more data.

{
  "cnt":"[value]",
  "scr":"[value]",
  "tts":"[value]",
  "face":"[value]"
}

To display the reply to end users, you need to convert JSON to an object or array (decoding) and then extract the content from the "cnt" data. You may search for the specific method to decode a JSON in your programming language.