Technical Description and API Documentation
FriendlyData provides an API endpoint to convert text into SQL command or fetch data from provided database.
API
https://api.friendlydata.io/Parse message endpoint
It gets your message and returns SQL command based on your DB schema or data if provided access to DB.
Example Requestcurl -X POST \
https://api.friendlydata.io/api/v1/parse_message \
-d token="your_application_token" \
-d message_body="companies name starts with face and funding > 10 M"Arguments
token: "your application token"
message_body: "message to parse"Response Object (PostgreSQL)*
{
sql: "SELECT * FROM companies WHERE LOWER(name) like 'face%' AND raised > '10000000' LIMIT 100;"
}* If provided acccess to database FriendlyData returns data in JSON format
Supported SQL features
| Feature | Example |
|---|---|
| 1. Filter by | |
| constant value | companies in San Francisco |
| comparison operations | companies with more than 5k employees |
| negative field values | companies not from sf |
| multiple fields (and/or) | companies from NY with more than 10 employees |
| date expressions | companies founded last year or this Jan or Feb |
| aggregated values | avg funding by city where avg funding > 1M |
| 2. Aggregation | |
| average | avg funding of companies in 2016 |
| minimum | min funding of companies in 2016 |
| maximum | min funding of companies in 2016 |
| count | count of companies by year |
| sum | total funding by year |
| nested aggregation expressions | total, avg and max employees and min funding in companies from SF |
| 3. Grouping | |
| group by field | avg funding by year |
| 4. Sorting by field | |
| asc | show companies ordered by funding |
| desc | sort by funding highest first |
| 5. Dates | |
| date formats | companies opened before Sep 11, 2001 |
| date synonyms / shortcuts | companies opened yesterday |
| 6. Limit | |
| result limit | 5 companies from sf |
| 7. Joins | |
| one to many | show companies from SF (where city is different table) |
