First Request
You should now be ready to send your first API request!
Please note
The term collections refers to MongoDB collections or MySQL tables, depending on your database type.
Come up with a question that can be answered via the data in your activated collection(s). Add the question as a key/value json object to the request body. Using Node.js you add it as a parameter to the .ask() method:
ts
import { Florentine } from "@florentine-ai/api";
const FlorentineAI = new Florentine({
florentineToken: "<FLORENTINE_API_KEY>"
});
const res = await FlorentineAI.ask({ question: "<YOUR_QUESTION>" });bash
curl https://nltm.florentine.ai/ask \
-H "content-type: application/json" \
-H "florentine-token: <FLORENTINE_API_KEY>" \
-d '{ "question": "<YOUR_QUESTION>" }'By default, the API returns a natural language answer based on the aggregation results.
Imagine a tabletennis collection that records the results of the matches of two players.
If I ask the question Who won the last match? the answer looks similar to this:
json
{
"answer": "Frank won the last match. According to our records, he emerged as the winner, highlighting his strong performance in that game."
}