-
Notifications
You must be signed in to change notification settings - Fork 135
Client REST
Please note there are 2 rest clients, one which uses Flask and one use the async library Sanic. Only the Flask version currently works on all platforms. Sanic struggles to install on Windows, so until further notice only use Sanic on Linux of Max
The REST client exposes the bot through a REST compliant API, with a GET endpoint /api/rest/v1.0/ask
. This endpoint takes 2 parameters
- question - which is a urlencoded question to ask.
- userid - A unique identifier for the user making the call
An example of the URL would therefore be
http://localhost:8989/api/rest/v1.0/ask?question=hello+world&userid=1234567890
The client returns a response as a JSON package of the format containing a response object and the HTTP status code as follows
[
{
"response": {
"answer": "Hello!",
"question": "hello world",
"userid": "1234567890"
}
},
200
]
To run the client, use a derivative of the following script
#! /bin/sh
clear
export PYTHONPATH=../../src:.
python3 -m programy.clients.restful.sanic.client --config ./config.yaml --cformat yaml --logging ./logging.yaml
You can test the client using curl using the following command
curl 'http://localhost:8989/api/rest/v1.0/ask?question=hello+world&userid=1234567890'
This will return the following response against Y-Bot
[
{
"response": {
"answer": "Hello!",
"question": "hello world",
"userid": "1234567890"
}
},
200
]
Configuration settings are described in the Wiki page REST Configuration
Email: [email protected] | Twitter: @keiffster | Facebook: keith.sterling | LinkedIn: keithsterling | My Blog
- Home
- Background
- Guiding Principles
- Reporting an Issue
- Installation
- You And Your Bot
- Bots
- Clients
- Configuration
- AIML
- Sentence Splitting
- Natural Langauge Processing
- Normalization
- Spelling
- Sentiment Analysis
- Translation
- Security
- Hot Reload
- Logging
- Out of Band
- Multi Language
- RDF Support
- Rich Media
- Asynchronous Events
- Triggers
- External Services
- Dynamic Sets, Maps & Vars
- Extensions
- Pre & Post Processors
- Custom Nodes
- The Brain Tree
- Utilities
- Building It Yourself
- Creating Your Own Bot
- Contributing
- Performance Testing
- FAQ
- History
- Website