openapi: 3.0.3
info:
title: OSSInsight Public API
description: >
Here are documentation about the OSSInsight Public APIs (beta) which help developers integrate OSSInsight data into their applications easily and quickly.
## Usage
The OSSInsight Public API is designed to follow the OpenAPI specification and can be accessed by initiating HTTP requests using the command line `curl` or web request libraries in different programming languages.
### Base URL
All API requests are based on the following URL:
```shell
https://api.ossinsight.io/public
```
### Authentication
No authentication is required for beta version of public APIs, but there are [rate limits](#rate-limit) for API requests.
> Note:
> We will add authentication way for larger API requests in future releases.
### Rate Limit
For each IP address, the rate limit allows for up to **600 requests per hour**.
### Example
For example, if you want to know what countries the stargazers in the `pingcap/tidb` repository are located in, you can make a request using the curl command as follows:
```shell
curl https://api.ossinsight.io/public/repos/pingcap/tidb/stargazer/locations
```
Example Response
```json
{
"type": "sql_endpoint",
"data": {
"columns": [
{
"col": "country_or_area",
"data_type": "CHAR",
"nullable": true
},
{
"col": "count",
"data_type": "BIGINT",
"nullable": true
},
{
"col": "percentage",
"data_type": "DECIMAL",
"nullable": true
}
],
"rows": [
{
"count": "9183",
"country_or_area": "CN",
"percentage": "0.5936"
},
{
"count": "1542",
"country_or_area": "US",
"percentage": "0.0997"
},
{
"count": "471",
"country_or_area": "JP",
"percentage": "0.0304"
}
],
"result": {
"code": 200,
"message": "Query OK!",
"start_ms": 1690351487809,
"end_ms": 1690351487930,
"latency": "121ms",
"row_count": 132,
"row_affect": 0,
"limit": 300,
"databases": [
"gharchive_dev"
]
}
}
}
```
## Categories
```mdx-code-block
import DocCardList from '@theme/DocCardList';
import {useCurrentSidebarCategory} from '@docusaurus/theme-common';
{
// Exclude Introduction and Showcase pages
return item.docId !== 'api/showcase' && item.docId !== 'api/ossinsight-public-api';
})}/>
```
## Request New API
If the API in the documentation does not meet your query requirements, please contact us as follows:
- Email us at ossinsight@pingcap.com
- Open an issue in the [OSSInsight GitHub repository](https://github.com/pingcap/ossinsight/issues/new?assignees=&labels=type%2Ffeature&projects=&template=feature_request.md&title=New%20API)
version: 0.0.1
components:
schemas: {}
paths:
"/repos/{owner}/{repo}/stargazer/locations/":
get:
operationId: list-repo-stargazer-locations
summary: List countries/regions of repo stargazers
tags:
- Repositories
description: List countries/regions of stargazers for the specified repository.
parameters:
- schema:
type: string
default: 2000-01-01
in: query
name: from
required: false
description: The start date of the range.
- schema:
type: string
default: 2099-01-01
in: query
name: to
required: false
description: The end date of the range.
- schema:
type: string
example: pingcap
in: path
name: owner
required: true
description: The owner of the repo.
- schema:
type: string
example: tidb
in: path
name: repo
required: true
description: The name of the repo.
responses:
"200":
description: Default Response
content:
application/json:
schema:
type: object
properties:
type:
type: string
description: The type of the endpoint.
enum:
- sql_endpoint
data:
type: object
properties:
columns:
type: array
items:
type: object
properties:
col:
type: string
data_type:
type: string
enum:
- CHAR
- BIGINT
- DECIMAL
- INT
- UNSIGNED BIGINT
- TINYINT
- TIMESTAMP
- TEXT
- VARCHAR
- DATETIME
- DOUBLE
- FLOAT
- DATE
- TIME
- YEAR
- MEDIUMINT
- SMALLINT
- BIT
- BINARY
- VARBINARY
- JSON
- ENUM
- SET
- TINYTEXT
- MEDIUMTEXT
- LONGTEXT
- TINYBLOB
- MEDIUMBLOB
- BLOB
- LONGBLOB
nullable:
type: boolean
rows:
type: array
items:
type: object
additionalProperties:
type: string
result:
type: object
properties:
code:
type: number
message:
type: string
start_ms:
type: number
end_ms:
type: number
latency:
type: string
row_count:
type: number
row_affect:
type: number
limit:
type: number
databases:
type: array
items:
type: string
example:
type: sql_endpoint
data:
columns:
- col: country_or_area
data_type: CHAR
nullable: true
- col: count
data_type: BIGINT
nullable: true
- col: percentage
data_type: DECIMAL
nullable: true
rows:
- count: "9183"
country_or_area: CN
percentage: "0.5936"
- count: "1542"
country_or_area: US
percentage: "0.0997"
- count: "471"
country_or_area: JP
percentage: "0.0304"
result:
code: 200
message: Query OK!
start_ms: 1690363357727
end_ms: 1690363358540
latency: 813ms
row_count: 132
row_affect: 0
limit: 300
databases:
- gharchive_dev
servers:
- url: http://127.0.0.1:3450/public
tags:
- name: Repositories