diff --git a/docs/api.md b/docs/api.md index 6e0960a7..c59eae50 100644 --- a/docs/api.md +++ b/docs/api.md @@ -4,37 +4,43 @@ hide: - navigation --- -# Stash API +# Stash GraphQL API The Stash GraphQL API facilitates automated operations through a type-based schema that is both introspective and self-documenting. Stash includes an integrated playground where users can execute queries and retrieve schema structures and documentation via a special introspection query. -1. You can access the playground from Stash. -1. Go to :fontawesome-solid-gear: **Settings** > **Tools** > **GraphQL playground**. -1. Click on the left to access the Documentation Explorer. - -All HTTP requests should be directed to `:/graphql` (default: `http://localhost:9999/graphql`). - -!!! tip +??? tip "Learn more about GraphQL" For further information, visit the [official GraphQL site](https://graphql.org/learn/){target="_blank"}. +## Accessing the GraphQL playground + +1. Navigate to :fontawesome-solid-gear: **Settings** > **Tools** > **GraphQL playground**. +1. Click on the left to access the Documentation Explorer. + +## Endpoint + +All HTTP requests should be directed to `:/graphql` (default: `localhost:9999/graphql`). + ## Authentication Include the API key generated in Stash in the header of every request. For details on obtaining the API Key, refer to Stash's in-app manual. === "Example using curl" -Replace `` with your **API Key** found under :fontawesome-solid-gear: **Settings** > **Security** > **Authentication**. - -Replace `` with the raw query, which can be formatted using the playground. - ```shell curl -X POST -H "ApiKey: " -H "Content-Type: application/json" --data '{ "query": "" }' localhost:9999/graphql ``` +Replace `` with your **API Key** found under :fontawesome-solid-gear: **Settings** > **Security** > **Authentication**. + +Replace `` with the raw query, which can be formatted using the playground. + ### Legacy cookie authentication +!!! info + Was made obsolete in version v0.7. It is recommended to use the `API Key` method. + For configurations using a username/password, cookies must be used for authentication. === "Example using curl" @@ -43,5 +49,3 @@ For configurations using a username/password, cookies must be used for authentic curl --verbose --cookie-jar cookie.txt --data 'username=stash&password=**' localhost:9999/login curl --cookie cookie.txt -H "Content-Type: application/json" --data '{ "query": "" }' localhost:9999/graphql ``` - -It is recommended to use the `API Key` method over the legacy cookie method.