The demo site makes use of a publicly available AskGit HTTP API which can be called directly. Queries are executed in an AWS Lambda function and have the following limitations:
- At most 500 rows can be returned
- Queries time out after 30 seconds
- Query results must be under 10 MB
You can use this API directly by sending a POST
request to https://try.askgit.com/api/query
.
Make sure you set a Content-Type: application/json
header.
The request body shoud have the following fields:
repo
- the repository to queryquery
- the SQL query to execute
The JSON response will have the following fields:
runningTime
- query runtime in msrows
- array of objects representing query resultscolumnNames
- array of column names in the result setcolumnTypes
- array of column types in the result set
For example:
curl -X POST -H "content-type: application/json" https://try.askgit.com/api/query -d '{"query": "select * from commits limit 1", "repo": "https://github.com/askgitdev/askgit"}'
Will yield a result like:
{
"runningTime": 381563788,
"rows": [
{
"author_email": "[email protected]",
"author_name": "Patrick DeVivo",
"author_when": "2021-06-27T15:14:22-04:00",
"committer_email": "[email protected]",
"committer_name": "GitHub",
"committer_when": "2021-06-27T15:14:22-04:00",
"hash": "4c0ba314f9551e6d316feb973b607a20b624f46a",
"message": "Merge pull request #128 from askgitdev/change-import-paths\n\nChange import paths to reflect new org owner (`askgitdev`)",
"parents": 2
}
],
"columnNames": [
"hash",
"message",
"author_name",
"author_email",
"author_when",
"committer_name",
"committer_email",
"committer_when",
"parents"
],
"columnTypes": [
"TEXT",
"TEXT",
"TEXT",
"TEXT",
"DATETIME",
"TEXT",
"TEXT",
"DATETIME",
"INT"
]
}