Skip to content

Commit

Permalink
Update Docs: migrate Beta Features - GraphQL APIs (#7046)
Browse files Browse the repository at this point in the history
* Update Docs: migrate Beta Features - GraphQL APIs

* Update Docs: migrate GraphQL APIs adjust uneeded things

* Update Docs: GraphQL APIs move Note: to top
  • Loading branch information
privatemaker authored Jan 22, 2024
1 parent cfc5fe0 commit 4e91a0b
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 59 deletions.
39 changes: 0 additions & 39 deletions website/content/docs/beta-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,6 @@ publish_mode: editorial_workflow
In order to track unpublished entries statuses the GitLab implementation uses merge requests labels and the BitBucket implementation uses pull requests comments.
## GitHub GraphQL API
Experimental support for GitHub's [GraphQL API](https://developer.github.com/v4/) is now available for the GitHub backend.
**Note: not compatible with Git Gateway.**
GraphQL allows to retrieve data using less individual API requests compared to a REST API. GitHub's GraphQL API still does not support all mutations necessary to completely replace their REST API, so this feature only calls the new GraphQL API where possible.
You can use the GraphQL API for the GitHub backend by setting `backend.use_graphql` to `true` in your CMS config:

```yml
backend:
name: github
repo: owner/repo # replace this with your repo info
use_graphql: true
```

Learn more about the benefits of GraphQL in the [GraphQL docs](https://graphql.org).

## GitLab GraphQL API

Experimental support for GitLab's [GraphQL API](https://docs.gitlab.com/ee/api/graphql/) is now available for the GitLab backend.

**Note: not compatible with Git Gateway.**

GraphQL allows to retrieve data using less individual API requests compared to a REST API.
The current implementation uses the GraphQL API in specific cases, where using the REST API can be slow and lead to exceeding GitLab's rate limits. As we receive feedback and extend the feature, we'll migrate more functionality to the GraphQL API.

You can enable the GraphQL API for the GitLab backend by setting `backend.use_graphql` to `true` in your CMS config:

```yml
backend:
name: gitlab
repo: owner/repo # replace this with your repo info
use_graphql: true
# optional, defaults to 'https://gitlab.com/api/graphql'. Can be used to configure a self hosted GitLab instance.
graphql_api_root: https://my-self-hosted-gitlab.com/api/graphql
```
Expand Down
18 changes: 18 additions & 0 deletions website/content/docs/github-backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,21 @@ The above configuration would look for the status who's `"context"` is `"my-prov
## Git Large File Storage (LFS)
Please note that the GitHub backend **does not** support [git-lfs](https://git-lfs.github.com/), see [this issue](https://github.com/decaporg/decap-cms/issues/1206) for more information.
## GraphQL API
**Note: not compatible with `git-gateway`**

GraphQL allows to retrieve data using less individual API requests compared to a REST API. GitHub's GraphQL API still does not support all mutations necessary to completely replace their REST API, so this feature only calls the new GraphQL API where possible.

You can use the GraphQL API for the GitHub backend by setting `backend.use_graphql` to `true` in your CMS config:

```yml
backend:
name: github
repo: owner/repo # replace this with your repo info
use_graphql: true
```

Learn more about the benefits of GraphQL in the [GraphQL docs](https://graphql.org).
64 changes: 44 additions & 20 deletions website/content/docs/gitlab-backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,32 @@ With GitLab's PKCE authorization, users can authenticate with GitLab directly fr
auth_endpoint: oauth/authorize
```


**Note:** In all cases, GitLab also provides you with a client secret. You should *never* store this in your repo or reveal it in the client.


## GraphQL API

**Note: not compatible with `git-gateway`**

GraphQL allows to retrieve data using less individual API requests compared to a REST API.
The current implementation uses the GraphQL API in specific cases, where using the REST API can be slow and lead to exceeding GitLab's rate limits. As we receive feedback and extend the feature, we'll migrate more functionality to the GraphQL API.

You can enable the GraphQL API for the GitLab backend by setting `backend.use_graphql` to `true` in your CMS config:

```yml
backend:
name: gitlab
repo: owner/repo # replace this with your repo info
use_graphql: true
# optional, defaults to 'https://gitlab.com/api/graphql'. Can be used to configure a self hosted GitLab instance.
graphql_api_root: https://my-self-hosted-gitlab.com/api/graphql
```

Learn more about the benefits of GraphQL in the [GraphQL docs](https://graphql.org).


## (DEPRECATED) Client-Side Implicit Grant

**Note:** This method is not recommended and will be deprecated both [by GitLab](https://gitlab.com/gitlab-org/gitlab/-/issues/288516) and [in the OAuth 2.1 specification](https://oauth.net/2.1/) in the future.
Expand All @@ -67,25 +93,23 @@ With GitLab's Implicit Grant, users can authenticate with GitLab directly from t
1. Follow the [GitLab docs](https://docs.gitlab.com/ee/integration/oauth_provider.html#adding-an-application-through-the-profile) to add your Decap CMS instance as an OAuth application and uncheck the **Confidential** checkbox. For the **Redirect URI**, enter the address where you access Decap CMS, for example, `https://www.mysite.com/admin/`. For scope, select `api`.
2. GitLab gives you an **Application ID**. Copy this ID and enter it in your Decap CMS `config.yml` file, along with the following settings:

```yaml
backend:
name: gitlab
repo: owner-name/repo-name # Path to your GitLab repository
auth_type: implicit # Required for implicit grant
app_id: your-app-id # Application ID from your GitLab settings
```

You can also use Implicit Grant with a self-hosted GitLab instance. This requires adding `api_root`, `base_url`, and `auth_endpoint` fields:
```yaml
backend:
name: gitlab
repo: owner-name/repo-name # Path to your GitLab repository
auth_type: implicit # Required for implicit grant
app_id: your-app-id # Application ID from your GitLab settings
```

```yaml
backend:
name: gitlab
repo: owner-name/repo-name # Path to your GitLab repository
auth_type: implicit # Required for implicit grant
app_id: your-app-id # Application ID from your GitLab settings
api_root: https://my-hosted-gitlab-instance.com/api/v4
base_url: https://my-hosted-gitlab-instance.com
auth_endpoint: oauth/authorize
```
You can also use Implicit Grant with a self-hosted GitLab instance. This requires adding `api_root`, `base_url`, and `auth_endpoint` fields:

**Note:** In all cases, GitLab also provides you with a client secret. You should *never* store this in your repo or reveal it in the client.
```yaml
backend:
name: gitlab
repo: owner-name/repo-name # Path to your GitLab repository
auth_type: implicit # Required for implicit grant
app_id: your-app-id # Application ID from your GitLab settings
api_root: https://my-hosted-gitlab-instance.com/api/v4
base_url: https://my-hosted-gitlab-instance.com
auth_endpoint: oauth/authorize
```

0 comments on commit 4e91a0b

Please sign in to comment.