Files
directus/docs/reference/api/rest/server.md
Rijk van Zanten f90c31b798 GraphQL 2.0 (#4625)
* Start on GraphQL "2.0", add methodnotallowed exceptoin

* Fix relative file pointer in peer dep

* [WIP] Add pre-filtered schema to SchemaOverview

* Use root schema as is, add reduce-schema util

* Use reduceSchema in the wild

* Base schema on local reduced schema

* Remove todo

* Use graphql-compose to build out schema

* Start restructuring resolvers

* Add create mutation

* Return boolean true for empty create mutation selections

* Add update mutation

* Add delete mutation

* Add system/items scoping

* Fix merge conflicts for real now

* Use system services, rename ids->keys

* Start on docs on mutations

* Updates to match main

* Add fetch-by-id

* Add one/many resolvers for mutations

* Check system collection rows for singleton

* Fix resolver extraction for single read

* Share delete return type

* Add comments

* Use collection root name for readable type

* Add specs endpoint for GraphQL SDL

* Update docs

* Add note on SDL spec

* Fix delete single example

* Remove package-lock

* Fix collection read scoping in non-read
2021-03-30 17:06:35 -04:00

5.5 KiB

pageClass
pageClass
page-reference

Server

Provides detailed information about the project server, its schema, and its health. Learn more about Projects.

toc


Get OpenAPI Specification

Retrieve the OpenAPI spec for the current project.

::: tip Permissions

This OAS spec is based on the read permissions of the currently authenticated user.

:::

Returns

Object conforming to the OpenAPI Specification

GET /server/specs/oas
// Response
{
	"openapi": "3.0.1",
	"info": {
		"title": "Dynamic API Specification",
		"description": "This is a dynamically generated API specification for all endpoints existing on the current .",
		"version": "9.0.0-rc.34"
	},
	"servers": [
		{
			"url": "http://localhost:8055",
			"description": "Your current Directus instance."
		}
	]
	// etc
}

Get GraphQL SDL

Retrieve the GraphQL SDL for the current project.

::: tip Permissions

The SDL is based on the permissions of the currently authenticated user.

:::

Returns

GraphQL SDL file.

GET /server/specs/graphql/
GET /server/specs/graphql/system
type about_us {
  id: Int
  introduction: String
  our_process: String
  sales_email: String
  general_email: String
  primary_color: String
  secondary_color: String
  logo: directus_files
  mark: directus_files
}

type articles {
  id: Int
  status: String
	...
# etc

Ping

Ping... pong! 🏓

Returns

Pong.

GET /server/ping
// Returns
pong

Info

Information about the current installation.

::: tip Permissions

The public information is returned for everybody. Admin users get additional information (see below).

:::

Returns

project object
Public information about the project. Used to render the Admin App public pages.

See the settings object for more information on the individual properties of the project object.

Admin users also get the following information:

directus.version string
Current version of Directus used.

node.version string
Current version of Node used.

node.uptime integer
How long the current process has been running.

os.type string
What type of operation system is used.

os.version string
What version of the operation system is used.

os.uptime string
How long the operating system has been up.

os.totalmem string
How much memory is available on the operating system.

GET /server/info
// Response

// Non-admin
{
	"data": {
		"project": {
			"project_name": "Directus",
			"project_logo": null,
			"project_color": null,
			"public_foreground": null,
			"public_background": null,
			"public_note": null,
			"custom_css": null
		}
	}
}

// Admin
{
  "data": {
    "project": {
      "project_name": "Directus",
      "project_logo": null,
      "project_color": null,
      "public_foreground": null,
      "public_background": null,
      "public_note": null,
      "custom_css": null
    },
    "directus": {
      "version": "9.0.0-rc.34"
    },
    "node": {
      "version": "15.5.1",
      "uptime": 77586
    },
    "os": {
      "type": "macOS",
      "version": "Big Sur (11)",
      "uptime": 180836,
      "totalmem": 34359738368
    }
  }
}

Health

Get the current health status of the server.

The health check response structure is based on the Health Check Response Format for HTTP APIs Draft Specification.

::: tip Permissions

Admin users get a wide range of information, including database connection speed, email connection status etc.

:::

Returns

status string
One of ok, warn, error.

Authenticated admin users also get the following information:

releaseId string
Directus version in use.

serviceId string
UUID of the current Directus instance.

checks array
Array with the status of all individually connected services.

GET /server/health
// Response

// Non-admin
{
  "status": "ok"
}

// Admin
{
  "status": "ok",
  "releaseId": "9.0.0",
  "serviceId": "3292c816-ae02-43b4-ba91-f0bb549f040c",
  "checks": {
    "pg:responseTime": [
      {
        "status": "ok",
        "componentType": "datastore",
        "observedUnit": "ms",
        "observedValue": 0.489
      }
    ],
    "pg:connectionsAvailable": [
      {
        "status": "ok",
        "componentType": "datastore",
        "observedValue": 2
      }
    ],
    "pg:connectionsUsed": [
      {
        "status": "ok",
        "componentType": "datastore",
        "observedValue": 0
      }
    ],
    "storage:local:responseTime": [
      {
        "status": "ok",
        "componentType": "objectstore",
        "observedValue": 1.038,
        "observedUnit": "ms"
      }
    ],
    "email:connection": [
      {
        "status": "ok",
        "componentType": "email"
      }
    ]
  }
}