Skip to content

Commit

Permalink
docs: update API docs to reflect new Apollo server (#1870)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryscheng committed Jul 29, 2024
1 parent 6c012e8 commit 9f9049f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
Binary file added apps/docs/docs/integrate/api-explorer.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 24 additions & 21 deletions apps/docs/docs/integrate/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ If you already have an account, log in. Then create a new personal API key:
All API requests are sent to the following URL:

```
https://opensource-observer.hasura.app/v1/graphql
https://www.opensource.observer/api/v1/graphql
```

You can navigate to our
[public GraphQL explorer](https://cloud.hasura.io/public/graphiql?endpoint=https://opensource-observer.hasura.app/v1/graphql)
[public GraphQL explorer](https://www.opensource.observer/graphql)
to explore the schema and execute test queries.

## How to Authenticate
Expand All @@ -59,46 +59,49 @@ This query will fetch the first 10 projects in

```graphql
query GetProjects {
projects_v1(limit: 10) {
project_id
project_name
display_name
oso_projectsV1(limit: 10) {
description
displayName
projectId
projectName
projectNamespace
projectSource
}
}
```

This query will fetch **code metrics** for 10 projects, ordered by `star_count`.
This query will fetch **code metrics** for 10 projects, ordered by `starCount`.

```graphql
query GetCodeMetrics {
code_metrics_by_project_v1(
limit: 10
order_by: { star_count: desc_nulls_last }
) {
project_id
project_name
event_source
star_count
fork_count
contributor_count
oso_codeMetricsByProjectV1(limit: 10, order_by: [{ starCount: Desc }]) {
projectId
projectName
eventSource
starCount
forkCount
contributorCount
}
}
```

## GraphQL Explorer

You can navigate to our [public GraphQL explorer](https://www.opensource.observer/graphql) to explore the schema and execute test queries.

![GraphQL explorer](./api-explorer.gif)

:::tip
As shown in the video, you must "Inline Variables" in order for queries to run in the explorer.
:::

The GraphQL schema is automatically generated from [`oso/dbt/models/marts`](https://github.com/opensource-observer/oso/tree/main/dbt/models/marts). Any dbt model defined there will automatically be exported to our GraphQL API. See the guide on [adding DBT models](../contribute/impact-models.md) for more information on contributing to our marts models.

:::warning
Our data pipeline is under heavy development and all table schemas are subject to change until we introduce versioning to marts models.
Please join us on [Discord](https://www.opensource.observer/discord) to stay up to date on updates.
:::

You can navigate to our [public GraphQL explorer](https://cloud.hasura.io/public/graphiql?endpoint=https://opensource-observer.hasura.app/v1/graphql) to explore the schema and execute test queries.

![GraphQL explorer](./graphql-explorer.png)

## Rate Limits

All requests are rate limited. There are currently 2 separate rate limits for different resources:
Expand Down
Binary file removed apps/docs/docs/integrate/graphql-explorer.png
Binary file not shown.

0 comments on commit 9f9049f

Please sign in to comment.