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 Request
curl -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

FeatureExample
1. Filter by
constant valuecompanies in San Francisco
comparison operationscompanies with more than 5k employees
negative field valuescompanies not from sf
multiple fields (and/or)companies from NY with more than 10 employees
date expressionscompanies founded last year or this Jan or Feb
aggregated valuesavg funding by city where avg funding > 1M
2. Aggregation
averageavg funding of companies in 2016
minimummin funding of companies in 2016
maximummin funding of companies in 2016
countcount of companies by year
sumtotal funding by year
nested aggregation expressionstotal, avg and max employees and min funding in companies from SF
3. Grouping
group by fieldavg funding by year
4. Sorting by field
ascshow companies ordered by funding
descsort by funding highest first
5. Dates
date formatscompanies opened before Sep 11, 2001
date synonyms / shortcutscompanies opened yesterday
6. Limit
result limit5 companies from sf
7. Joins
one to manyshow companies from SF (where city is different table)