diff --git a/api-spec/components/parameters.yaml b/api-spec/components/parameters.yaml new file mode 100644 index 00000000..21ca0632 --- /dev/null +++ b/api-spec/components/parameters.yaml @@ -0,0 +1,110 @@ +Id: + description: Identifier for the object. + name: id + in: path + required: true + schema: + type: integer +UUId: + description: Unique identifier for the object. + name: id + in: path + required: true + schema: + example: 8cbb43fe-4cdf-4991-8352-c461779cec02 + type: string +Collection: + description: Collection of which you want to retrieve the items from. + name: collection + in: path + required: true + schema: + type: string +Search: + description: Filter by items that contain the given search query in one of their fields. + in: query + name: search + required: false + schema: + type: string +Page: + description: Cursor for use in pagination. Often used in combination with limit. + in: query + name: page + required: false + schema: + type: integer +Offset: + description: How many items to skip when fetching data. + in: query + name: offset + required: false + schema: + type: integer +Sort: + description: >- + How to sort the returned items. `sort` is a CSV of fields used to sort the fetched items. Sorting defaults to ascending (ASC) order but a minus sign (` - `) can be used to reverse this to descending (DESC) order. Fields are prioritized by their order in the CSV. You can also use a ` ? ` to sort randomly. + in: query + name: sort + required: false + explode: false + schema: + type: array + items: + type: string +Meta: + description: What metadata to return in the response. + in: query + name: meta + required: false + schema: + type: string +Limit: + description: A limit on the number of objects that are returned. + in: query + name: limit + required: false + schema: + type: integer +Filter: + description: Select items in collection by given conditions. + in: query + name: filter + required: false + content: + application/json: + schema: + type: object + example: + : + : +Fields: + description: Control what fields are being returned in the object. + in: query + name: fields + required: false + explode: false + schema: + type: array + items: + type: string +Export: + name: export + description: Saves the API response to a file. Accepts one of `csv`, `json`, `xml`, `yaml`. + in: query + required: false + schema: + type: string + enum: + - csv + - json + - xml + - yaml +Version: + name: version + description: >- + Retrieve an item's state from a specific Content Version. The value corresponds to the "key" of the Content Version. + in: query + required: false + schema: + type: string diff --git a/api-spec/components/responses.yaml b/api-spec/components/responses.yaml new file mode 100644 index 00000000..1d6d39eb --- /dev/null +++ b/api-spec/components/responses.yaml @@ -0,0 +1,30 @@ +NotFoundError: + description: "Error: Not found." + content: + application/json: + schema: + type: object + properties: + error: + type: object + properties: + code: + type: integer + format: int64 + message: + type: string +UnauthorizedError: + description: "Error: Unauthorized request" + content: + application/json: + schema: + type: object + properties: + error: + type: object + properties: + code: + type: integer + format: int64 + message: + type: string \ No newline at end of file diff --git a/api-spec/components/schemas/_index.yaml b/api-spec/components/schemas/_index.yaml new file mode 100644 index 00000000..5d4624a0 --- /dev/null +++ b/api-spec/components/schemas/_index.yaml @@ -0,0 +1,56 @@ +x-metadata: + $ref: x-metadata.yaml +Activity: + $ref: Activity.yaml +Collections: + $ref: Collections.yaml +Comments: + $ref: Comments.yaml +Dashboards: + $ref: Dashboards.yaml +Diff: + $ref: Diff.yaml +Extensions: + $ref: Extensions.yaml +Fields: + $ref: Fields.yaml +Files: + $ref: Files.yaml +Flows: + $ref: Flows.yaml +Folders: + $ref: Folders.yaml +Items: + $ref: Items.yaml +Notifications: + $ref: Notifications.yaml +Operations: + $ref: Operations.yaml +Panels: + $ref: Panels.yaml +Permissions: + $ref: Permissions.yaml +Policies: + $ref: Policies.yaml +Presets: + $ref: Presets.yaml +Query: + $ref: Query.yaml +Relations: + $ref: Relations.yaml +Revisions: + $ref: Revisions.yaml +Roles: + $ref: Roles.yaml +Schema: + $ref: Schema.yaml +Settings: + $ref: Settings.yaml +Shares: + $ref: Shares.yaml +Translations: + $ref: Translations.yaml +Users: + $ref: Users.yaml +Versions: + $ref: Versions.yaml diff --git a/api-spec/components/schemas/activity.yaml b/api-spec/components/schemas/activity.yaml new file mode 100644 index 00000000..d3d0fce3 --- /dev/null +++ b/api-spec/components/schemas/activity.yaml @@ -0,0 +1,62 @@ +type: object +properties: + id: + description: Unique identifier for the object. + example: 2 + type: integer + action: + description: Action that was performed. + example: update + type: string + enum: + - create + - update + - delete + - login + user: + description: The user who performed this action. Many-to-one to users. + type: string + oneOf: + - $ref: Users.yaml + nullable: true + timestamp: + description: When the action happened. + example: '2019-12-05T22:52:09Z' + type: string + format: date-time + ip: + description: The IP address of the user at the time the action took place. + example: 127.0.0.1 + oneOf: + - type: string + - format: ipv4 + user_agent: + description: User agent string of the browser the user used when the action took place. + example: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/78.0.3904.108 Safari/537.36 + type: string + collection: + description: Collection identifier in which the item resides. + oneOf: + - type: string + - $ref: Collections.yaml + item: + description: Unique identifier for the item the action applied to. This is always a string, even for integer primary keys. + example: '328' + type: string + comment: + description: User comment. This will store the comments that show up in the right sidebar of the item edit page in the admin app. + example: null + type: string + nullable: true + origin: + description: Origin of the request when the action took place. + example: https://directus.io + type: string + revisions: + description: Any changes that were made in this activity. One-to-many to revisions. + nullable: true + type: array + items: + oneOf: + - $ref: Revisions.yaml +x-collection: directus_activity diff --git a/api-spec/components/schemas/collections.yaml b/api-spec/components/schemas/collections.yaml new file mode 100644 index 00000000..7a963fa7 --- /dev/null +++ b/api-spec/components/schemas/collections.yaml @@ -0,0 +1,76 @@ +type: object +properties: + collection: + description: Name of the collection. This matches the table name in the database. + example: customers + type: string + icon: + nullable: true + description: Icon displayed in the Data Studio when working with this collection. + type: string + note: + nullable: true + description: Short description displayed in the Data Studio. + type: string + display_template: + nullable: true + description: How items in this collection should be displayed when viewed relationally in the Data Studio. + type: string + hidden: + nullable: false + description: Whether or not this collection is hidden in the Data Studio. + type: boolean + singleton: + nullable: false + description: Whether or not this collection is treated as a singleton. + type: boolean + translations: + description: How this collection's name is displayed in the different languages in the Data Studio. + type: array + nullable: true + archive_field: + description: What field in the collection holds the archived state. + nullable: true + type: string + archive_app_filter: + nullable: false + type: boolean + archive_value: + nullable: true + description: What value the archive field should be set to when archiving an item. + type: string + unarchive_value: + nullable: true + description: What value the archive field should be set to when unarchiving an item. + type: string + sort_field: + nullable: true + description: What field holds the sort value on the collection. The Data Studio uses this to allow drag-and-drop manual sorting. + type: string + accountability: + nullable: true + description: What data is tracked. One of `all`, `activity`. + type: string + item_duplication_fields: + nullable: true + description: What fields are duplicated during "Save as copy" action of an item in this collection. + type: array + sort: + nullable: true + description: What sort order of the collection relative to other collections of the same level. + type: integer + group: + nullable: true + description: The name of the parent collection. + type: string + oneOf: + - $ref: Collections.yaml + collapse: + nullable: false + description: What is the default behavior of this collection or "folder" collection when it has nested collections. One of `open`, `closed`, `locked`. + type: string + versioning: + nullable: false + description: Whether or not Content Versioning is enabled for this collection. + type: boolean +x-collection: directus_collections diff --git a/api-spec/components/schemas/comments.yaml b/api-spec/components/schemas/comments.yaml new file mode 100644 index 00000000..c2824fd4 --- /dev/null +++ b/api-spec/components/schemas/comments.yaml @@ -0,0 +1,42 @@ +type: object +properties: + collection: + description: Collection identifier in which the item resides. + example: articles + type: string + id: + description: Unique identifier for the object. + example: 2fab3b9d-0543-4b87-8a30-3c5ee66fedf1 + type: string + format: uuid + item: + description: The item the comment is created for. + example: 15 + type: string + comment: + description: User comment. This will store the comments that show up in the right sidebar of the item edit page in the Data Studio. + example: This is a comment on an article + type: string + date_created: + description: Timestamp in ISO8601 when the comment was created. + example: 2023-01-15T09:14:52Z + type: string + format: date-time + date_updated: + description: Timestamp in ISO8601 when the comment was last updated. + example: 2023-01-15T09:00:00Z + type: string + format: date-time + user_created: + description: The user who created the comment. Many-to-one to users. + example: 12e62fd0-29c7-4fd3-b3d3-c7a39933e8af + type: string + oneOf: + - $ref: Users.yaml + user_updated: + description: The user who last updated the comment. Many-to-one to users. + example: 12e62fd0-29c7-4fd3-b3d3-c7a39933e8af + type: string + oneOf: + - $ref: Users.yaml +x-collection: directus_comments diff --git a/api-spec/components/schemas/dashboards.yaml b/api-spec/components/schemas/dashboards.yaml new file mode 100644 index 00000000..77eaea32 --- /dev/null +++ b/api-spec/components/schemas/dashboards.yaml @@ -0,0 +1,43 @@ +type: object +properties: + id: + description: Primary key of the dashboard; + example: a79bd1b2-beb2-49fc-8a26-0b3eec0e2697 + type: string + format: uuid + name: + description: Name of the dashboard. + example: My dashboard + type: string + icon: + description: Material icon for dashboard. + example: space_dashboard + type: string + note: + description: Descriptive text about the dashboard. + example: Test + type: string + date_created: + description: When the dashboard was created. + example: 2023-01-25T19:16:49.009Z + type: string + format: date-time + user_created: + description: User that created the dashboard. Many-to-one to users. + example: fd066644-c8e5-499d-947b-fe6c6e1a1473 + type: string + format: relation + oneOf: + - $ref: Users.yaml + color: + description: Accent color for the dashboard. + example: #6644FF + type: string + format: hexcode + panels: + description: Panels that are in this dashboard. One-to-may to panels. + example: 22640672-eef0-4ee9-ab04-591f3afb2883 + type: string + oneOf: + - $ref: Panels.yaml +x-collection: directus_shares diff --git a/api-spec/components/schemas/diff.yaml b/api-spec/components/schemas/diff.yaml new file mode 100644 index 00000000..be0bbf3b --- /dev/null +++ b/api-spec/components/schemas/diff.yaml @@ -0,0 +1,46 @@ +type: object +properties: + hash: + type: string + diff: + type: object + properties: + collections: + type: array + items: + type: object + properties: + collection: + type: string + diff: + type: array + items: + type: object + fields: + type: array + items: + type: object + properties: + collection: + type: string + field: + type: string + diff: + type: array + items: + type: object + relations: + type: array + items: + type: object + properties: + collection: + type: string + field: + type: string + related_collection: + type: string + diff: + type: array + items: + type: object \ No newline at end of file diff --git a/api-spec/components/schemas/extensions.yaml b/api-spec/components/schemas/extensions.yaml new file mode 100644 index 00000000..2a24a5ec --- /dev/null +++ b/api-spec/components/schemas/extensions.yaml @@ -0,0 +1,45 @@ +type: object +properties: + enabled: + description: Whether or not the extension is enabled. + nullable: false + type: boolean + id: + nullable: false + description: Unique identifier of the extension. + type: string + format: uuid + bundle: + description: Name of the bundle the extension is in. + example: my-bundle + type: string + nullable: true + type: + description: Type of the extension. One of `'interface'`, `'display'`, `'layout'`, `'module'`, `'panel'`, `'hook'`, `'endpoint'`, `'operation'`, `'bundle'. + type: string + local: + description: Whether the extension exists in the local extensions folder or is loaded from `node_modules`. + type: boolean + version: + description: The currently loaded version of the plugin as defined by its `package.json`. + type: string + partial: + description: | + Whether or not a bundles entries can be individually disabled. This is applicable to bundle type extensions only. + + ``` + { + "name": "my-bundle-operation", + "bundle": "directus-extension-my-bundle", + "schema": { + "type": "operation", + "local": true, + "version": "1.0.0" + }, + "meta": { + "enabled": true + } + } + ``` + type: boolean +x-collection: directus_extensions diff --git a/api-spec/components/schemas/fields.yaml b/api-spec/components/schemas/fields.yaml new file mode 100644 index 00000000..0c90e950 --- /dev/null +++ b/api-spec/components/schemas/fields.yaml @@ -0,0 +1,75 @@ +type: object +properties: + id: + nullable: false + type: integer + collection: + description: Unique name of the collection this field is in. + example: about_us + type: string + field: + description: Unique name of the field. Field name is unique within the collection. + example: id + type: string + special: + nullable: true + description: Any special transform flags that apply to this field. + type: array + items: + type: string + interface: + description: The interface used for this field. + nullable: true + type: string + options: + type: object + description: The interface options configured for this field. The structure is based on the interface used. + nullable: true + display: + nullable: true + description: The display used for this field. + type: string + display_options: + type: string + description: The configured options for the used display. + nullable: true + readonly: + nullable: false + description: If the field is considered readonly in the Data Studio. + type: boolean + hidden: + nullable: false + description: If the field is hidden from the edit page in the Data Studio. + type: boolean + sort: + nullable: true + description: Where this field is shown on the edit page in the Data Studio. + type: integer + width: + nullable: true + description: How wide the interface is rendered on the edit page in the Data Studio. One of `half`, `half-left`, `half-right`, `half-space`, `full`, `fill`. + type: string + translations: + nullable: true + description: How this field's name is displayed in the different languages in the Data Studio. + type: array + note: + nullable: true + description: Short description displayed in the Data Studio. + type: string + # conditions: + # nullable: true + required: + nullable: true + type: boolean + group: + nullable: true + type: integer + oneOf: + - $ref: Fields.yaml + # validation: + # nullable: true + validation_message: + nullable: true + type: string +x-collection: directus_fields diff --git a/api-spec/components/schemas/files.yaml b/api-spec/components/schemas/files.yaml new file mode 100644 index 00000000..164a79e7 --- /dev/null +++ b/api-spec/components/schemas/files.yaml @@ -0,0 +1,114 @@ +type: object +properties: + id: + description: Unique identifier for the file. + example: 8cbb43fe-4cdf-4991-8352-c461779cec02 + type: string + format: uuid + storage: + description: Where the file is stored. Either `local` for the local filesystem or the name of the storage adapter (for example `s3`). + example: local + type: string + filename_disk: + description: Name of the file on disk. By default, Directus uses a random hash for the filename. + example: a88c3b72-ac58-5436-a4ec-b2858531333a.jpg + type: string + filename_download: + description: How you want to the file to be named when it's being downloaded. + example: avatar.jpg + type: string + title: + description: Title for the file. Is extracted from the filename on upload, but can be edited by the user. + example: User Avatar + type: string + type: + description: MIME type of the file. + example: image/jpeg + type: string + folder: + description: Virtual folder where this file resides in. + example: null + type: string + oneOf: + - $ref: Folders.yaml + nullable: true + uploaded_by: + description: Who uploaded the file. + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + oneOf: + - type: string + - $ref: Users.yaml + created_on: + description: When the file was created. + example: 2019-12-03T00:10:15+00:00 + type: string + format: date-time + modified_by: + type: string + format: uuid + oneOf: + - $ref: Users.yaml + nullable: true + modified_on: + nullable: false + type: string + format: date-time + charset: + description: Character set of the file. + example: binary + type: string + nullable: true + filesize: + description: Size of the file in bytes. + example: 137862 + type: integer + width: + description: Width of the file in pixels. Only applies to images. + example: 800 + type: integer + nullable: true + height: + description: Height of the file in pixels. Only applies to images. + example: 838 + type: integer + nullable: true + duration: + description: Duration of the file in seconds. Only applies to audio and video. + example: 0 + type: integer + nullable: true + embed: + description: Where the file was embedded from. + example: null + type: string + nullable: true + description: + description: Description for the file. + type: string + nullable: true + location: + description: Where the file was created. Is automatically populated based on Exif data for images. + type: string + nullable: true + tags: + description: Tags for the file. Is automatically populated based on Exif data for images. + type: array + nullable: true + items: + type: string + metadata: + description: IPTC, Exif, and ICC metadata extracted from file + type: object + nullable: true + focal_point_x: + nullable: true + type: integer + focal_point_y: + nullable: true + type: integer + uploaded_on: + description: When the file was last uploaded/replaced. + example: '2019-12-03T00:10:15+00:00' + type: string + format: date-time +x-collection: directus_files diff --git a/api-spec/components/schemas/flows.yaml b/api-spec/components/schemas/flows.yaml new file mode 100644 index 00000000..58c90f57 --- /dev/null +++ b/api-spec/components/schemas/flows.yaml @@ -0,0 +1,73 @@ +type: object +properties: + id: + description: Unique identifier for the flow. + type: string + format: uuid + example: 2f24211d-d928-469a-aea3-3c8f53d4e426 + name: + description: The name of the flow. + type: string + example: Update Articles Flow + icon: + description: Icon displayed in the Admin App for the flow. + type: string + example: bolt + color: + description: Color of the icon displayed in the Admin App for the flow. + type: string + example: #112233 + format: hexcode + nullable: true + description: + nullable: true + type: string + status: + description: Current status of the flow. + type: string + example: active + default: active + enum: + - active + - inactive + trigger: + description: Type of trigger for the flow. One of `hook`, `webhook`, `operation`, `schedule`, `manual`. + type: string + example: manual + accountability: + description: The permission used during the flow. One of `$public`, `$trigger`, `$full`, or UUID of a role. + type: string + example: $trigger + options: + description: Options of the selected trigger for the flow. + type: object + example: null + nullable: true + operation: + description: UUID of the operation connected to the trigger in the flow. + example: 92e82998-e421-412f-a513-13701e83e4ce + oneOf: + - type: string + - format: uuid + - $ref: Operations.yaml + date_created: + description: Timestamp in ISO8601 when the flow was created. + type: string + example: '2022-05-11T13:14:52Z' + format: date-time + nullable: true + user_created: + description: The user who created the flow. + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + oneOf: + - type: string + - $ref: Users.yaml + operations: + nullable: true + type: array + items: + oneOf: + - type: string + format: uuid + - $ref: Operations.yaml +x-collection: directus_flows diff --git a/api-spec/components/schemas/folders.yaml b/api-spec/components/schemas/folders.yaml new file mode 100644 index 00000000..008cbbf4 --- /dev/null +++ b/api-spec/components/schemas/folders.yaml @@ -0,0 +1,26 @@ +type: object +properties: + id: + description: Unique identifier for the folder. + example: 0cf0e03d-4364-45df-b77b-ca61f61869d2 + type: string + format: uuid + name: + description: Name of the folder. + example: New York + type: string + parent: + description: Unique identifier of the parent folder. This allows for nested folders. + example: | + { + "data": { + "id": "fc02d733-95b8-4e27-bd4b-08a32cbe4e66", + "name": "Test", + "parent": null + } + } + type: string + oneOf: + - $ref: Folders.yaml + nullable: true +x-collection: directus_folders diff --git a/api-spec/components/schemas/items.yaml b/api-spec/components/schemas/items.yaml new file mode 100644 index 00000000..7ae728e2 --- /dev/null +++ b/api-spec/components/schemas/items.yaml @@ -0,0 +1,7 @@ +type: object +properties: + id: + description: Unique identifier for the item. + example: 2 + type: integer +x-collection: directus_items diff --git a/api-spec/components/schemas/notifications.yaml b/api-spec/components/schemas/notifications.yaml new file mode 100644 index 00000000..3ed106cc --- /dev/null +++ b/api-spec/components/schemas/notifications.yaml @@ -0,0 +1,44 @@ +type: object +properties: + id: + description: Primary key of the revision. + example: 2 + type: integer + timestamp: + description: Timestamp in ISO8601 when the notification was created. + example: '2021-11-24T13:57:35Z' + type: string + format: date-time + status: + description: Current status of the notification. One of "inbox", "archived" + example: inbox + type: string + recipient: + description: User that received the notification. + example: 3EE34828-B43C-4FB2-A721-5151579B08EA + oneOf: + - type: string + - $ref: Users.yaml + sender: + description: User that sent the notification, if any. + example: 497a495e-5529-4e46-8feb-2f35e9b85601 + oneOf: + - type: string + - $ref: Users.yaml + subject: + description: Subject line of the message. + example: inbox + type: string + message: + description: Subject line of the message. + example: \nHello admin@example.com,\n\rijk@directus.io has mentioned you in a comment:\n\n> Hello admin@example.com!\n\nClick here to view.\n + type: string + collection: + description: Collection this notification references. + example: articles + type: string + item: + description: Primary key of the item this notification references. + example: '1' + type: string +x-collection: directus_notifications diff --git a/api-spec/components/schemas/operations.yaml b/api-spec/components/schemas/operations.yaml new file mode 100644 index 00000000..e919e877 --- /dev/null +++ b/api-spec/components/schemas/operations.yaml @@ -0,0 +1,63 @@ +type: object +properties: + id: + description: Unique identifier for the operation. + type: string + format: uuid + example: 2f24211d-d928-469a-aea3-3c8f53d4e426 + name: + description: The name of the operation. + type: string + example: Log to Console + key: + description: Key for the operation. Must be unique within a given flow. + type: string + example: log_console + type: + description: Type of operation. One of `log`, `mail`, `notification`, `create`, `read`, `request`, `sleep`, `transform`, `trigger`, `condition`, or any type of custom operation extensions. + type: string + example: log + position_x: + description: Position of the operation on the X axis within the flow workspace. + type: integer + example: 12 + position_y: + description: Position of the operation on the Y axis within the flow workspace. + type: integer + example: 12 + options: + description: Options depending on the type of the operation. + type: object + example: null + nullable: true + resolve: + description: The operation triggered when the current operation succeeds (or `then` logic of a condition operation). + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + oneOf: + - type: string + - $ref: Operations.yaml + reject: + description: The operation triggered when the current operation fails (or `otherwise` logic of a condition operation). + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + oneOf: + - type: string + - $ref: Operations.yaml + flow: + nullable: false + type: string + format: uuid + oneOf: + - $ref: Flows.yaml + date_created: + description: Timestamp in ISO8601 when the operation was created. + type: string + example: '2022-05-11T13:14:52Z' + format: date-time + nullable: true + user_created: + description: The user who created the operation. + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + oneOf: + - type: string + - $ref: Users.yaml +x-collection: directus_operations diff --git a/api-spec/components/schemas/panels.yaml b/api-spec/components/schemas/panels.yaml new file mode 100644 index 00000000..212a292c --- /dev/null +++ b/api-spec/components/schemas/panels.yaml @@ -0,0 +1,70 @@ +type: object +properties: + id: + description: Primary key of the panel. + example: 22640672-eef0-4ee9-ab04-591f3afb288 + type: string + format: uuid + dashboard: + description: Dashboard where this panel is visible. Many-to-one to dashboards. + example: a79bd1b2-beb2-49fc-8a26-0b3eec0e269 + oneOf: + - type: string + - $ref: Dashboards.yaml + name: + description: Name of the panel. + example: 30-day sales + type: string + icon: + description: Material design icon for the panel. + example: paid + type: string + color: + description: Accent color of the panel. + example: #6B8068 + type: string + format: hexcode + show_header: + description: Whether or not the header should be rendered for this panel. + example: true + type: boolean + note: + description: Description for the panel. + example: Overview of the sales numbers in the last 30 day + type: string + type: + description: The panel type used for this panel. + example: time-series + type: string + position_x: + description: The X position on the workspace grid. + example: 1 + type: integer + position_y: + description: The Y position on the workspace grid. + example: 1 + type: integer + width: + description: Width of the panel in number of workspace dots. + example: 1 + type: integer + height: + description: Height of the panel in number of workspace dots. + example: 1 + type: integer + options: + description: Description for the panel. + example: {} + type: object + date_created: + description: When the panel was created + example: 2023-01-05T19:05:51.884Z + type: string + format: date-time + user_created: + description: User that created the panel. Many-to-one to users. + example: fd066644-c8e5-499d-947b-fe6c6e1a1473 + oneOf: + - type: string + - $ref: Users.yaml +x-collection: directus_panels diff --git a/api-spec/components/schemas/permissions.yaml b/api-spec/components/schemas/permissions.yaml new file mode 100644 index 00000000..24af7f29 --- /dev/null +++ b/api-spec/components/schemas/permissions.yaml @@ -0,0 +1,45 @@ +type: object +properties: + id: + description: Unique identifier for the permission. + example: 1 + type: integer + collection: + description: What collection this permission applies to. + example: customers + type: string + action: + description: What action this permission applies to. + example: create + type: string + enum: + - create + - read + - update + - delete + permissions: + description: JSON structure containing the permissions checks for this permission. + type: object + nullable: true + validation: + description: JSON structure containing the validation checks for this permission. + type: object + nullable: true + presets: + description: JSON structure containing the preset value for created/updated items. + type: object + nullable: true + fields: + description: CSV of fields that the user is allowed to interact with. + type: array + items: + type: string + nullable: true + policy: + description: Policy this permission applies to. Many-to-one to policies. + nullable: false + format: uuid + type: string + oneOf: + - $ref: Policies.yaml +x-collection: directus_permissions diff --git a/api-spec/components/schemas/policies.yaml b/api-spec/components/schemas/policies.yaml new file mode 100644 index 00000000..25c32892 --- /dev/null +++ b/api-spec/components/schemas/policies.yaml @@ -0,0 +1,58 @@ +type: object +properties: + id: + description: Primary key of the policy; + example: 22640672-eef0-4ee9-ab04-591f3afb288 + type: string + format: uuid + name: + description: Name of the policy. + example: Admin + type: string + icon: + description: Icon for the policy. Displayed in the Data Studio. + example: supervised_user_circle + type: string + description: + description: Description for the policy. Displayed in the Data Studio. + example: null + type: string + ip_access: + description: A CSV of IP addresses that this policy applies to. Allows you to configure an allowlist of IP addresses. If empty, no IP restrictions are applied. + example: null + type: string + format: csv + enforce_tfa: + description: Whether or not Two-Factor Authentication is required for users that have this policy. + example: false + type: boolean + admin_access: + description: If this policy grants the user admin access. This means that users with this policy have full permissions to everything. + example: true + type: boolean + app_access: + description: Whether or not users with this policy have access to use the Data Studio. + example: true + type: boolean + users: + description: The users this policy is assigned to directly, this does not include users which receive this policy through a role. It expects and returns data from the directus_access collection. Many-to-many to users via access. + example: ["0bc7b36a-9ba9-4ce0-83f0-0a526f354e07"] + oneOf: + - type: array + - format: many-to-many + - $ref: Users.yaml + roles: + description: The roles this policy is assigned to. It expects and returns data from the directus_access collection. Many-to-many to roles via access. + example: ["8b4474c0-288d-4bb8-b62e-8330646bb6aa"] + oneOf: + - type: array + - format: many-to-many + - $ref: Roles.yaml + permissions: + description: The permissions assigned to this policy. One-to-many to permissions. + example: ["5c74c86f-cab0-4b14-a3c4-cd4f2363e826"] + oneOf: + - type: array + - format: one-to-many + - $ref: Permissions.yaml +x-collection: directus_policies diff --git a/api-spec/components/schemas/presets.yaml b/api-spec/components/schemas/presets.yaml new file mode 100644 index 00000000..361bb42c --- /dev/null +++ b/api-spec/components/schemas/presets.yaml @@ -0,0 +1,59 @@ +type: object +properties: + id: + description: Unique identifier for this single collection preset. + example: 155 + type: integer + bookmark: + description: Name for the bookmark. If this is set, the preset will be considered a bookmark. + nullable: true + type: string + user: + description: The unique identifier of the user to whom this collection preset applies. + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + nullable: true + type: string + oneOf: + - $ref: Users.yaml + role: + description: The unique identifier of a role in the platform. If `user` is null, this will be used to apply the collection preset or bookmark for all users in the role. + example: 50419801-0f30-8644-2b3c-9bc2d980d0a0 + nullable: true + type: string + oneOf: + - $ref: Roles.yaml + collection: + description: What collection this collection preset is used for. + example: articles + oneOf: + - type: string + - $ref: Collections.yaml + search: + description: Search query. + type: string + nullable: true + layout: + description: Key of the layout that is used. + type: string + example: null + layout_query: + description: Layout query that's saved per layout type. Controls what data is fetched on load. These follow the same format as the JS SDK parameters. + type: object + example: + cards: + sort: -published_on + nullable: true + layout_options: + description: Options of the views. The properties in here are controlled by the layout. + type: object + example: + cards: + icon: account_circle + title: "{{ first_name }} {{ last_name }}" + subtitle: "{{ title }}" + size: 3 + nullable: true + filters: + type: array + nullable: true +x-collection: directus_presets diff --git a/api-spec/components/schemas/query.yaml b/api-spec/components/schemas/query.yaml new file mode 100644 index 00000000..ac304e0b --- /dev/null +++ b/api-spec/components/schemas/query.yaml @@ -0,0 +1,40 @@ +type: object +properties: + fields: + type: array + items: + type: string + description: Control what fields are being returned in the object. + example: + - "*" + - "*.*" + filter: + type: object + example: + : + : + search: + description: Filter by items that contain the given search query in one of their fields. + type: string + sort: + type: array + items: + type: string + description: How to sort the returned items. + example: + - "-date_created" + limit: + type: number + description: Set the maximum number of items that will be returned + offset: + type: number + description: How many items to skip when fetching data. + page: + type: number + description: Cursor for use in pagination. Often used in combination with limit. + deep: + type: object + description: Deep allows you to set any of the other query parameters on a nested relational dataset. + example: + related_articles: + _limit: 3 \ No newline at end of file diff --git a/api-spec/components/schemas/relations.yaml b/api-spec/components/schemas/relations.yaml new file mode 100644 index 00000000..57a08b74 --- /dev/null +++ b/api-spec/components/schemas/relations.yaml @@ -0,0 +1,43 @@ +type: object +properties: + id: + description: Unique identifier for the relation. + example: 1 + type: integer + many_collection: + description: Collection that has the field that holds the foreign key. + example: directus_activity + type: string + many_field: + description: Foreign key. Field that holds the primary key of the related collection. + example: user + type: string + one_collection: + description: Collection on the _one_ side of the relationship. + example: directus_users + type: string + one_field: + description: Alias column that serves as the _one_ side of the relationship. + example: null + type: string + nullable: true + one_collection_field: + nullable: true + type: string + one_allowed_collections: + nullable: true + type: array + items: + type: string + junction_field: + description: Field on the junction table that holds the many field of the related relation. + example: null + type: string + nullable: true + sort_field: + nullable: true + type: string + one_deselect_action: + nullable: false + type: string +x-collection: directus_relations \ No newline at end of file diff --git a/api-spec/components/schemas/revisions.yaml b/api-spec/components/schemas/revisions.yaml new file mode 100644 index 00000000..87f89158 --- /dev/null +++ b/api-spec/components/schemas/revisions.yaml @@ -0,0 +1,49 @@ +type: object +properties: + id: + description: Unique identifier for the revision. + example: 1 + type: integer + activity: + description: Unique identifier for the activity record. Many-to-one to activity. + example: 2 + type: integer + oneOf: + - $ref: Activity.yaml + collection: + description: Collection of the updated item. + example: articles + type: string + oneOf: + - $ref: Collections.yaml + item: + description: Primary key of updated item. + example: '168' + type: string + data: + description: Copy of item state at time of update. + example: + author: 1 + body: This is my first post + featured_image: 15 + id: '168' + title: Hello, World! + type: object + nullable: true + delta: + description: Changes between the previous and the current revision. + example: + title: Hello, World! + type: object + parent: + description: If the current item was updated relationally, this is the id of the parent revision record. Many-to-one to revisions. + example: null + type: integer + nullable: true + version: + description: Associated version of this revision. Many-to-one to versions. + example: draft + type: string + oneOf: + - $ref: Versions.yaml +x-collection: directus_revisions diff --git a/api-spec/components/schemas/roles.yaml b/api-spec/components/schemas/roles.yaml new file mode 100644 index 00000000..fced4b49 --- /dev/null +++ b/api-spec/components/schemas/roles.yaml @@ -0,0 +1,52 @@ +type: object +properties: + id: + description: Unique identifier for the role. + example: 2f24211d-d928-469a-aea3-3c8f53d4e426 + type: string + format: uuid + name: + description: Name of the role. + example: Administrator + type: string + icon: + description: The role's icon. + example: verified_user + type: string + description: + description: Description of the role. + example: Admins have access to all managed data within the system by default + type: string + nullable: true + parent: + nullable: true + description: Optional parent role that this role inherits permissions from. Many-to-one to roles. + type: string + format: uuid + oneOf: + - $ref: Roles.yaml + children: + nullable: true + description: Nested child roles that inherit this roles permissions. One-to-many to roles. One-to-many to roles. + type: array + format: uuid + items: + oneOf: + - $ref: Roles.yaml + policies: + nullable: true + description: The policies in this role. Many-to-many to roles. + type: array + format: uuid + items: + oneOf: + - $ref: Roles.yaml + users: + nullable: true + description: The users in this role. One-to-many to users. + type: array + format: uuid + items: + oneOf: + - $ref: Users.yaml +x-collection: directus_roles diff --git a/api-spec/components/schemas/schema.yaml b/api-spec/components/schemas/schema.yaml new file mode 100644 index 00000000..ab97da45 --- /dev/null +++ b/api-spec/components/schemas/schema.yaml @@ -0,0 +1,21 @@ +type: object +properties: + version: + type: integer + example: 1 + directus: + type: string + vendor: + type: string + collections: + type: array + items: + $ref: Collections.yaml + fields: + type: array + items: + $ref: Fields.yaml + relations: + type: array + items: + $ref: Relations.yaml diff --git a/api-spec/components/schemas/settings.yaml b/api-spec/components/schemas/settings.yaml new file mode 100644 index 00000000..4923c5b2 --- /dev/null +++ b/api-spec/components/schemas/settings.yaml @@ -0,0 +1,230 @@ +type: object +properties: + id: + description: Unique identifier for the setting. + type: integer + example: 1 + project_name: + description: Name of the project, shown in the Data Studio. + type: string + example: Directus + project_url: + description: The url of the project. Link to the (public) website that goes with this project. + type: string + example: null + nullable: true + project_color: + description: The brand color of the project. + type: string + format: hexcode + example: null + nullable: true + project_logo: + description: The logo of the project. Many-to-one to files. + type: string + example: null + nullable: true + oneOf: + - $ref: Files.yaml + public_foreground: + description: The foreground of the project. Many-to-one to files. + type: string + example: null + nullable: true + oneOf: + - $ref: Files.yaml + public_background: + description: The background of the project. Many-to-one to files. + type: object + example: null + nullable: true + oneOf: + - $ref: Files.yaml + public_note: + description: Note rendered on the public pages of the app. + type: string + example: null + nullable: true + auth_login_attempts: + description: Allowed authentication login attempts before the user's status is set to blocked. + type: integer + example: 25 + auth_password_policy: + description: Authentication password policy. What regex passwords must pass in order to be valid. + type: string + format: regex + nullable: true + storage_asset_transform: + description: If the transform endpoints are allowed to be used on the assets endpoint. One of all, none or presets. + type: string + enum: + - all + - none + - presets + example: all + nullable: true + storage_asset_presets: + description: What preset keys exist in the assets endpoint. + type: array + items: + type: object + properties: + key: + description: Key for the asset. Used in the assets endpoint. + type: string + fit: + description: Whether to crop the thumbnail to match the size, or maintain the aspect ratio. + type: string + enum: + - cover + - contain + - inside + - outside + width: + description: Width of the thumbnail. + type: integer + height: + description: Height of the thumbnail. + type: integer + withoutEnlargement: + description: No image upscale + type: boolean + quality: + description: Quality of the compression used. + type: integer + format: + description: Reformat output image + type: string + enum: + - jpeg + - png + - webp + - tiff + - avif + transforms: + description: Additional transformations to apply + type: array + nullable: true + items: + type: object + properties: + method: + description: The Sharp method name + type: string + arguments: + description: A list of arguments to pass to the Sharp method + type: array + nullable: true + items: + type: object + properties: + argument: + description: A JSON representation of the argument value + type: string + example: null + nullable: true + custom_css: + description: CSS rules to override the App's default styling. + nullable: true + type: string + storage_default_folder: + description: Folder for uploaded files. Does not affect existing files. + type: string + format: uuid + basemaps: + description: Custom tiles to overriding the Mapbox defaults. + type: array + nullable: true + mapbox_key: + description: Mapbox Access Token. + nullable: true + type: string + module_bar: + description: What modules are enabled/added globally. + type: array + nullable: true + project_descriptor: + description: Descriptor of the project, shown in the Data Studio. + nullable: true + type: string + custom_aspect_ratios: + description: Custom aspect ratios in the image editor. + type: array + nullable: true + public_favicon: + nullable: true + description: Favicon for the Data Studio. Many-to-one to files. + type: string + oneOf: + - $ref: Files.yaml + default_appearance: + description: One of auto, light, dark. + nullable: false + type: string + enum: + - auto + - light + - dark + default_theme_light: + description: Default theme to use in light mode. + nullable: true + type: string + theme_light_overrides: + description: Default customization for light theme in use. + type: object + nullable: true + default_theme_dark: + description: Default theme to use in dark mode. + nullable: true + type: string + theme_dark_overrides: + description: Default customization for dark theme in use. + type: object + nullable: true + report_error_url: + description: | + Link to the error report page. This is a template URL that has access to the following object + + ``` + { + error: { + name?: string; + message?: string; + }; + route: { + fullPath: string; + hash: string; + name: string; + path: string; + query: string; + }; + navigator: { + language: string; + userAgent: string; + }; + user: { + id?: string | number; + first_name?: string; + last_name?: string; + title?: string; + description?: string; + location?: string; + status?: string; + }; + role: { + id?: string; + name?: string; + }; + } + ``` + nullable: true + type: string + report_bug_url: + description: Link to the bug report page. + nullable: true + type: string + report_feature_url: + description: Link to the feature request page. + nullable: true + type: string +x-collection: directus_settings diff --git a/api-spec/components/schemas/shares.yaml b/api-spec/components/schemas/shares.yaml new file mode 100644 index 00000000..5880f9de --- /dev/null +++ b/api-spec/components/schemas/shares.yaml @@ -0,0 +1,64 @@ +type: object +properties: + id: + description: Primary key of the share; + example: 3a606c3e-9d4d-4556-b7bb-f00860613da3 + type: string + format: uuid + name: + description: Custom (optional) name for the share. + example: My Share + type: string + collection: + description: Collection in which the current item is shared. Many-to-one to Collections. + example: articles + type: string + oneOf: + - $ref: Collections.yaml + item: + description: Primary key of the item that's shared. + example: '1' + type: string + role: + description: Role of which the share will inherit the permissions. Many-to-one to shares. + example: 2b34fba4-a6cb-49f4-a070-2daee7ac44f0 + type: string + format: uuid + oneOf: + - $ref: Shares.yaml + password: + description: Optional password that's required to view this shared item. + example: '**********' + type: string + format: hash + user_created: + description: Reference to the user who created this share. Many-to-one to Users. + example: b13072b7-73e9-4904-89e0-34aaf4403766 + type: string + format: uuid + oneOf: + - $ref: Users.yaml + date_created: + description: When the share was created. + example: 2023-01-25T19:16:49.009Z + type: string + format: date-time + date_start: + description: Optional timestamp that controls from what date/time the shared item can be viewed. + example: 2023-01-26T17:00:00.000Z + type: string + format: date-time + date_end: + description: Optional timestamp that controls until what date/time the shared item can be viewed. + example: 2023-01-28T17:00:00.000Z + type: string + format: date-time + times_used: + description: The number of times the shared item has been viewed. + example: 0 + type: integer + max_uses: + description: The maximum number of times the shared item can be viewed. + example: 15 + type: integer +x-collection: directus_shares diff --git a/api-spec/components/schemas/translations.yaml b/api-spec/components/schemas/translations.yaml new file mode 100644 index 00000000..a3cec5c9 --- /dev/null +++ b/api-spec/components/schemas/translations.yaml @@ -0,0 +1,20 @@ +type: object +properties: + id: + description: Primary key of the translations. + example: sc4346aa4-81a8-4885-b3a8-f647e4f6f769 + type: string + format: uuid + key: + description: The translation key. + example: Test + type: string + language: + description: The language of the translation. + example: en-US + type: string + string: + description: The translation value. + example: Test + type: string +x-collection: directus_translations diff --git a/api-spec/components/schemas/users.yaml b/api-spec/components/schemas/users.yaml new file mode 100644 index 00000000..b90defc4 --- /dev/null +++ b/api-spec/components/schemas/users.yaml @@ -0,0 +1,140 @@ +type: object +properties: + id: + description: Unique identifier for the user. + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + type: string + first_name: + description: First name of the user. + example: Admin + type: string + last_name: + description: Last name of the user. + example: User + type: string + email: + description: Unique email address for the user. + example: admin@example.com + type: string + format: email + password: + description: Password of the user. + type: string + format: string + location: + description: The user's location. + example: null + type: string + nullable: true + title: + description: The user's title. + example: null + type: string + nullable: true + description: + description: The user's description. + example: null + type: string + nullable: true + tags: + description: The user's tags. + example: null + type: array + nullable: true + items: + type: string + avatar: + description: The user's avatar. Many-to-one to files. + example: null + type: string + oneOf: + - $ref: Files.yaml + nullable: true + language: + description: The user's language used in Directus. Language the Data Studio is rendered in. See our Crowdin page for all available languages and translations. + example: en-US + type: string + tfa_secret: + description: The 2FA secret string that's used to generate one time passwords. + example: null + type: string + nullable: true + status: + description: Status of the user. + example: active + type: string + enum: + - active + - invited + - draft + - suspended + - deleted + role: + description: Unique identifier of the role of this user. Many-to-one to roles. + example: 2f24211d-d928-469a-aea3-3c8f53d4e426 + type: string + oneOf: + - $ref: Roles.yaml + token: + description: Static token for the user. + type: string + nullable: true + policies: + nullable: true + description: The policies associated with this user. Many-to-many to policies. + example: 2f24211d-d928-469a-aea3-3c8f53d4e426 + type: string + oneOf: + - $ref: Policies.yaml + last_access: + description: When this user used the API last. + example: '2020-05-31T14:32:37Z' + type: string + nullable: true + format: date-time + last_page: + description: Last page that the user was on. + example: /my-project/settings/collections/a + type: string + nullable: true + provider: + description: What auth provider was used to register this user. + nullable: false + type: string + external_identifier: + description: Primary key of the user in the third party authentication provider, if used. + nullable: true + type: string + auth_data: + description: Required data about the user as provided by the third party auth provider, if used. + nullable: true + type: object + email_notifications: + description: When this is enabled, the user will receive emails for notifications. + nullable: true + type: boolean + appearance: + description: One of auto, light, dark. + nullable: true + type: string + enum: + - auto + - light + - dark + theme_dark: + description: Theme to use in dark mode. + nullable: true + type: string + theme_light: + description: Theme to use in light mode. + nullable: true + type: string + theme_light_overrides: + description: Customization for light theme in use. + nullable: true + type: object + theme_dark_overrides: + description: Customization for dark theme in use. + nullable: true + type: object +x-collection: directus_users diff --git a/api-spec/components/schemas/versions.yaml b/api-spec/components/schemas/versions.yaml new file mode 100644 index 00000000..d1ec3f70 --- /dev/null +++ b/api-spec/components/schemas/versions.yaml @@ -0,0 +1,57 @@ +type: object +properties: + id: + description: Primary key of the Content Version. + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + type: string + key: + description: Key of the Content Version, used as the value for the "version" query parameter. + example: draft + type: string + name: + description: Descriptive name of the Content Version. + example: My Draft + type: string + collection: + description: Name of the collection the Content Version is created on. + example: articles + type: string + oneOf: + - $ref: Collections.yaml + item: + description: The item the Content Version is created on. Many-to-one to items. + example: '168' + type: string + oneOf: + - $ref: Items.yaml + hash: + nullable: true + type: string + date_created: + description: When the Content Version was created. + type: string + example: '2022-05-11T13:14:52Z' + format: date-time + nullable: true + date_updated: + description: When the Content Version was updated. + type: string + example: '2022-05-11T13:14:53Z' + format: date-time + nullable: true + user_created: + description: User that created the Content Version. Many-to-one to users. + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + type: string + oneOf: + - $ref: Users.yaml + user_updated: + description: User that updated the Content Version. Many-to-one to users. + example: 63716273-0f29-4648-8a2a-2af2948f6f78 + type: string + oneOf: + - $ref: Users.yaml + delta: + description: The current changes compared to the main version of the item. + type: object +x-collection: directus_versions diff --git a/api-spec/components/schemas/x-metadata.yaml b/api-spec/components/schemas/x-metadata.yaml new file mode 100644 index 00000000..f98608d3 --- /dev/null +++ b/api-spec/components/schemas/x-metadata.yaml @@ -0,0 +1,8 @@ +type: object +properties: + total_count: + description: Returns the total item count of the collection you're querying. + type: integer + filter_count: + description: Returns the item count of the collection you're querying, taking the current filter/search parameters into account. + type: integer \ No newline at end of file diff --git a/api-spec/components/security.yaml b/api-spec/components/security.yaml new file mode 100644 index 00000000..a9562bb8 --- /dev/null +++ b/api-spec/components/security.yaml @@ -0,0 +1,8 @@ +KeyAuth: + type: apiKey + in: query + name: access_token +Auth: + type: apiKey + in: header + name: Authorization \ No newline at end of file diff --git a/api-spec/index.yaml b/api-spec/index.yaml index 1d420b24..b059573e 100644 --- a/api-spec/index.yaml +++ b/api-spec/index.yaml @@ -1,6618 +1,295 @@ ---- -openapi: 3.0.1 +openapi: '3.0.1' info: - title: Directus API Specification - description: - This is a dynamically generated API specification for all endpoints - existing on the current project. - version: 10.9.2 + title: Directus API Reference + description: This is a dynamically generated API specification for all endpoints existing on the current project! + version: '11.1.0' + license: + name: Business Source License 1.1 (BUSL-1.1) + url: https://github.com/directus/directus/blob/main/license servers: - - url: https://testing-connor-custom-domains.directus.community/ - description: Your current Directus instance. + - url: https://example.directus.app + description: Your current Directus project. + paths: + "/activity": + $ref: paths/activity/index.yaml + "/activity/{id}": + $ref: paths/activity/_id/index.yaml "/assets/{id}": - get: - tags: - - Assets - operationId: getAsset - summary: Get an Asset - description: - Image typed files can be dynamically resized and transformed to - fit any need. - x-codeSamples: - - label: Directus SDK - lang: Typescript - source: |- - import { createDirectus, rest, readAssetRaw } from '@directus/sdk'; - - const client = createDirectus('directus_project_url').with(rest()); - - const result = await client.request(readAssetRaw('', { key: '' })); - parameters: - - name: id - in: path - description: The id of the file. - required: true - schema: - type: string - - name: key - in: query - description: The key of the asset size configured in settings. - schema: - type: string - - name: transforms - in: query - description: A JSON array of image transformations - schema: - type: string - - name: download - in: query - description: Download the asset to your computer - schema: - type: boolean - responses: - "200": - description: Successful request - content: - text/plain: - schema: - type: string - "404": - "$ref": "#/components/responses/NotFoundError" + $ref: paths/assets/_id/index.yaml "/auth/login": - post: - summary: Retrieve a Temporary Access Token - description: Retrieve a Temporary Access Token - tags: - - Authentication - operationId: login - requestBody: - content: - application/json: - schema: - type: object - required: - - email - - password - properties: - email: - type: string - example: admin@example.com - description: - Email address of the user you're retrieving the access - token for. - password: - type: string - description: Password of the user. - format: password - example: password - mode: - type: string - enum: - - json - - cookie - default: json - description: - Choose between retrieving the token as a string, or - setting it as a cookie. - otp: - type: string - description: If 2FA is enabled, you need to pass the one time password. - responses: - "200": - description: Successful authentification - content: - application/json: - schema: - type: object - properties: - data: - type: object - properties: - access_token: - type: string - example: eyJhbGciOiJI... - expires: - type: integer - example: 900 - refresh_token: - type: string - example: yuOJkjdPXMd... - "/auth/refresh": - post: - summary: Refresh Token - description: Refresh a Temporary Access Token. - tags: - - Authentication - operationId: refresh - requestBody: - content: - application/json: - schema: - type: object - required: - - token - properties: - refresh_token: - type: string - example: eyJ0eXAiOiJKV... - description: - JWT access token you want to refresh. This token can't - be expired. - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: object - properties: - access_token: - type: string - example: eyJhbGciOiJI... - expires: - type: integer - example: 900 - refresh_token: - type: string - example: Gy-caJMpmGTA... - "401": - "$ref": "#/components/responses/UnauthorizedError" + $ref: paths/auth/login/index.yaml "/auth/logout": - post: - summary: Log Out - description: Log Out - tags: - - Authentication - operationId: logout - requestBody: - content: - application/json: - schema: - type: object - required: - - token - properties: - refresh_token: - type: string - example: eyJ0eXAiOiJKV... - description: JWT access token you want to logout. - responses: - "200": - description: Request successful - "/auth/password/request": - post: - tags: - - Authentication - operationId: passwordRequest - summary: Request a Password Reset - description: Request a reset password email to be send. - requestBody: - content: - application/json: - schema: - type: object - required: - - email - properties: - email: - type: string - example: admin@example.com - description: - Email address of the user you're requesting a reset - for. - responses: - "401": - "$ref": "#/components/responses/UnauthorizedError" - "/auth/password/reset": - post: - tags: - - Authentication - operationId: passwordReset - summary: Reset a Password - description: - The request a password reset endpoint sends an email with a link - to the admin app which in turn uses this endpoint to allow the user to reset - their password. - requestBody: - content: - application/json: - schema: - type: object - required: - - token - - password - properties: - token: - type: string - example: eyJ0eXAiOiJKV1Qi... - description: One-time use JWT token that is used to verify the user. - password: - type: string - example: password - format: password - description: New password for the user. - responses: - "401": - "$ref": "#/components/responses/UnauthorizedError" + $ref: paths/auth/logout/index.yaml "/auth/oauth": - get: - tags: - - Authentication - operationId: oauth - summary: List OAuth Providers - description: List configured OAuth providers. - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - public: - type: boolean - data: - type: array - example: - - github - - facebook - items: - type: string - "401": - "$ref": "#/components/responses/UnauthorizedError" + $ref: paths/auth/oauth/index.yaml "/auth/oauth/{provider}": - get: - summary: Authenticated using an OAuth provider - description: Start OAuth flow using the specified provider - tags: - - Authentication - operationId: oauthProvider - parameters: - - name: provider - in: path - description: Key of the activated OAuth provider. - required: true - schema: - type: string - - name: redirect - in: query - required: false - description: - Where to redirect on successful login.
If set the authentication - details are set inside cookies otherwise a JSON is returned. - schema: - type: string - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - public: - type: boolean - data: - type: object - properties: - token: - type: string - "401": - "$ref": "#/components/responses/UnauthorizedError" - "/schema/snapshot": - get: - summary: Retrieve Schema Snapshot - description: - Retrieve the current schema. This endpoint is only available to - admin users. - operationId: schemaSnapshot - parameters: - - "$ref": "#/components/parameters/Export" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Schema" - text/yaml: - schema: - type: string - format: binary - "403": - "$ref": "#/components/responses/UnauthorizedError" - tags: - - Schema - "/schema/apply": - post: - summary: Apply Schema Difference - description: - Update the instance's schema by passing the diff previously retrieved - via `/schema/diff` endpoint in the JSON request body or a JSON/YAML file. - This endpoint is only available to admin users. - operationId: schemaApply - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Diff" - multipart/form-data: - schema: - type: object - properties: - file: - type: string - format: binary - responses: - "204": - description: Successful request - "403": - "$ref": "#/components/responses/UnauthorizedError" - tags: - - Schema - "/schema/diff": - post: - summary: Retrieve Schema Difference - description: - Compare the current instance's schema against the schema snapshot - in JSON request body or a JSON/YAML file and retrieve the difference. This - endpoint is only available to admin users. - operationId: schemaDiff - parameters: - - name: force - description: Bypass version and database vendor restrictions. - in: query - required: false - schema: - type: boolean - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Schema" - multipart/form-data: - schema: - type: object - properties: - file: - type: string - format: binary - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Diff" - "204": - description: No schema difference. - "403": - "$ref": "#/components/responses/UnauthorizedError" - tags: - - Schema - "/server/info": - get: - summary: System Info - description: Perform a system status check and return the options. - operationId: serverInfo - parameters: - - description: - The first time you create a project, the provided token will - be saved and required for subsequent project installs. It can also be found - and configured in `/config/__api.json` on your server. - in: query - name: super_admin_token - required: true - schema: - type: integer - responses: - "200": - content: - application/json: - schema: - properties: - data: - type: object - type: object - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Server - "/server/ping": - get: - summary: Ping - description: Ping, pong. Ping.. pong. - operationId: ping - responses: - "200": - content: - application/text: - schema: - type: string - pattern: pong - example: pong - description: Successful request - tags: - - Server - "/utils/hash/generate": - post: - summary: Hash a string - description: Generate a hash for a given string. - operationId: hash-generate - requestBody: - content: - application/json: - schema: - properties: - string: - description: String to hash. - type: string - required: - - string - responses: - "200": - content: - application/json: - schema: - properties: - data: - type: string - example: "$argon2i$v=19$m=4096,t=3,p=1$pOyIa/zmRAjCVLb2f7kOyg$DasoO6LzMM+6iKfzCDq6JbsYsZWLSm33p7i9NxL9mDc" - type: object - description: Successful request - tags: - - Utilities - "/utils/hash/verify": - post: - summary: Hash a string - description: Generate a hash for a given string. - operationId: hash-verify - requestBody: - content: - application/json: - schema: - properties: - string: - description: String to hash. - type: string - hash: - description: Hash you want to verify against. - type: string - required: - - string - - hash - responses: - "200": - content: - application/json: - schema: - properties: - data: - type: boolean - example: true - type: object - description: Successful request - tags: - - Utilities - "/utils/sort/{collection}": - post: - summary: Sort Items - description: Re-sort items in collection based on start and to value of item - operationId: sort - parameters: - - description: Collection identifier - in: path - name: collection - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - item: - description: Primary key of item to move - type: number - to: - description: - Primary key of item where to move the current item - to - type: number - responses: - "200": - description: Successful request - tags: - - Utilities - "/utils/import/{collection}": - post: - summary: Import Items - description: Import multiple records from a JSON or CSV file into a collection. - operationId: import - parameters: - - description: Collection identifier - in: path - name: collection - required: true - schema: - type: string - requestBody: - content: - multipart/form-data: - schema: - type: object - properties: - file: - type: string - format: binary - responses: - "200": - description: Successful request - tags: - - Utilities - "/utils/export/{collection}": - post: - summary: Export Items - description: Export a larger data set to a file in the File Library - operationId: export - parameters: - - description: Collection identifier - in: path - name: collection - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - properties: - format: - description: - What file format to save the export to. One of csv, - xml, json - type: string - enum: - - csv - - xml - - json - query: - "$ref": "#/components/schemas/Query" - file: - "$ref": "#/components/schemas/Files" - required: - - format - - query - - file - responses: - "200": - description: Successful request - tags: - - Utilities - "/utils/cache/clear": - post: - summary: Clear Cache - description: Resets both the data and schema cache of Directus. - operationId: clear-cache - responses: - "200": - description: Successful request - tags: - - Utilities - "/utils/random/string": - get: - summary: Get a Random String - description: Returns a random string of given length. - operationId: random - parameters: - - description: Length of the random string. - in: query - name: length - required: false - schema: - type: integer - responses: - "200": - content: - application/json: - schema: - properties: - data: - type: string - example: 1>M3+4oh.S - type: object - description: Successful request - tags: - - Utilities - "/folders": - get: - summary: List Folders - description: List the folders. - operationId: getFolders - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Folders" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Folders - post: - summary: Create a Folder - description: Create a new folder. - operationId: createFolder - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - example: Amsterdam - description: Name of the folder. - parent: - description: - Unique identifier of the parent folder. This allows - for nested folders. - type: integer - required: - - name - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Folders" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Folders - patch: - summary: Update Multiple Folders - description: Update multiple folders at the same time. - tags: - - Folders - operationId: updateFolders - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - type: object - properties: - name: - type: string - example: Amsterdam - description: Name of the folder. - parent: - description: - Unique identifier of the parent folder. This allows - for nested folders. - type: integer - required: - - name - keys: - type: array - items: - type: string - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Folders" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - delete: - summary: Delete Multiple Folders - description: Delete multiple existing folders. - tags: - - Folders - operationId: deleteFolders - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "/folders/{id}": - get: - summary: Retrieve a Folder - description: Retrieve a single folder by unique identifier. - operationId: getFolder - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Folders" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Folders - patch: - summary: Update a Folder - description: Update an existing folder - operationId: updateFolder - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - type: object - properties: - name: - type: string - description: Name of the folder. Can't be null or empty. - parent: - type: integer - example: 3 - description: - Unique identifier of the parent folder. This allows - for nested folders. - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Folders" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Folders - delete: - summary: Delete a Folder - description: Delete an existing folder - operationId: deleteFolder - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Folders - parameters: - - "$ref": "#/components/parameters/UUId" - "/roles": - get: - summary: List Roles - description: List the roles. - operationId: getRoles - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - - "$ref": "#/components/parameters/Page" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Roles" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Roles - post: - summary: Create a Role - description: Create a new role. - operationId: createRole - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - properties: - description: - description: Description of the role. - type: string - enforce_tfa: - description: Whether or not this role enforces the use of 2FA. - type: boolean - external_id: - description: ID used with external services in SCIM. - type: string - ip_access: - description: - Array of IP addresses that are allowed to connect to - the API as a user of this role. - type: array - items: - type: string - module_listing: - description: Custom override for the admin app module bar navigation. - type: string - name: - description: Name of the role. - type: string - example: Interns - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Roles" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Roles - patch: - summary: Update Multiple Roles - description: Update multiple roles at the same time. - tags: - - Roles - operationId: updateRoles - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - requestBody: - content: - application/json: - schema: - properties: - keys: - type: array - items: - type: string - data: - type: object - properties: - description: - description: Description of the role. - type: string - enforce_tfa: - description: Whether or not this role enforces the use of 2FA. - type: boolean - external_id: - description: ID used with external services in SCIM. - type: string - ip_access: - description: - Array of IP addresses that are allowed to connect - to the API as a user of this role. - type: array - items: - type: string - module_listing: - description: Custom override for the admin app module bar navigation. - type: string - name: - description: Name of the role. - type: string - example: Interns - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Roles" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - delete: - summary: Delete Multiple Roles - description: Delete multiple existing roles. - tags: - - Roles - operationId: deleteRoles - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "/roles/{id}": - get: - summary: Retrieve a Role - description: Retrieve a single role by unique identifier. - operationId: getRole - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Roles" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Roles - patch: - summary: Update a Role - description: Update an existing role - operationId: updateRole - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - properties: - description: - description: Description of the role. - type: string - enforce_tfa: - description: Whether or not this role enforces the use of 2FA. - type: boolean - external_id: - description: ID used with external services in SCIM. - type: string - ip_access: - description: - Array of IP addresses that are allowed to connect to - the API as a user of this role. - type: array - items: - type: string - module_listing: - description: Custom override for the admin app module bar navigation. - type: string - name: - description: Name of the role. - type: string - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Roles" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Roles - delete: - summary: Delete a Role - description: Delete an existing role - operationId: deleteRole - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Roles - parameters: - - "$ref": "#/components/parameters/UUId" - "/activity": - get: - operationId: getActivities - summary: List Activity Actions - description: Returns a list of activity actions. - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - responses: - "200": - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Activity" - meta: - "$ref": "#/components/schemas/x-metadata" - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Activity - "/activity/comment": - post: - summary: Create a Comment - description: Creates a new comment. - operationId: createComment - parameters: - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - type: object - required: - - collection - - item - - comment - properties: - collection: - type: string - example: projects - item: - type: integer - example: 1 - comment: - type: string - example: A new comment - responses: - "200": - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Activity" - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Activity - "/activity/{id}": - get: - summary: Retrieve an Activity Action - description: - Retrieves the details of an existing activity action. Provide the - primary key of the activity action and Directus will return the corresponding - information. - operationId: getActivity - parameters: - - "$ref": "#/components/parameters/Id" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Activity" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Activity - "/activity/comment/{id}": - patch: - summary: Update a Comment - description: Update the content of an existing comment. - operationId: updateComment - parameters: - - "$ref": "#/components/parameters/Id" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - type: object - properties: - comment: - type: string - example: My updated comment - responses: - "200": - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Activity" - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Activity - delete: - summary: Delete a Comment - description: Delete an existing comment. Deleted comments can not be retrieved. - operationId: deleteComment - parameters: - - "$ref": "#/components/parameters/Id" - responses: - "203": - description: Deleted successfully - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Activity + $ref: paths/auth/oauth/_provider/index.yaml + "/auth/password/request": + $ref: paths/auth/password/request/index.yaml + "/auth/password/reset": + $ref: paths/auth/password/reset/index.yaml + "/auth/refresh": + $ref: paths/auth/refresh/index.yaml "/collections": - get: - summary: List Collections - description: Returns a list of the collections available in the project. - operationId: getCollections - parameters: - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Collections" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Collections - post: - summary: Create a Collection - description: Create a new collection in Directus. - operationId: createCollection - parameters: - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - type: object - required: - - collection - - fields - properties: - collection: - type: string - description: Unique name of the collection. - example: my_collection - fields: - type: array - description: - The fields contained in this collection. See the fields - reference for more information. Each individual field requires - field, type, and interface to be provided. - items: - type: object - icon: - description: - Name of a Google Material Design Icon that's assigned - to this collection. - type: string - example: people - nullable: true - note: - description: A note describing the collection. - type: string - example: - nullable: true - display_template: - description: - Text representation of how items from this collection - are shown across the system. - type: string - example: - nullable: true - hidden: - description: - Whether or not the collection is hidden from the navigation - in the admin app. - type: boolean - example: false - singleton: - description: - Whether or not the collection is treated as a single - object. - type: boolean - example: false - translation: - description: - Key value pairs of how to show this collection's name - in different languages in the admin app. - type: string - example: - nullable: true - versioning: - description: - Whether or not Content Versioning is enabled for this - collection. - type: boolean - example: false - archive_field: - description: What field holds the archive value. - type: string - example: - nullable: true - archive_app_filter: - description: What value to use for "archived" items. - type: string - example: - nullable: true - archive_value: - description: What value to use to "unarchive" items. - type: string - example: - nullable: true - unarchive_value: - description: Whether or not to show the "archived" filter. - type: string - example: - nullable: true - sort_field: - description: The sort field in the collection. - type: string - example: - nullable: true - responses: - "200": - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Collections" - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Collections + $ref: paths/collections/index.yaml "/collections/{id}": - get: - summary: Retrieve a Collection - description: Retrieves the details of a single collection. - operationId: getCollection - parameters: - - name: id - in: path - required: true - description: Unique identifier of the collection. - schema: - type: string - - "$ref": "#/components/parameters/Meta" - responses: - "200": - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Collections" - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Collections - patch: - summary: Update a Collection - description: Update an existing collection. - operationId: updateCollection - parameters: - - name: id - in: path - required: true - description: Unique identifier of the collection. - schema: - type: string - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - type: object - properties: - meta: - description: Metadata of the collection. - type: object - properties: - icon: - description: - Name of a Google Material Design Icon that's assigned - to this collection. - type: string - example: people - nullable: true - color: - description: - Choose the color for the icon assigned to this - collection. - type: string - example: "#6644ff" - nullable: true - note: - description: A note describing the collection. - type: string - example: - nullable: true - display_template: - description: - Text representation of how items from this collection - are shown across the system. - type: string - example: - nullable: true - hidden: - description: - Whether or not the collection is hidden from the - navigation in the admin app. - type: boolean - example: false - singleton: - description: - Whether or not the collection is treated as a single - object. - type: boolean - example: false - translation: - description: - Key value pairs of how to show this collection's - name in different languages in the admin app. - type: string - example: - nullable: true - versioning: - description: - Whether or not Content Versioning is enabled for - this collection. - type: boolean - example: false - archive_field: - description: What field holds the archive value. - type: string - example: - nullable: true - archive_app_filter: - description: What value to use for "archived" items. - type: string - example: - nullable: true - archive_value: - description: What value to use to "unarchive" items. - type: string - example: - nullable: true - unarchive_value: - description: Whether or not to show the "archived" filter. - type: string - example: - nullable: true - sort_field: - description: The sort field in the collection. - type: string - example: - nullable: true - responses: - "200": - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Collections" - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Collections - delete: - summary: Delete a Collection - description: - "Delete an existing collection. Warning: This will delete the whole - collection, including the items within. Proceed with caution." - operationId: deleteCollection - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Collections - parameters: - - name: id - in: path - required: true - description: Unique identifier of the collection. - schema: - type: string + $ref: paths/collections/_id/index.yaml + "/comments": + $ref: paths/comments/index.yaml + "/comments/{id}": + $ref: paths/comments/_id/index.yaml + "/dashboards": + $ref: paths/dashboards/index.yaml + "/dashboards/{id}": + $ref: paths/dashboards/_id/index.yaml + "/extensions": + $ref: paths/extensions/index.yaml + "/extensions/{bundle}/{name}": + $ref: paths/extensions/_bundle/_name/index.yaml + "/extensions/{name}": + $ref: paths/extensions/_name/index.yaml "/fields": - get: - summary: List All Fields - description: Returns a list of the fields available in the project. - operationId: getFields - parameters: - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Sort" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Fields" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Fields + $ref: paths/fields/index.yaml "/fields/{collection}": - get: - summary: List Fields in Collection - description: Returns a list of the fields available in the given collection. - operationId: getCollectionFields - parameters: - - description: Unique identifier of the collection the item resides in. - in: path - name: collection - required: true - schema: - type: string - - "$ref": "#/components/parameters/Sort" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Fields" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Fields - post: - summary: Create Field in Collection - description: Create a new field in a given collection. - operationId: createField - requestBody: - content: - application/json: - schema: - required: - - field - - datatype - - type - - length - type: object - properties: - field: - description: - Unique name of the field. Field name is unique within - the collection. - example: id - type: string - type: - description: - Directus specific data type. Used to cast values in - the API. - example: integer - type: string - schema: - description: The schema info. - type: object - properties: - name: - description: The name of the field. - example: title - type: string - table: - description: The collection of the field. - example: posts - type: string - type: - description: The type of the field. - example: string - type: string - default_value: - description: The default value of the field. - example: - type: string - nullable: true - max_length: - description: The max length of the field. - example: - type: integer - nullable: true - is_nullable: - description: If the field is nullable. - example: false - type: boolean - is_primary_key: - description: If the field is primary key. - example: false - type: boolean - has_auto_increment: - description: If the field has auto increment. - example: false - type: boolean - foreign_key_column: - description: Related column from the foreign key constraint. - example: - type: string - nullable: true - foreign_key_table: - description: Related table from the foreign key constraint. - example: - type: string - nullable: true - comment: - description: Comment as saved in the database. - example: - type: string - nullable: true - schema: - description: Database schema (pg only). - example: public - type: string - foreign_key_schema: - description: - Related schema from the foreign key constraint - (pg only). - example: - type: string - nullable: true - meta: - description: The meta info. - type: object - nullable: true - properties: - id: - description: - Unique identifier for the field in the `directus_fields` - collection. - example: 3 - type: integer - collection: - description: Unique name of the collection this field is in. - example: posts - type: string - field: - description: - Unique name of the field. Field name is unique - within the collection. - example: title - type: string - special: - description: Transformation flag for field - example: - type: array - items: - type: string - nullable: true - system-interface: - description: - What interface is used in the admin app to edit - the value for this field. - example: primary-key - type: string - nullable: true - options: - description: - Options for the interface that's used. This format - is based on the individual interface. - example: - type: object - nullable: true - display: - description: - What display is used in the admin app to display - the value for this field. - example: - type: string - nullable: true - display_options: - description: - Options for the display that's used. This format - is based on the individual display. - example: - type: object - nullable: true - locked: - description: - If the field can be altered by the end user. Directus - system fields have this value set to `true`. - example: true - type: boolean - readonly: - description: - Prevents the user from editing the value in the - field. - example: false - type: boolean - hidden: - description: If this field should be hidden. - example: true - type: boolean - sort: - description: - Sort order of this field on the edit page of the - admin app. - example: 1 - type: integer - nullable: true - width: - description: Width of the field on the edit form. - example: - type: string - nullable: true - enum: - - half - - half-left - - half-right - - full - - fill - - - group: - description: What field group this field is part of. - example: - type: integer - nullable: true - translation: - description: - "Key value pair of `: ` - that allows the user to change the displayed name of the field - in the admin app." - example: - type: object - nullable: true - note: - description: - A user provided note for the field. Will be rendered - alongside the interface on the edit page. - example: "" - type: string - nullable: true - responses: - "200": - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Fields" - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Fields - parameters: - - description: Unique identifier of the collection the item resides in. - in: path - name: collection - required: true - schema: - type: string + $ref: paths/fields/_collection/index.yaml "/fields/{collection}/{id}": - get: - summary: Retrieve a Field - description: Retrieves the details of a single field in a given collection. - operationId: getCollectionField - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Fields" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Fields - parameters: - - name: collection - in: path - description: Unique identifier of the collection the item resides in. - schema: - type: string - required: true - - name: id - in: path - description: Unique identifier of the field. - schema: - type: string - required: true - patch: - summary: Update a Field - description: Update an existing field. - operationId: updateField - requestBody: - content: - application/json: - schema: - type: object - properties: - field: - description: - Unique name of the field. Field name is unique within - the collection. - example: id - type: string - type: - description: - Directus specific data type. Used to cast values in - the API. - example: integer - type: string - schema: - description: The schema info. - type: object - properties: - name: - description: The name of the field. - example: title - type: string - table: - description: The collection of the field. - example: posts - type: string - type: - description: The type of the field. - example: string - type: string - default_value: - description: The default value of the field. - example: - type: string - nullable: true - max_length: - description: The max length of the field. - example: - type: integer - nullable: true - is_nullable: - description: If the field is nullable. - example: false - type: boolean - is_primary_key: - description: If the field is primary key. - example: false - type: boolean - has_auto_increment: - description: If the field has auto increment. - example: false - type: boolean - foreign_key_column: - description: Related column from the foreign key constraint. - example: - type: string - nullable: true - foreign_key_table: - description: Related table from the foreign key constraint. - example: - type: string - nullable: true - comment: - description: Comment as saved in the database. - example: - type: string - nullable: true - schema: - description: Database schema (pg only). - example: public - type: string - foreign_key_schema: - description: - Related schema from the foreign key constraint - (pg only). - example: - type: string - nullable: true - meta: - description: The meta info. - type: object - nullable: true - properties: - id: - description: - Unique identifier for the field in the `directus_fields` - collection. - example: 3 - type: integer - collection: - description: Unique name of the collection this field is in. - example: posts - type: string - field: - description: - Unique name of the field. Field name is unique - within the collection. - example: title - type: string - special: - description: Transformation flag for field - example: - type: array - items: - type: string - nullable: true - system-interface: - description: - What interface is used in the admin app to edit - the value for this field. - example: primary-key - type: string - nullable: true - options: - description: - Options for the interface that's used. This format - is based on the individual interface. - example: - type: object - nullable: true - display: - description: - What display is used in the admin app to display - the value for this field. - example: - type: string - nullable: true - display_options: - description: - Options for the display that's used. This format - is based on the individual display. - example: - type: object - nullable: true - locked: - description: - If the field can be altered by the end user. Directus - system fields have this value set to `true`. - example: true - type: boolean - readonly: - description: - Prevents the user from editing the value in the - field. - example: false - type: boolean - hidden: - description: If this field should be hidden. - example: true - type: boolean - sort: - description: - Sort order of this field on the edit page of the - admin app. - example: 1 - type: integer - nullable: true - width: - description: Width of the field on the edit form. - example: - type: string - nullable: true - enum: - - half - - half-left - - half-right - - full - - fill - - - group: - description: What field group this field is part of. - example: - type: integer - nullable: true - translation: - description: - "Key value pair of `: ` - that allows the user to change the displayed name of the field - in the admin app." - example: - type: object - nullable: true - note: - description: - A user provided note for the field. Will be rendered - alongside the interface on the edit page. - example: "" - type: string - nullable: true - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Fields" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Fields - parameters: - - name: collection - in: path - description: Unique identifier of the collection the item resides in. - schema: - type: string - required: true - - name: id - in: path - description: Unique identifier of the field. - schema: - type: string - required: true - delete: - summary: Delete a Field - description: Delete an existing field. - operationId: deleteField - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Fields - parameters: - - name: collection - in: path - description: Unique identifier of the collection the item resides in. - schema: - type: string - required: true - - name: id - in: path - description: Unique identifier of the field. - schema: - type: string - required: true + $ref: paths/fields/_collection/_id/index.yaml "/files": - get: - summary: List Files - description: List the files. - tags: - - Files - operationId: getFiles - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Files" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - post: - summary: Create a File - description: Create a new file - tags: - - Files - operationId: createFile - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - type: string - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Files" - "401": - "$ref": "#/components/responses/UnauthorizedError" - patch: - summary: Update Multiple Files - description: Update multiple files at the same time. - tags: - - Files - operationId: updateFiles - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - type: object - properties: - data: - type: string - keys: - type: array - items: - type: string - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Files" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - delete: - summary: Delete Multiple Files - description: Delete multiple existing files. - tags: - - Files - operationId: deleteFiles - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" + $ref: paths/files/index.yaml "/files/{id}": - get: - summary: Retrieve a Files - description: Retrieve a single file by unique identifier. - tags: - - Files - operationId: getFile - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Files" - "401": - "$ref": "#/components/responses/UnauthorizedError" - patch: - summary: Update a File - description: Update an existing file, and/or replace it's file contents. - tags: - - Files - operationId: updateFile - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - multipart/data: - schema: - type: object - required: - - file - properties: - title: - description: - Title for the file. Is extracted from the filename - on upload, but can be edited by the user. - example: User Avatar - type: string - filename_download: - description: Preferred filename when file is downloaded. - type: string - description: - description: Description for the file. - type: string - nullable: true - folder: - description: Virtual folder where this file resides in. - example: - oneOf: - - type: string - - "$ref": "#/components/schemas/Folders" - nullable: true - tags: - description: - Tags for the file. Is automatically populated based - on Exif data for images. - type: array - nullable: true - items: - type: string - file: - description: File contents. - format: binary - application/json: - schema: - type: object - properties: - title: - description: - Title for the file. Is extracted from the filename - on upload, but can be edited by the user. - example: User Avatar - type: string - filename_download: - description: Preferred filename when file is downloaded. - type: string - description: - description: Description for the file. - type: string - nullable: true - folder: - description: Virtual folder where this file resides in. - example: - oneOf: - - type: string - - "$ref": "#/components/schemas/Folders" - nullable: true - tags: - description: - Tags for the file. Is automatically populated based - on Exif data for images. - type: array - nullable: true - items: - type: string - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Files" - "401": - "$ref": "#/components/responses/UnauthorizedError" - delete: - summary: Delete a File - description: Delete an existing file. - tags: - - Files - operationId: deleteFile - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - parameters: - - "$ref": "#/components/parameters/UUId" - "/users": - get: - summary: List Users - description: List the users. - operationId: getUsers - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Users" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Users - post: - summary: Create a User - description: Create a new user. - operationId: createUser - parameters: - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - "$ref": "#/components/schemas/Users" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Users" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Users - patch: - summary: Update Multiple Users - description: Update multiple users at the same time. - tags: - - Users - operationId: updateUsers - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Users" - keys: - type: array - items: - type: string - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Users" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - delete: - summary: Delete Multiple Users - description: Delete multiple existing users. - tags: - - Users - operationId: deleteUsers - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "/users/{id}": - get: - summary: Retrieve a User - description: Retrieve a single user by unique identifier. - operationId: getUser - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Users" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Users - patch: - summary: Update a User - description: Update an existing user - operationId: updateUser - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - "$ref": "#/components/schemas/Users" - responses: - "200": - content: - application/json: - schema: - properties: - data: - type: object - type: object - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Users - delete: - summary: Delete a User - description: Delete an existing user - operationId: deleteUser - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Users - parameters: - - "$ref": "#/components/parameters/UUId" - "/users/invite": - post: - summary: Invite User(s) - description: - Invites one or more users to this project. It creates a user with - an invited status, and then sends an email to the user with instructions on - how to activate their account. - operationId: invite - requestBody: - content: - application/json: - schema: - type: object - properties: - email: - description: - Email address or array of email addresses of the to-be-invited - user(s). - type: string - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Users" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Users - "/users/invite/accept": - post: - summary: Accept User Invite - description: Accepts and enables an invited user using a JWT invitation token. - operationId: acceptInvite - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - token: - type: string - example: eyJh...KmUk - description: Accept invite token. - password: - type: string - description: Password of the user. - format: password - example: d1r3ctu5 - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Users" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Users - "/users/me": - get: - summary: Retrieve Current User - description: Retrieve the currently authenticated user. - operationId: getMe - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Users" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Users - patch: - summary: Update Current User - description: Update the currently authenticated user. - operationId: updateMe - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Users" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Users - "/users/me/track/page": - patch: - summary: Update Last Page - description: - Updates the last used page field of the currently authenticated - user. This is used internally to be able to open the Directus admin app from - the last page you used. - operationId: updateLastUsedPageMe - requestBody: - content: - application/json: - schema: - properties: - last_page: - description: Path of the page you used last. - type: string - type: object - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Users - "/users/me/tfa/enable": - post: - summary: Enable 2FA - description: - Enables two-factor authentication for the currently authenticated - user. - operationId: meTfaEnable - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Users - "/users/me/tfa/disable": - post: - summary: Disable 2FA - description: - Disables two-factor authentication for the currently authenticated - user. - operationId: meTfaDisable - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Users + $ref: paths/files/_id/index.yaml + "/flows": + $ref: paths/flows/index.yaml + "/flows/{id}": + $ref: paths/flows/_id/index.yaml + "/flows/trigger/{id}": + $ref: paths/flows/trigger/_id/index.yaml + "/folders": + $ref: paths/folders/index.yaml + "/folders/{id}": + $ref: paths/folders/_id/index.yaml + "/items/{collection}": + $ref: paths/items/_collection/index.yaml + "/items/{collection}/singleton": + $ref: paths/items/_collection/singleton/index.yaml + "/items/{collection}/{id}": + $ref: paths/items/_collection/_id/index.yaml + "/notifications": + $ref: paths/notifications/index.yaml + "/notifications/{id}": + $ref: paths/notifications/_id/index.yaml + "/operations": + $ref: paths/operations/index.yaml + "/operations/{id}": + $ref: paths/operations/_id/index.yaml + "/panels": + $ref: paths/panels/index.yaml + "/panels/{id}": + $ref: paths/panels/_id/index.yaml "/permissions": - get: - summary: List Permissions - description: List all permissions. - operationId: getPermissions - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - - "$ref": "#/components/parameters/Page" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Permissions" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Permissions - post: - summary: Create a Permission - description: Create a new permission. - operationId: createPermission - parameters: - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - properties: - collection: - description: What collection this permission applies to. - type: string - example: customers - comment: - description: If the user can post comments. - type: string - enum: - - none - - create - - update - - full - create: - description: If the user can create items. - type: string - enum: - - none - - full - delete: - description: If the user can update items. - type: string - enum: - - none - - mine - - role - - full - explain: - description: - If the user is required to leave a comment explaining - what was changed. - type: string - enum: - - none - - create - - update - - always - read: - description: If the user can read items. - type: string - enum: - - none - - mine - - role - - full - role: - description: - Unique identifier of the role this permission applies - to. - type: integer - example: 3 - read_field_blacklist: - description: Explicitly denies read access for specific fields. - type: array - items: - type: string - example: - - featured_image - status: - description: What status this permission applies to. - type: string - status_blacklist: - description: Explicitly denies specific statuses to be used. - type: array - items: - type: string - update: - description: If the user can update items. - type: string - enum: - - none - - mine - - role - - full - write_field_blacklist: - description: Explicitly denies write access for specific fields. - type: array - items: - type: string - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Permissions" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Permissions - patch: - summary: Update Multiple Permissions - description: Update multiple permissions at the same time. - tags: - - Permissions - operationId: updatePermissions - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - requestBody: - content: - application/json: - schema: - type: object - properties: - keys: - type: array - items: - type: string - data: - properties: - collection: - description: What collection this permission applies to. - type: string - example: customers - comment: - description: If the user can post comments. - type: string - enum: - - none - - create - - update - - full - create: - description: If the user can create items. - type: string - enum: - - none - - full - delete: - description: If the user can update items. - type: string - enum: - - none - - mine - - role - - full - explain: - description: - If the user is required to leave a comment explaining - what was changed. - type: string - enum: - - none - - create - - update - - always - read: - description: If the user can read items. - type: string - enum: - - none - - mine - - role - - full - role: - description: - Unique identifier of the role this permission applies - to. - type: integer - example: 3 - read_field_blacklist: - description: Explicitly denies read access for specific fields. - type: array - items: - type: string - example: - - featured_image - status: - description: What status this permission applies to. - type: string - status_blacklist: - description: Explicitly denies specific statuses to be used. - type: array - items: - type: string - update: - description: If the user can update items. - type: string - enum: - - none - - mine - - role - - full - write_field_blacklist: - description: Explicitly denies write access for specific fields. - type: array - items: - type: string - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Permissions" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - delete: - summary: Delete Multiple Permissions - description: Delete multiple existing permissions. - tags: - - Permissions - operationId: deletePermissions - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "/permissions/me": - get: - summary: List My Permissions - description: List the permissions that apply to the current user. - operationId: getMyPermissions - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Permissions" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Permissions + $ref: paths/permissions/index.yaml "/permissions/{id}": - get: - summary: Retrieve a Permission - description: Retrieve a single permissions object by unique identifier. - operationId: getPermission - parameters: - - "$ref": "#/components/parameters/Id" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Permissions" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Permissions - patch: - summary: Update a Permission - description: Update an existing permission - operationId: updatePermission - parameters: - - "$ref": "#/components/parameters/Id" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - properties: - collection: - description: What collection this permission applies to. - type: object - comment: - description: If the user can post comments. `full`. - type: string - enum: - - none - - create - - update - create: - description: If the user can create items. - type: string - enum: - - none - - full - delete: - description: If the user can update items. - type: string - enum: - - none - - mine - - role - - full - explain: - description: - If the user is required to leave a comment explaining - what was changed. - type: string - enum: - - none - - create - - update - - always - read: - description: If the user can read items. - type: string - enum: - - none - - mine - - role - - full - read_field_blacklist: - description: Explicitly denies read access for specific fields. - type: object - role: - description: - Unique identifier of the role this permission applies - to. - type: object - status: - description: What status this permission applies to. - type: object - status_blacklist: - description: Explicitly denies specific statuses to be used. - type: object - update: - description: If the user can update items. - type: string - enum: - - none - - mine - - role - - full - write_field_blacklist: - description: Explicitly denies write access for specific fields. - type: object - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Permissions" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Permissions - delete: - summary: Delete a Permission - description: Delete an existing permission - operationId: deletePermission - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Permissions - parameters: - - "$ref": "#/components/parameters/Id" + $ref: paths/permissions/_id/index.yaml + "/permissions/me": + $ref: paths/permissions/me/index.yaml + "/permissions/me/{collection}/{id}": + $ref: paths/permissions/me/_collection/_id/index.yaml + "/policies": + $ref: paths/policies/index.yaml + "/policies/{id}": + $ref: paths/policies/_id/index.yaml + "/presets": + $ref: paths/presets/index.yaml + "/presets/{id}": + $ref: paths/presets/_id/index.yaml "/relations": - get: - summary: List Relations - description: List the relations. - operationId: getRelations - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - - "$ref": "#/components/parameters/Page" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Relations" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Relations - post: - summary: Create a Relation - description: Create a new relation. - operationId: createRelation - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - properties: - collection_many: - description: - Collection that has the field that holds the foreign - key. - type: string - example: articles - collection_one: - description: Collection on the _one_ side of the relationship. - type: string - example: authors - field_many: - description: - Foreign key. Field that holds the primary key of the - related collection. - type: string - example: author - field_one: - description: Alias column that serves as the _one_ side of the relationship. - type: string - example: books - junction_field: - description: - Field on the junction table that holds the primary - key of the related collection. - type: string - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Relations" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Relations + $ref: paths/relations/index.yaml "/relations/{id}": - get: - summary: Retrieve a Relation - description: Retrieve a single relation by unique identifier. - operationId: getRelation - parameters: - - "$ref": "#/components/parameters/Id" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Relations" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Relations - patch: - summary: Update a Relation - description: Update an existing relation - operationId: updateRelation - parameters: - - "$ref": "#/components/parameters/Id" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - properties: - collection_many: - description: - Collection that has the field that holds the foreign - key. - type: string - collection_one: - description: Collection on the _one_ side of the relationship. - type: string - field_many: - description: - Foreign key. Field that holds the primary key of the - related collection. - type: string - field_one: - description: Alias column that serves as the _one_ side of the relationship. - type: string - example: books - junction_field: - description: - Field on the junction table that holds the primary - key of the related collection. - type: string - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Relations" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Relations - delete: - summary: Delete a Relation - description: Delete an existing relation. - operationId: deleteRelation - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Relations - parameters: - - "$ref": "#/components/parameters/Id" - "/webhooks": - get: - summary: List Webhooks - description: Get all webhooks. - operationId: getWebhooks - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Webhooks" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Webhooks - post: - summary: Create a Webhook - description: Create a new webhook. - operationId: createWebhook - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - properties: - name: - description: The name of the webhook. - type: string - example: create articles - method: - description: Method used in the webhook. - type: string - example: POST - url: - description: The url of the webhook. - type: string - example: - status: - description: The status of the webhook. - type: string - example: active - data: - description: If yes, send the content of what was done - type: boolean - example: true - actions: - description: The actions that triggers this webhook. - example: - system-collections: - description: The collections that triggers this webhook. - example: - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Roles" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Webhooks - patch: - summary: Update Multiple Webhooks - description: Update multiple webhooks at the same time. - tags: - - Webhooks - operationId: updateWebhooks - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - requestBody: - content: - application/json: - schema: - properties: - data: - properties: - name: - description: The name of the webhook. - type: string - example: create articles - method: - description: Method used in the webhook. - type: string - example: POST - url: - description: The url of the webhook. - type: string - example: - status: - description: The status of the webhook. - type: string - example: active - data: - description: If yes, send the content of what was done - type: boolean - example: true - actions: - description: The actions that triggers this webhook. - example: - system-collections: - description: The collections that triggers this webhook. - example: - type: object - keys: - type: array - items: - type: string - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Webhooks" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - delete: - summary: Delete Multiple Webhooks - description: Delete multiple existing webhooks. - tags: - - Webhooks - operationId: deleteWebhooks - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "/webhooks/{id}": - get: - summary: Retrieve a Webhook - description: Retrieve a single webhook by unique identifier. - operationId: getWebhook - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Webhooks" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Webhooks - parameters: - - "$ref": "#/components/parameters/UUId" - patch: - summary: Update a Webhook - description: Update an existing webhook - operationId: updateWebhook - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - properties: - name: - description: The name of the webhook. - type: string - example: create articles - method: - description: Method used in the webhook. - type: string - example: POST - url: - description: The url of the webhook. - type: string - example: - status: - description: The status of the webhook. - type: string - example: active - data: - description: If yes, send the content of what was done - type: boolean - example: true - actions: - description: The actions that triggers this webhook. - example: - system-collections: - description: The collections that triggers this webhook. - example: - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Roles" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Webhooks - delete: - summary: Delete a Webhook - description: Delete an existing webhook - operationId: deleteWebhook - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Webhooks - parameters: - - "$ref": "#/components/parameters/UUId" + $ref: paths/relations/_id/index.yaml "/revisions": - get: - summary: List Revisions - description: List the revisions. - operationId: getRevisions - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - - "$ref": "#/components/parameters/Page" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Revisions" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Revisions + $ref: paths/revisions/index.yaml "/revisions/{id}": - get: - summary: Retrieve a Revision - description: Retrieve a single revision by unique identifier. - operationId: getRevision - parameters: - - "$ref": "#/components/parameters/Id" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Revisions" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Revisions - "/presets": - get: - tags: - - Presets - operationId: getPresets - summary: List Presets - description: List the presets. - security: - - Auth: [] - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Page" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Presets" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - post: - tags: - - Presets - operationId: createPreset - summary: Create a Preset - description: Create a new preset. - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - type: object - required: - - collection - properties: - collection: - type: string - description: What collection this collection preset is used for. - example: articles - title: - type: string - description: - Name for the bookmark. If this is set, the collection - preset will be considered to be a bookmark. - example: Highly rated articles - role: - type: string - description: - The unique identifier of a role in the platform. If - user is null, this will be used to apply the collection preset - or bookmark for all users in the role. - example: - search: - type: string - description: - What the user searched for in search/filter in the - header bar. - filters: - type: array - items: - type: object - properties: - key: - type: string - example: aHKLAakdVghzD - field: - type: string - example: rating - operator: - type: string - example: gte - value: - type: integer - example: 4.5 - layout: - type: string - description: Name of the view type that is used. - layout_query: - type: string - description: - Layout query that's saved per layout type. Controls - what data is fetched on load. These follow the same format as - the JS SDK parameters. - layout_options: - type: string - description: - Options of the views. The properties in here are controlled - by the layout. - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Presets" - "401": - "$ref": "#/components/responses/UnauthorizedError" - patch: - summary: Update Multiple Presets - description: Update multiple presets at the same time. - tags: - - Presets - operationId: updatePresets - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - requestBody: - content: - application/json: - schema: - type: object - properties: - keys: - type: array - items: - type: string - data: - type: object - required: - - collection - properties: - collection: - type: string - description: - What collection this collection preset is used - for. - example: articles - title: - type: string - description: - Name for the bookmark. If this is set, the collection - preset will be considered to be a bookmark. - example: Highly rated articles - role: - type: string - description: - The unique identifier of a role in the platform. - If user is null, this will be used to apply the collection - preset or bookmark for all users in the role. - example: - search: - type: string - description: - What the user searched for in search/filter in - the header bar. - filters: - type: array - items: - type: object - properties: - key: - type: string - example: aHKLAakdVghzD - field: - type: string - example: rating - operator: - type: string - example: gte - value: - type: integer - example: 4.5 - layout: - type: string - description: Name of the view type that is used. - layout_query: - type: string - description: - Layout query that's saved per layout type. Controls - what data is fetched on load. These follow the same format - as the JS SDK parameters. - layout_options: - type: string - description: - Options of the views. The properties in here are - controlled by the layout. - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Presets" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - delete: - summary: Delete Multiple Presets - description: Delete multiple existing presets. - tags: - - Presets - operationId: deletePresets - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "/presets/{id}": - get: - tags: - - Presets - operationId: getPreset - summary: Retrieve a Preset - description: Retrieve a single preset by unique identifier. - security: - - Auth: [] - parameters: - - "$ref": "#/components/parameters/Id" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Presets" - "401": - "$ref": "#/components/responses/UnauthorizedError" - patch: - tags: - - Presets - operationId: updatePreset - summary: Update a Preset - description: Update an existing preset. - parameters: - - "$ref": "#/components/parameters/Id" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - type: object - required: - - collection - properties: - collection: - type: string - description: What collection this collection preset is used for. - example: articles - title: - type: string - description: - Name for the bookmark. If this is set, the collection - preset will be considered to be a bookmark. - example: Highly rated articles - role: - type: integer - description: - The unique identifier of a role in the platform. If - user is null, this will be used to apply the collection preset - or bookmark for all users in the role. - search_query: - type: string - description: - What the user searched for in search/filter in the - header bar. - filters: - type: array - items: - type: object - properties: - field: - type: string - example: rating - operator: - type: string - example: gte - value: - type: integer - example: 4.5 - view_type: - type: string - description: Name of the view type that is used. Defaults to tabular. - view_query: - type: string - description: - View query that's saved per view type. Controls what - data is fetched on load. These follow the same format as the JS - SDK parameters. - view_options: - type: string - description: - Options of the views. The properties in here are controlled - by the layout. - translation: - type: object - description: - Key value pair of language-translation. Can be used - to translate the bookmark title in multiple languages. - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Presets" - "401": - "$ref": "#/components/responses/UnauthorizedError" - delete: - tags: - - Presets - operationId: deletePreset - summary: Delete a Preset - description: Delete an existing preset. - security: - - Auth: [] - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - parameters: - - "$ref": "#/components/parameters/Id" - "/flows": - get: - summary: List Flows - description: Get all flows. - operationId: getFlows - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Flows" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Flows - post: - summary: Create a Flow - description: Create a new flow. - operationId: createFlow - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - anyOf: - - "$ref": "#/components/schemas/Flows" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Flows" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Flows - patch: - summary: Update Multiple Flows - description: Update multiple flows at the same time. - tags: - - Flows - operationId: updateFlows - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - anyOf: - - "$ref": "#/components/schemas/Flows" - keys: - type: array - items: - type: string - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Flows" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - delete: - summary: Delete Multiple Flows - description: Delete multiple existing flows. - tags: - - Flows - operationId: deleteFlows - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "/flows/{id}": - get: - summary: Retrieve a Flow - description: Retrieve a single flow by unique identifier. - operationId: getFlow - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Flows" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Flows - parameters: - - "$ref": "#/components/parameters/UUId" - patch: - summary: Update a Flow - description: Update an existing flow - operationId: updateFlow - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - anyOf: - - "$ref": "#/components/schemas/Flows" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Flows" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Flows - delete: - summary: Delete a Flow - description: Delete an existing flow - operationId: deleteFlow - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Flows - parameters: - - "$ref": "#/components/parameters/UUId" - "/operations": - get: - summary: List Operations - description: Get all operations. - operationId: getOperations - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Operations" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Operations - post: - summary: Create an Operation - description: Create a new operation. - operationId: createOperation - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - anyOf: - - "$ref": "#/components/schemas/Operations" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Operations" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Operations - patch: - summary: Update Multiple Operations - description: Update multiple operations at the same time. - tags: - - Operations - operationId: updateOperations - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - anyOf: - - "$ref": "#/components/schemas/Operations" - keys: - type: array - items: - type: string - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Operations" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - delete: - summary: Delete Multiple Operations - description: Delete multiple existing operations. - tags: - - Operations - operationId: deleteOperations - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "/operations/{id}": - get: - summary: Retrieve an Operation - description: Retrieve a single operation by unique identifier. - operationId: getOperation - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Operations" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Operations - parameters: - - "$ref": "#/components/parameters/UUId" - patch: - summary: Update an Operation - description: Update an existing operation - operationId: updateOperation - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - anyOf: - - "$ref": "#/components/schemas/Operations" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Operations" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Operations - delete: - summary: Delete an Operation - description: Delete an existing operation - operationId: deleteOperation - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Operations - parameters: - - "$ref": "#/components/parameters/UUId" + $ref: paths/revisions/_id/index.yaml + "/roles": + $ref: paths/roles/index.yaml + "/roles/{id}": + $ref: paths/roles/_id/index.yaml + "/schema/apply": + $ref: paths/schema/apply/index.yaml + "/schema/diff": + $ref: paths/schema/diff/index.yaml + "/schema/snapshot": + $ref: paths/schema/snapshot/index.yaml + "/server/info": + $ref: paths/server/info/index.yaml + "/server/ping": + $ref: paths/server/ping/index.yaml + "/server/specs/graphql": + $ref: paths/server/specs/graphql/index.yaml + "/server/specs/oas": + $ref: paths/server/specs/oas/index.yaml + "/server/health": + $ref: paths/server/health/index.yaml + "/settings": + $ref: paths/settings/index.yaml + "/shares": + $ref: paths/shares/index.yaml + "/shares/{id}": + $ref: paths/shares/_id/index.yaml + "/shares/auth": + $ref: paths/shares/auth/index.yaml + "/shares/info/{id}": + $ref: paths/shares/info/_id/index.yaml + "/translations": + $ref: paths/translations/index.yaml + "/translations/{id}": + $ref: paths/translations/_id/index.yaml + "/users": + $ref: paths/users/index.yaml + "/users/{id}": + $ref: paths/users/_id/index.yaml + "/users/invite": + $ref: paths/users/invite/index.yaml + "/users/invite/accept": + $ref: paths/users/invite/accept/index.yaml + "/users/me": + $ref: paths/users/me/index.yaml + "/users/me/tfa/disable": + $ref: paths/users/me/tfa/disable/index.yaml + "/users/me/tfa/enable": + $ref: paths/users/me/tfa/enable/index.yaml + "/users/me/tfa/generate": + $ref: paths/users/me/tfa/generate/index.yaml + "/users/me/track/page": + $ref: paths/users/me/track/page/index.yaml + "/users/register": + $ref: paths/users/register/index.yaml + "/users/register/verify-email/{token}": + $ref: paths/users/register/verify-email/_token/index.yaml + "/utils/cache/clear": + $ref: paths/utils/cache/clear/index.yaml + "/utils/export/{collection}": + $ref: paths/utils/export/_collection/index.yaml + "/utils/hash/generate": + $ref: paths/utils/hash/generate/index.yaml + "/utils/hash/verify": + $ref: paths/utils/hash/verify/index.yaml + "/utils/import/{collection}": + $ref: paths/utils/import/_collection/index.yaml + "/utils/random/string": + $ref: paths/utils/random/string/index.yaml + "/utils/sort/{collection}": + $ref: paths/utils/sort/_collection/index.yaml "/versions": - get: - summary: List Content Versions - description: Get all Content Versions. - operationId: getContentVersions - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Versions" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Versions - post: - summary: Create Multiple Content Versions - description: Create multiple new Content Versions. - operationId: createContentVersion - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - anyOf: - - "$ref": "#/components/schemas/Versions" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Versions" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Versions - patch: - summary: Update Multiple Content Versions - description: Update multiple Content Versions at the same time. - operationId: updateContentVersions - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - requestBody: - content: - application/json: - schema: - type: object - properties: - data: - anyOf: - - "$ref": "#/components/schemas/Versions" - keys: - type: array - items: - type: string - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Versions" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - tags: - - Versions - delete: - summary: Delete Multiple Content Versions - description: Delete multiple existing Content Versions. - operationId: deleteContentVersions - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - tags: - - Versions + $ref: paths/versions/index.yaml "/versions/{id}": - get: - summary: Retrieve a Content Version - description: Retrieve a single Content Version by unique identifier. - operationId: getContentVersion - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Versions" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Versions - patch: - summary: Update a Content Version - description: Update an existing Content Version. - operationId: updateContentVersion - parameters: - - "$ref": "#/components/parameters/UUId" - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - anyOf: - - "$ref": "#/components/schemas/Versions" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Versions" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Versions - delete: - summary: Delete a Content Version - description: Delete an existing Content Version. - operationId: deleteContentVersion - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Versions - parameters: - - "$ref": "#/components/parameters/UUId" - "/versions/{id}/save": - post: - summary: Save to a Content Version - description: Save item changes to an existing Content Version. - operationId: saveContentVersion - parameters: - - "$ref": "#/components/parameters/UUId" - requestBody: - content: - application/json: - schema: - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: {} - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Versions + $ref: paths/versions/_id/index.yaml "/versions/{id}/compare": - get: - summary: Compare a Content Version - description: - Compare an existing Content Version with the main version of the - item. - operationId: compareContentVersion - parameters: - - "$ref": "#/components/parameters/UUId" - responses: - "200": - content: - application/json: - schema: - properties: - data: - type: object - type: object - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Versions + $ref: paths/versions/_id/compare/index.yaml "/versions/{id}/promote": - post: - summary: Promote a Content Version - description: - Pass the current hash of the main version of the item (obtained - from the `compare` endpoint) along with an optional array of field names of - which the values are to be promoted (by default, all fields are selected). - operationId: promoteContentVersion - parameters: - - "$ref": "#/components/parameters/UUId" - requestBody: - content: - application/json: - schema: - type: object - properties: - mainHash: - description: Hash of the main version of the item to be promoted. - type: string - fields: - description: - Optional array of field names of which the values are - to be promoted. - type: string - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: {} - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Versions - "/items/example_collection": - post: - summary: Create an Item - description: Create a new example_collection item. - tags: - - Items - - ItemsExampleCollection - operationId: createItemsExampleCollection - parameters: - - "$ref": "#/components/parameters/Meta" - requestBody: - content: - application/json: - schema: - oneOf: - - type: array - items: - "$ref": "#/components/schemas/ItemsExampleCollection" - - "$ref": "#/components/schemas/ItemsExampleCollection" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - items: - "$ref": "#/components/schemas/ItemsExampleCollection" - "401": - "$ref": "#/components/responses/UnauthorizedError" - get: - summary: List Items - description: List the example_collection items. - tags: - - Items - - ItemsExampleCollection - operationId: readItemsExampleCollection - security: - - Auth: [] - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - type: object - "$ref": "#/components/schemas/ItemsExampleCollection" - meta: - "$ref": "#/components/schemas/x-metadata" - "401": - "$ref": "#/components/responses/UnauthorizedError" - patch: - summary: Update Multiple Items - description: Update multiple example_collection items at the same time. - tags: - - Items - - ItemsExampleCollection - operationId: updateItemsExampleCollection - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Sort" - - "$ref": "#/components/parameters/Filter" - - "$ref": "#/components/parameters/Search" - requestBody: - content: - application/json: - schema: - oneOf: - - type: array - items: - "$ref": "#/components/schemas/ItemsExampleCollection" - - "$ref": "#/components/schemas/ItemsExampleCollection" - responses: - "200": - description: Successful request - content: - application/json: - schema: - properties: - data: - items: - "$ref": "#/components/schemas/ItemsExampleCollection" - delete: - summary: Delete Multiple Items - description: Delete multiple existing example_collection items. - tags: - - Items - - ItemsExampleCollection - operationId: deleteItemsExampleCollection - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - parameters: [] - "/items/example_collection/{id}": - get: - summary: Retrieve an Item - description: Retrieve a single example_collection item by unique identifier. - tags: - - Items - - ItemsExampleCollection - operationId: readSingleItemsExampleCollection - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Version" - - name: id - description: Index of the item. - in: path - required: true - schema: - oneOf: - - type: integer - description: Incremental index of the item. - example: 1 - - type: string - description: Unique identifier of the item. - example: 8cbb43fe-4cdf-4991-8352-c461779cec02 - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: object - "$ref": "#/components/schemas/ItemsExampleCollection" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - patch: - summary: Update an Item - description: Update an existing example_collection item. - tags: - - Items - - ItemsExampleCollection - operationId: updateSingleItemsExampleCollection - parameters: - - "$ref": "#/components/parameters/Fields" - - "$ref": "#/components/parameters/Meta" - - name: id - description: Index of the item. - in: path - required: true - schema: - oneOf: - - type: integer - description: Incremental index of the item. - example: 1 - - type: string - description: Unique identifier of the item. - example: 8cbb43fe-4cdf-4991-8352-c461779cec02 - requestBody: - content: - application/json: - schema: - type: object - "$ref": "#/components/schemas/ItemsExampleCollection" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - type: object - "$ref": "#/components/schemas/ItemsExampleCollection" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - delete: - summary: Delete an Item - description: Delete an existing example_collection item. - tags: - - Items - - ItemsExampleCollection - operationId: deleteSingleItemsExampleCollection - responses: - "200": - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - parameters: - - name: id - description: Index of the item. - in: path - required: true - schema: - oneOf: - - type: integer - description: Incremental index of the item. - example: 1 - - type: string - description: Unique identifier of the item. - example: 8cbb43fe-4cdf-4991-8352-c461779cec02 - "/settings": - get: - summary: Retrieve Settings - description: List the settings. - operationId: getSettings - parameters: - - "$ref": "#/components/parameters/Limit" - - "$ref": "#/components/parameters/Offset" - - "$ref": "#/components/parameters/Meta" - - "$ref": "#/components/parameters/Page" - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Settings" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Settings - patch: - summary: Update Settings - description: Update the settings - operationId: updateSetting - requestBody: - content: - application/json: - schema: - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Settings" - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Settings - "/extensions": - get: - summary: List Extensions - description: List the installed extensions and their configuration in the project. - operationId: listExtensions - responses: - "200": - content: - application/json: - schema: - type: object - properties: - data: - type: array - items: - "$ref": "#/components/schemas/Extensions" - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - tags: - - Extensions - "/extensions/{name}": - patch: - summary: Update an Extension - description: Update an existing extension. - operationId: updateExtensions - parameters: - - in: path - name: name - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - meta: - type: object - description: - Directus metadata for the extension. Where the configuration - for the extension in the current project is stored. - properties: - enabled: - description: Whether or not the extension is enabled. - example: true - type: boolean - responses: - "200": - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Extensions" - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Extensions - "/extensions/{bundle}/{name}": - patch: - summary: Update an Extension - description: Update an existing extension. - operationId: updateExtensions - parameters: - - in: path - name: bundle - required: true - schema: - type: string - - in: path - name: name - required: true - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - meta: - type: object - description: - Directus metadata for the extension. Where the configuration - for the extension in the current project is stored. - properties: - enabled: - description: Whether or not the extension is enabled. - example: true - type: boolean - responses: - "200": - content: - application/json: - schema: - type: object - properties: - data: - "$ref": "#/components/schemas/Extensions" - description: Successful request - "401": - "$ref": "#/components/responses/UnauthorizedError" - "404": - "$ref": "#/components/responses/NotFoundError" - tags: - - Extensions + $ref: paths/versions/_id/promote/index.yaml + "/versions/{id}/save": + $ref: paths/versions/_id/save/index.yaml +components: + parameters: + $ref: components/parameters.yaml + responses: + $ref: components/responses.yaml + securitySchemes: + $ref: components/security.yaml + schemas: + $ref: components/schemas/_index.yaml +security: [] tags: + - name: Activity + description: All events that happen within Directus are tracked and stored in the activities collection. This gives you full accountability over everything that happens. + x-collection: directus_activity - name: Assets - description: - Image typed files can be dynamically resized and transformed to fit - any need. + description: Image typed files can be dynamically resized and transformed to fit any need. - name: Authentication - description: - All data within the platform is private by default. The public role - can be configured to expose data without authentication, or you can pass an access - token to the API to access private data. + description: All data within the platform is private by default. The public role can be configured to expose data without authentication, or you can pass an access token to the API to access private data. + - name: Collections + description: Collections are the individual collections of items, similar to tables in a database. Changes to collections will alter the schema of the database. + x-collection: directus_collections + - name: Comments + description: Comments are a collaboration tool and can be left on items from the sidebar. + x-collection: directus_comments + - name: Dashboards + description: Dashboards within the Insights module organize different Panels into an at-a-glance view. They can be used to group data based on department, objective, business process or anything you choose. + - name: Extensions + description: Directus can easily be extended through the addition of several types of extensions, including layouts, interfaces, and modules. + x-collection: directus_extensions + - name: Fields + description: Fields are individual pieces of content within an item. They are mapped to columns in the database. + x-collection: directus_fields + - name: Files + description: Every file managed by the platform is uploaded to the configured storage adapter, and its associated metadata is tracked within the `directus_files` system collection. Any requested file transformations are handled on the fly, and are only saved to storage. + x-collection: directus_files + - name: Folders + description: Folders can be used to organize files within the platform. Folders are virtual, and aren't mirrored within the storage adapter. + x-collection: directus_folders + - name: Flows + description: Flows enable custom, event-driven data processing and task automation. + x-collection: directus_flows + - name: Items + description: Items are individual pieces of data in your database. They can be anything, from articles, to IoT status checks. + x-collection: directus_items + - name: Operations + description: Operations are the building blocks within Data Flows. + x-collection: directus_operations + - name: Notifications + description: Notifications allow you to send/receive messages to/from other users of the platform. + x-collection: directus_notifications + - name: Panels + description: Panels are modular units of data visualization that exist within the Insights module. Each panel exists within a Dashboard and can be positioned and resized as needed. + x-collection: directus_panels + - name: Permissions + description: Permissions are assigned to Policies, and control data access throughout the platform. [Learn more about permissions](/auth/access-control). + x-collection: directus_permissions + - name: Policies + description: Policies define a specific set of access permissions, and are a composable unit that can be assigned to both roles and users. + x-collection: directus_policies + - name: Presets + description: Presets hold the preferences of individual users of the platform. This allows Directus to show and maintain custom item listings for users of the app. + x-collection: directus_presets + - name: Relations + description: What data is linked to what other data. Allows you to assign authors to articles, products to sales, and whatever other structures you can think of. + x-collection: directus_relations + - name: Revisions + description: Revisions are individual changes to items made. Directus keeps track of changes made, so you're able to revert to a previous state at will. + x-collection: directus_revisions + - name: Roles + description: Roles are the primary organizational structure for users within the platform. + x-collection: directus_roles - name: Schema description: Retrieve and update the schema of an instance. x-authentication: admin x-schemas: - Schema - Diff + - name: Shares + description: Shares are a way to publicly share an otherwise private item. + x-collection: directus_shares + - name: Settings + description: Settings are key-value pairs that are stored in the database, and control different aspects of the project. Only administrators have access to manage Settings. + x-collection: directus_settings - name: Server - description: - Access to where Directus runs. Allows you to make sure your server - has everything needed to run the platform, and check what kind of latency we're - dealing with. + description: Access to where Directus runs. Allows you to make sure your server has everything needed to run the platform, and check what kind of latency we're dealing with. + - name: Translations + description: Custom translations in Directus. + x-collection: directus_translations - name: Utilities - description: - Directus comes with various utility endpoints you can use to simplify - your development flow. + description: Directus comes with various utility endpoints you can use to simplify your development flow. x-authentication: user x-schemas: - Files - Folders - Users - Roles - - name: Folders - description: Group files by virtual folders. - x-collection: directus_folders - - name: Roles - description: Roles are groups of users that share permissions. - x-collection: directus_roles - - name: Activity - description: - All events that happen within Directus are tracked and stored in the - activities collection. This gives you full accountability over everything that - happens. - x-collection: directus_activity - - name: Collections - description: - Collections are the individual collections of items, similar to tables - in a database. Changes to collections will alter the schema of the database. - x-collection: directus_collections - - name: Fields - description: - Fields are individual pieces of content within an item. They are mapped - to columns in the database. - x-collection: directus_fields - - name: Files - description: - Files can be saved in any given location. Directus has a powerful assets - endpoint that can be used to generate thumbnails for images on the fly. - x-collection: directus_files - name: Users - description: Users are what gives you access to the data. + description: Directus Users are the individual accounts that let you authenticate into the API and App. Each user can belong to a Role. x-collection: directus_users - - name: Permissions - description: Permissions control who has access to what and when. - x-collection: directus_permissions - - name: Relations - description: - What data is linked to what other data. Allows you to assign authors - to articles, products to sales, and whatever other structures you can think of. - x-collection: directus_relations - - name: Webhooks - description: Webhooks. - x-collection: directus_webhooks - - name: Revisions - description: - Revisions are individual changes to items made. Directus keeps track - of changes made, so you're able to revert to a previous state at will. - x-collection: directus_revisions - - name: Presets - description: - Presets hold the preferences of individual users of the platform. This - allows Directus to show and maintain custom item listings for users of the app. - x-collection: directus_presets - - name: Flows - description: Flows enable custom, event-driven data processing and task automation. - x-collection: directus_flows - - name: Operations - description: Operations are the building blocks within Data Flows. - x-collection: directus_operations - name: Versions - description: - Enables users to create unpublished copies of an item, modify them - independently from the main version, and promote them to become the new main version - when ready. + description: Enables users to create unpublished copies of an item, modify them independently from the main version, and promote them to become the new main version when ready. x-collection: directus_versions - - name: ItemsExampleCollection - x-collection: example_collection - - name: Settings - description: Settings control the way the platform works and acts. - x-collection: directus_settings - - name: Extensions - description: - Directus can easily be extended through the addition of several types - of extensions, including layouts, interfaces, and modules. - x-collection: directus_extensions -components: - schemas: - Diff: - type: object - properties: - hash: - type: string - diff: - type: object - properties: - collections: - type: array - items: - type: object - properties: - collection: - type: string - diff: - type: array - items: - type: object - fields: - type: array - items: - type: object - properties: - collection: - type: string - field: - type: string - diff: - type: array - items: - type: object - relations: - type: array - items: - type: object - properties: - collection: - type: string - field: - type: string - related_collection: - type: string - diff: - type: array - items: - type: object - Files: - type: object - properties: - id: - description: Unique identifier for the file. - example: 8cbb43fe-4cdf-4991-8352-c461779cec02 - type: string - storage: - description: - Where the file is stored. Either `local` for the local filesystem - or the name of the storage adapter (for example `s3`). - example: local - type: string - filename_disk: - description: - Name of the file on disk. By default, Directus uses a random - hash for the filename. - example: a88c3b72-ac58-5436-a4ec-b2858531333a.jpg - type: string - filename_download: - description: How you want to the file to be named when it's being downloaded. - example: avatar.jpg - type: string - title: - description: - Title for the file. Is extracted from the filename on upload, - but can be edited by the user. - example: User Avatar - type: string - type: - description: MIME type of the file. - example: image/jpeg - type: string - folder: - description: Virtual folder where this file resides in. - example: - oneOf: - - type: string - - "$ref": "#/components/schemas/Folders" - nullable: true - uploaded_by: - description: Who uploaded the file. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - oneOf: - - type: string - - "$ref": "#/components/schemas/Users" - uploaded_on: - description: When the file was uploaded. - example: "2019-12-03T00:10:15+00:00" - type: string - format: date-time - modified_by: - nullable: true - oneOf: - - type: string - format: uuid - - "$ref": "#/components/schemas/Users" - modified_on: - nullable: false - type: string - format: timestamp - charset: - description: Character set of the file. - example: binary - type: string - nullable: true - filesize: - description: Size of the file in bytes. - example: 137862 - type: integer - width: - description: Width of the file in pixels. Only applies to images. - example: 800 - type: integer - nullable: true - height: - description: Height of the file in pixels. Only applies to images. - example: 838 - type: integer - nullable: true - duration: - description: - Duration of the file in seconds. Only applies to audio and - video. - example: 0 - type: integer - nullable: true - embed: - description: Where the file was embedded from. - example: - type: string - nullable: true - description: - description: Description for the file. - type: string - nullable: true - location: - description: - Where the file was created. Is automatically populated based - on Exif data for images. - type: string - nullable: true - tags: - description: - Tags for the file. Is automatically populated based on Exif - data for images. - type: array - nullable: true - items: - type: string - metadata: - description: IPTC, Exif, and ICC metadata extracted from file - type: object - nullable: true - focal_point_x: - nullable: true - type: integer - focal_point_y: - nullable: true - type: integer - x-collection: directus_files - Folders: - type: object - properties: - id: - description: Unique identifier for the folder. - example: 0cf0e03d-4364-45df-b77b-ca61f61869d2 - type: string - name: - description: Name of the folder. - example: New York - type: string - parent: - description: - Unique identifier of the parent folder. This allows for nested - folders. - example: - oneOf: - - type: string - - "$ref": "#/components/schemas/Folders" - nullable: true - x-collection: directus_folders - Roles: - type: object - properties: - id: - description: Unique identifier for the role. - example: 2f24211d-d928-469a-aea3-3c8f53d4e426 - type: string - name: - description: Name of the role. - example: Administrator - type: string - icon: - description: The role's icon. - example: verified_user - type: string - description: - description: Description of the role. - example: Admins have access to all managed data within the system by default - type: string - nullable: true - ip_access: - description: - Array of IP addresses that are allowed to connect to the API - as a user of this role. - example: [] - type: array - items: - type: string - enforce_tfa: - description: Whether or not this role enforces the use of 2FA. - example: false - type: boolean - admin_access: - description: Admin role. If true, skips all permission checks. - example: false - type: boolean - app_access: - description: The users in the role are allowed to use the app. - example: true - type: boolean - users: - nullable: true - type: array - items: - oneOf: - - type: string - format: uuid - - "$ref": "#/components/schemas/Users" - x-collection: directus_roles - Schema: - type: object - properties: - version: - type: integer - example: 1 - directus: - type: string - vendor: - type: string - collections: - type: array - items: - "$ref": "#/components/schemas/Collections" - fields: - type: array - items: - "$ref": "#/components/schemas/Fields" - relations: - type: array - items: - "$ref": "#/components/schemas/Relations" - Users: - type: object - properties: - id: - description: Unique identifier for the user. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - type: string - first_name: - description: First name of the user. - example: Admin - type: string - last_name: - description: Last name of the user. - example: User - type: string - email: - description: Unique email address for the user. - example: admin@example.com - type: string - format: email - password: - description: Password of the user. - type: string - location: - description: The user's location. - example: - type: string - nullable: true - title: - description: The user's title. - example: - type: string - nullable: true - description: - description: The user's description. - example: - type: string - nullable: true - tags: - description: The user's tags. - example: - type: array - nullable: true - items: - type: string - avatar: - description: The user's avatar. - example: - oneOf: - - type: string - - "$ref": "#/components/schemas/Files" - nullable: true - language: - description: The user's language used in Directus. - example: en-US - type: string - tfa_secret: - description: The 2FA secret string that's used to generate one time passwords. - example: - type: string - nullable: true - status: - description: Status of the user. - example: active - type: string - enum: - - active - - invited - - draft - - suspended - - deleted - role: - description: Unique identifier of the role of this user. - example: 2f24211d-d928-469a-aea3-3c8f53d4e426 - oneOf: - - type: string - - "$ref": "#/components/schemas/Roles" - token: - description: Static token for the user. - type: string - nullable: true - last_access: - description: When this user used the API last. - example: "2020-05-31T14:32:37Z" - type: string - nullable: true - format: date-time - last_page: - description: Last page that the user was on. - example: "/my-project/settings/collections/a" - type: string - nullable: true - provider: - nullable: false - type: string - external_identifier: - nullable: true - type: string - auth_data: - nullable: true - email_notifications: - nullable: true - type: boolean - appearance: - nullable: true - type: string - theme_dark: - nullable: true - type: string - theme_light: - nullable: true - type: string - theme_light_overrides: - nullable: true - theme_dark_overrides: - nullable: true - x-collection: directus_users - Query: - type: object - properties: - fields: - type: array - items: - type: string - description: Control what fields are being returned in the object. - example: - - "*" - - "*.*" - filter: - type: object - example: - "": - "": "" - search: - description: - Filter by items that contain the given search query in one - of their fields. - type: string - sort: - type: array - items: - type: string - description: How to sort the returned items. - example: - - "-date_created" - limit: - type: number - description: Set the maximum number of items that will be returned - offset: - type: number - description: How many items to skip when fetching data. - page: - type: number - description: - Cursor for use in pagination. Often used in combination with - limit. - deep: - type: object - description: - Deep allows you to set any of the other query parameters on - a nested relational dataset. - example: - related_articles: - _limit: 3 - x-metadata: - type: object - properties: - total_count: - description: Returns the total item count of the collection you're querying. - type: integer - filter_count: - description: - Returns the item count of the collection you're querying, taking - the current filter/search parameters into account. - type: integer - Activity: - type: object - properties: - id: - description: Unique identifier for the object. - example: 2 - type: integer - action: - description: Action that was performed. - example: update - type: string - enum: - - create - - update - - delete - - login - user: - description: The user who performed this action. - oneOf: - - type: string - - "$ref": "#/components/schemas/Users" - nullable: true - timestamp: - description: When the action happened. - example: "2019-12-05T22:52:09Z" - type: string - format: date-time - ip: - description: The IP address of the user at the time the action took place. - example: 127.0.0.1 - oneOf: - - type: string - format: ipv4 - user_agent: - description: - User agent string of the browser the user used when the action - took place. - example: - Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 - (KHTML,like Gecko) Chrome/78.0.3904.108 Safari/537.36 - type: string - collection: - description: Collection identifier in which the item resides. - oneOf: - - type: string - - "$ref": "#/components/schemas/Collections" - item: - description: - Unique identifier for the item the action applied to. This - is always a string, even for integer primary keys. - example: "328" - type: string - comment: - description: - User comment. This will store the comments that show up in - the right sidebar of the item edit page in the admin app. - example: - type: string - nullable: true - origin: - description: Origin of the request when the action took place. - example: https://directus.io - type: string - revisions: - nullable: true - type: array - items: - oneOf: - - type: integer - - "$ref": "#/components/schemas/Revisions" - x-collection: directus_activity - Collections: - type: object - properties: - collection: - description: The collection key. - example: customers - type: string - icon: - nullable: true - type: string - note: - nullable: true - type: string - display_template: - nullable: true - type: string - hidden: - nullable: false - type: boolean - singleton: - nullable: false - type: boolean - translations: - nullable: true - archive_field: - nullable: true - type: string - archive_app_filter: - nullable: false - type: boolean - archive_value: - nullable: true - type: string - unarchive_value: - nullable: true - type: string - sort_field: - nullable: true - type: string - accountability: - nullable: true - type: string - color: - nullable: true - type: string - item_duplication_fields: - nullable: true - sort: - nullable: true - type: integer - group: - nullable: true - oneOf: - - type: string - - "$ref": "#/components/schemas/Collections" - collapse: - nullable: false - type: string - preview_url: - nullable: true - type: string - versioning: - nullable: false - type: boolean - x-collection: directus_collections - Fields: - type: object - properties: - id: - nullable: false - type: integer - collection: - description: Unique name of the collection this field is in. - example: about_us - type: string - field: - description: Unique name of the field. Field name is unique within the collection. - example: id - type: string - special: - nullable: true - type: array - items: - type: string - interface: - nullable: true - type: string - options: - nullable: true - display: - nullable: true - type: string - display_options: - nullable: true - readonly: - nullable: false - type: boolean - hidden: - nullable: false - type: boolean - sort: - nullable: true - type: integer - width: - nullable: true - type: string - translations: - nullable: true - note: - nullable: true - type: string - conditions: - nullable: true - required: - nullable: true - type: boolean - group: - nullable: true - oneOf: - - type: integer - - "$ref": "#/components/schemas/Fields" - validation: - nullable: true - validation_message: - nullable: true - type: string - x-collection: directus_fields - Permissions: - type: object - properties: - id: - description: Unique identifier for the permission. - example: 1 - type: integer - role: - description: Unique identifier of the role this permission applies to. - example: 2f24211d-d928-469a-aea3-3c8f53d4e426 - type: string - nullable: true - collection: - description: What collection this permission applies to. - example: customers - type: string - action: - description: What action this permission applies to. - example: create - type: string - enum: - - create - - read - - update - - delete - permissions: - description: JSON structure containing the permissions checks for this permission. - type: object - nullable: true - validation: - description: JSON structure containing the validation checks for this permission. - type: object - nullable: true - presets: - description: - JSON structure containing the preset value for created/updated - items. - type: object - nullable: true - fields: - description: CSV of fields that the user is allowed to interact with. - type: array - items: - type: string - nullable: true - x-collection: directus_permissions - Relations: - type: object - properties: - id: - description: Unique identifier for the relation. - example: 1 - type: integer - many_collection: - description: Collection that has the field that holds the foreign key. - example: directus_activity - type: string - many_field: - description: - Foreign key. Field that holds the primary key of the related - collection. - example: user - type: string - one_collection: - description: Collection on the _one_ side of the relationship. - example: directus_users - type: string - one_field: - description: Alias column that serves as the _one_ side of the relationship. - example: - type: string - nullable: true - one_collection_field: - nullable: true - type: string - one_allowed_collections: - nullable: true - type: array - items: - type: string - junction_field: - description: - Field on the junction table that holds the many field of the - related relation. - example: - type: string - nullable: true - sort_field: - nullable: true - type: string - one_deselect_action: - nullable: false - type: string - x-collection: directus_relations - Webhooks: - type: object - properties: - id: - description: The index of the webhook. - type: integer - example: 1 - name: - description: The name of the webhook. - type: string - example: create articles - method: - description: Method used in the webhook. - type: string - example: POST - url: - description: The url of the webhook. - type: string - example: - nullable: true - status: - description: The status of the webhook. - type: string - example: inactive - data: - description: If yes, send the content of what was done - type: boolean - example: true - actions: - description: The actions that triggers this webhook. - type: array - items: - type: string - example: - nullable: true - collections: - nullable: false - type: array - items: - type: string - headers: - nullable: true - x-collection: directus_webhooks - Revisions: - type: object - properties: - id: - description: Unique identifier for the revision. - example: 1 - type: integer - activity: - description: Unique identifier for the activity record. - example: 2 - oneOf: - - type: integer - - "$ref": "#/components/schemas/Activity" - collection: - description: Collection of the updated item. - example: articles - oneOf: - - type: string - - "$ref": "#/components/schemas/Collections" - item: - description: Primary key of updated item. - example: "168" - type: string - data: - description: Copy of item state at time of update. - example: - author: 1 - body: This is my first post - featured_image: 15 - id: "168" - title: Hello, World! - type: object - nullable: true - delta: - description: Changes between the previous and the current revision. - example: - title: Hello, World! - type: object - parent: - description: - If the current item was updated relationally, this is the id - of the parent revision record - example: - type: integer - nullable: true - version: - description: Associated version of this revision. - example: draft - oneOf: - - type: string - - "$ref": "#/components/schemas/Versions" - x-collection: directus_revisions - Presets: - type: object - properties: - id: - description: Unique identifier for this single collection preset. - example: 155 - type: integer - bookmark: - description: - Name for the bookmark. If this is set, the preset will be considered - a bookmark. - nullable: true - type: string - user: - description: - The unique identifier of the user to whom this collection preset - applies. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - nullable: true - oneOf: - - type: string - - "$ref": "#/components/schemas/Users" - role: - description: - The unique identifier of a role in the platform. If `user` - is null, this will be used to apply the collection preset or bookmark - for all users in the role. - example: 50419801-0f30-8644-2b3c-9bc2d980d0a0 - nullable: true - oneOf: - - type: string - - "$ref": "#/components/schemas/Roles" - collection: - description: What collection this collection preset is used for. - example: articles - oneOf: - - type: string - - "$ref": "#/components/schemas/Collections" - search: - description: Search query. - type: string - nullable: true - layout: - description: Key of the layout that is used. - type: string - example: - layout_query: - description: - Layout query that's saved per layout type. Controls what data - is fetched on load. These follow the same format as the JS SDK parameters. - example: - cards: - sort: "-published_on" - nullable: true - layout_options: - description: - Options of the views. The properties in here are controlled - by the layout. - example: - cards: - icon: account_circle - title: "{{ first_name }} {{ last_name }}" - subtitle: "{{ title }}" - size: 3 - nullable: true - refresh_interval: - nullable: true - type: integer - filter: - nullable: true - icon: - nullable: true - type: string - color: - nullable: true - type: string - x-collection: directus_presets - Flows: - type: object - properties: - id: - description: Unique identifier for the flow. - type: string - example: 2f24211d-d928-469a-aea3-3c8f53d4e426 - name: - description: The name of the flow. - type: string - example: Update Articles Flow - icon: - description: Icon displayed in the Admin App for the flow. - type: string - example: bolt - color: - description: Color of the icon displayed in the Admin App for the flow. - type: string - example: "#112233" - nullable: true - description: - nullable: true - type: string - status: - description: Current status of the flow. - type: string - example: active - default: active - enum: - - active - - inactive - trigger: - description: - Type of trigger for the flow. One of `hook`, `webhook`, `operation`, - `schedule`, `manual`. - type: string - example: manual - accountability: - description: - The permission used during the flow. One of `$public`, `$trigger`, - `$full`, or UUID of a role. - type: string - example: "$trigger" - options: - description: Options of the selected trigger for the flow. - type: object - example: - nullable: true - operation: - description: UUID of the operation connected to the trigger in the flow. - example: 92e82998-e421-412f-a513-13701e83e4ce - oneOf: - - type: string - - "$ref": "#/components/schemas/Operations" - date_created: - description: Timestamp in ISO8601 when the flow was created. - type: string - example: "2022-05-11T13:14:52Z" - format: date-time - nullable: true - user_created: - description: The user who created the flow. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - oneOf: - - type: string - - "$ref": "#/components/schemas/Users" - operations: - nullable: true - type: array - items: - oneOf: - - type: string - format: uuid - - "$ref": "#/components/schemas/Operations" - x-collection: directus_flows - Operations: - type: object - properties: - id: - description: Unique identifier for the operation. - type: string - example: 2f24211d-d928-469a-aea3-3c8f53d4e426 - name: - description: The name of the operation. - type: string - example: Log to Console - key: - description: Key for the operation. Must be unique within a given flow. - type: string - example: log_console - type: - description: - Type of operation. One of `log`, `mail`, `notification`, `create`, - `read`, `request`, `sleep`, `transform`, `trigger`, `condition`, or any - type of custom operation extensions. - type: string - example: log - position_x: - description: Position of the operation on the X axis within the flow workspace. - type: integer - example: 12 - position_y: - description: Position of the operation on the Y axis within the flow workspace. - type: integer - example: 12 - options: - description: Options depending on the type of the operation. - type: object - example: - nullable: true - resolve: - description: - The operation triggered when the current operation succeeds - (or `then` logic of a condition operation). - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - oneOf: - - type: string - - "$ref": "#/components/schemas/Operations" - reject: - description: - The operation triggered when the current operation fails (or - `otherwise` logic of a condition operation). - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - oneOf: - - type: string - - "$ref": "#/components/schemas/Operations" - flow: - nullable: false - oneOf: - - type: string - format: uuid - - "$ref": "#/components/schemas/Flows" - date_created: - description: Timestamp in ISO8601 when the operation was created. - type: string - example: "2022-05-11T13:14:52Z" - format: date-time - nullable: true - user_created: - description: The user who created the operation. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - oneOf: - - type: string - - "$ref": "#/components/schemas/Users" - x-collection: directus_operations - Versions: - type: object - properties: - id: - description: Primary key of the Content Version. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - type: string - key: - description: - Key of the Content Version, used as the value for the "version" - query parameter. - example: draft - type: string - name: - description: Descriptive name of the Content Version. - example: My Draft - type: string - collection: - description: Name of the collection the Content Version is created on. - example: articles - oneOf: - - type: string - - "$ref": "#/components/schemas/Collections" - item: - description: The item the Content Version is created on. - example: "168" - type: string - hash: - nullable: true - type: string - date_created: - description: When the Content Version was created. - type: string - example: "2022-05-11T13:14:52Z" - format: date-time - nullable: true - date_updated: - description: When the Content Version was updated. - type: string - example: "2022-05-11T13:14:53Z" - format: date-time - nullable: true - user_created: - description: User that created the Content Version. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - oneOf: - - type: string - - "$ref": "#/components/schemas/Users" - user_updated: - description: User that updated the Content Version. - example: 63716273-0f29-4648-8a2a-2af2948f6f78 - oneOf: - - type: string - - "$ref": "#/components/schemas/Users" - x-collection: directus_versions - ItemsExampleCollection: - type: object - properties: - id: - nullable: false - type: string - format: uuid - status: - nullable: false - type: string - sort: - nullable: true - type: integer - user_created: - nullable: true - oneOf: - - type: string - format: uuid - - "$ref": "#/components/schemas/Users" - date_created: - nullable: true - type: string - format: timestamp - user_updated: - nullable: true - oneOf: - - type: string - format: uuid - - "$ref": "#/components/schemas/Users" - date_updated: - nullable: true - type: string - format: timestamp - text: - nullable: true - type: string - x-collection: example_collection - Settings: - type: object - properties: - id: - description: Unique identifier for the setting. - type: integer - example: 1 - project_name: - description: The name of the project. - type: string - example: Directus - project_url: - description: The url of the project. - type: string - example: - nullable: true - project_color: - description: The brand color of the project. - type: string - example: - nullable: true - project_logo: - description: The logo of the project. - type: string - example: - nullable: true - public_foreground: - description: The foreground of the project. - type: string - example: - nullable: true - public_background: - description: The background of the project. - type: object - properties: - id: - type: string - type: - type: string - example: - nullable: true - public_note: - description: Note rendered on the public pages of the app. - type: string - example: - nullable: true - auth_login_attempts: - description: - Allowed authentication login attempts before the user's status - is set to blocked. - type: integer - example: 25 - auth_password_policy: - description: Authentication password policy. - type: string - nullable: true - storage_asset_transform: - description: What transformations are allowed in the assets endpoint. - type: string - enum: - - all - - none - - presets - example: all - nullable: true - storage_asset_presets: - description: Array of allowed - type: array - items: - type: object - properties: - key: - description: Key for the asset. Used in the assets endpoint. - type: string - fit: - description: - Whether to crop the thumbnail to match the size, or maintain - the aspect ratio. - type: string - enum: - - cover - - contain - - inside - - outside - width: - description: Width of the thumbnail. - type: integer - height: - description: Height of the thumbnail. - type: integer - withoutEnlargement: - description: No image upscale - type: boolean - quality: - description: Quality of the compression used. - type: integer - format: - description: Reformat output image - type: string - enum: - - "" - - jpeg - - png - - webp - - tiff - - avif - transforms: - description: Additional transformations to apply - type: array - nullable: true - items: - type: object - properties: - method: - description: The Sharp method name - type: string - arguments: - description: A list of arguments to pass to the Sharp method - type: array - nullable: true - items: - type: object - properties: - argument: - description: A JSON representation of the argument value - type: string - example: - nullable: true - custom_css: - nullable: true - type: string - storage_default_folder: - description: Default folder to place files - type: string - format: uuid - basemaps: - nullable: true - mapbox_key: - nullable: true - type: string - module_bar: - nullable: true - project_descriptor: - nullable: true - type: string - default_language: - nullable: false - type: string - custom_aspect_ratios: - nullable: true - public_favicon: - nullable: true - description: "$t:field_options.directus_settings.project_favicon_note" - oneOf: - - type: string - format: uuid - - "$ref": "#/components/schemas/Files" - default_appearance: - nullable: false - type: string - default_theme_light: - nullable: true - type: string - theme_light_overrides: - nullable: true - default_theme_dark: - nullable: true - type: string - theme_dark_overrides: - nullable: true - x-collection: directus_settings - Extensions: - type: object - properties: - name: - description: Unique name of the extension. - example: my-bundle-operation - type: string - enabled: - nullable: false - type: boolean - x-collection: directus_extensions - parameters: - Id: - description: Index - name: id - in: path - required: true - schema: - type: integer - UUId: - description: Unique identifier for the object. - name: id - in: path - required: true - schema: - example: 8cbb43fe-4cdf-4991-8352-c461779cec02 - type: string - Collection: - description: Collection of which you want to retrieve the items from. - name: collection - in: path - required: true - schema: - type: string - Search: - description: - Filter by items that contain the given search query in one of their - fields. - in: query - name: search - required: false - schema: - type: string - Page: - description: Cursor for use in pagination. Often used in combination with limit. - in: query - name: page - required: false - schema: - type: integer - Offset: - description: How many items to skip when fetching data. - in: query - name: offset - required: false - schema: - type: integer - Sort: - description: - "How to sort the returned items. `sort` is a CSV of fields used - to sort the fetched items. Sorting defaults to ascending (ASC) order but a - minus sign (` - `) can be used to reverse this to descending (DESC) order. - Fields are prioritized by their order in the CSV. You can also use a ` ? ` - to sort randomly. - - " - in: query - name: sort - required: false - explode: false - schema: - type: array - items: - type: string - Meta: - description: What metadata to return in the response. - in: query - name: meta - required: false - schema: - type: string - Limit: - description: A limit on the number of objects that are returned. - in: query - name: limit - required: false - schema: - type: integer - Filter: - description: Select items in collection by given conditions. - in: query - name: filter - required: false - schema: - type: array - items: - type: string - pattern: "^(\\[[^\\[\\]]*?\\]){1}(\\[(_eq|_neq|_lt|_lte|_gt|_gte|_in|_nin|_null|_nnull|_contains|_ncontains|_between|_nbetween|_empty|_nempty)\\])?=.*?$" - Fields: - description: Control what fields are being returned in the object. - in: query - name: fields - required: false - explode: false - schema: - type: array - items: - type: string - Mode: - description: - Controls if the API sets a cookie or returns a JWT on successful - login. - in: query - name: mode - required: true - schema: - type: string - enum: - - jwt - - cookie - Export: - name: export - description: - Saves the API response to a file. Accepts one of "csv", "json", - "xml", "yaml". - in: query - required: false - schema: - type: string - enum: - - csv - - json - - xml - - yaml - Version: - name: version - description: - 'Retrieve an item''s state from a specific Content Version. The - value corresponds to the "key" of the Content Version. - - ' - in: query - required: false - schema: - type: string - responses: - NotFoundError: - description: "Error: Not found." - content: - application/json: - schema: - type: object - properties: - error: - type: object - properties: - code: - type: integer - format: int64 - message: - type: string - UnauthorizedError: - description: "Error: Unauthorized request" - content: - application/json: - schema: - type: object - properties: - error: - type: object - properties: - code: - type: integer - format: int64 - message: - type: string - securitySchemes: - KeyAuth: - type: apiKey - in: query - name: access_token - Auth: - type: apiKey - in: header - name: Authorization diff --git a/api-spec/paths/activity/_id/getActivity.yaml b/api-spec/paths/activity/_id/getActivity.yaml new file mode 100644 index 00000000..c8711fc8 --- /dev/null +++ b/api-spec/paths/activity/_id/getActivity.yaml @@ -0,0 +1,41 @@ +summary: Retrieve an Activity Action +description: Retrieves the details of an existing activity action. +operationId: getActivity +parameters: +- $ref: ../../../components/parameters.yaml#/Id +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Activity.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Activity +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readActivity } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readActivity(activity_id, query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + activity_by_id(id: ID!): directus_activity + } diff --git a/api-spec/paths/activity/_id/index.yaml b/api-spec/paths/activity/_id/index.yaml new file mode 100644 index 00000000..985bf563 --- /dev/null +++ b/api-spec/paths/activity/_id/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: getActivity.yaml diff --git a/api-spec/paths/activity/getActivities.yaml b/api-spec/paths/activity/getActivities.yaml new file mode 100644 index 00000000..a2d14370 --- /dev/null +++ b/api-spec/paths/activity/getActivities.yaml @@ -0,0 +1,49 @@ +summary: List Activity Actions +operationId: getActivities +description: Returns a list of activity actions. +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Activity.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + description: Successful request + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Activity +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readActivities } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readActivities(query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + activity: [directus_activity] + } diff --git a/api-spec/paths/activity/index.yaml b/api-spec/paths/activity/index.yaml new file mode 100644 index 00000000..b05679c7 --- /dev/null +++ b/api-spec/paths/activity/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: getActivities.yaml diff --git a/api-spec/paths/assets/_id/getAsset.yaml b/api-spec/paths/assets/_id/getAsset.yaml new file mode 100644 index 00000000..d97703d3 --- /dev/null +++ b/api-spec/paths/assets/_id/getAsset.yaml @@ -0,0 +1,50 @@ +summary: Get an Asset +security: [] +tags: +- Assets +operationId: getAsset +description: Image typed files can be retrieved, dynamically resized and transformed to fit any + need. +parameters: +- name: id + in: path + description: The id of the file. + required: true + schema: + type: string +- name: key + in: query + description: The key of the asset size configured in settings. + schema: + type: string +- name: transforms + in: query + description: A JSON array of image transformations. + schema: + type: string +- name: download + in: query + description: Download the asset to your computer + schema: + type: boolean +responses: + '200': + description: Successful request + content: + text/plain: + schema: + type: string + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readAssetRaw } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readAssetRaw('', { key: '' })); + - label: GraphQL + lang: GraphQL + source: Not available in Directus SDK/GraphQL diff --git a/api-spec/paths/assets/_id/index.yaml b/api-spec/paths/assets/_id/index.yaml new file mode 100644 index 00000000..1138df10 --- /dev/null +++ b/api-spec/paths/assets/_id/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: getAsset.yaml diff --git a/api-spec/paths/auth/login/index.yaml b/api-spec/paths/auth/login/index.yaml new file mode 100644 index 00000000..32141b2b --- /dev/null +++ b/api-spec/paths/auth/login/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: login.yaml diff --git a/api-spec/paths/auth/login/login.yaml b/api-spec/paths/auth/login/login.yaml new file mode 100644 index 00000000..1b2d7f80 --- /dev/null +++ b/api-spec/paths/auth/login/login.yaml @@ -0,0 +1,85 @@ +summary: Login +description: Authenticate as a user. +operationId: login +requestBody: + content: + application/json: + schema: + type: object + required: + - email + - password + properties: + email: + type: string + example: admin@example.com + description: Email address of the user you're logging in as. + for. + password: + type: string + description: Password of the user. + format: password + example: password + mode: + type: string + enum: + - json + - cookie + - session + default: json + description: Whether to retrieve the refresh token in the JSON response, + or in a `httpOnly` cookie. + otp: + type: string + description: The user's one-time-password (if MFA is enabled). +responses: + '200': + description: Successful authentification + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + access_token: + type: string + example: eyJhbGciOiJI... + expires: + type: integer + example: 900 + refresh_token: + type: string + example: yuOJkjdPXMd... + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Authentication +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, authentication, rest, login } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(authentication('json')).with(rest()); + + // login using the authentication composable + const result = await client.login(email, password); + + // login http request + const result = await client.request(login(email, password)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + mutation { + auth_login(email: "user_email", password: "user_password") { + access_token + refresh_token + } + } diff --git a/api-spec/paths/auth/logout/index.yaml b/api-spec/paths/auth/logout/index.yaml new file mode 100644 index 00000000..565859e9 --- /dev/null +++ b/api-spec/paths/auth/logout/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: logout.yaml diff --git a/api-spec/paths/auth/logout/logout.yaml b/api-spec/paths/auth/logout/logout.yaml new file mode 100644 index 00000000..c4767c97 --- /dev/null +++ b/api-spec/paths/auth/logout/logout.yaml @@ -0,0 +1,59 @@ +summary: Logout +description: Invalidate the refresh token thus destroying the user's session. +operationId: logout +requestBody: + content: + application/json: + schema: + type: object + properties: + refresh_token: + type: string + example: eyJ0eXAiOiJKV... + description: The refresh token to invalidate. If you have the refresh + token in a cookie through /auth/login, you don't have to submit it here. + mode: + type: string + enum: + - json + - cookie + - session + description: Whether the refresh token is submitted in the JSON response, + or in a `httpOnly` cookie. +responses: + '204': + description: Successful request, empty body + content: + application/json: + schema: + type: object + properties: + data: {} + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Authentication +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, authentication, rest, logout } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(authentication()).with(rest()); + + // logout using the authentication composable + const result = await client.logout(); + + // logout http request + const result = await client.request(logout(refresh_token)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + mutation { + auth_logout(refresh_token: "refresh_token") + } diff --git a/api-spec/paths/auth/oauth/_provider/index.yaml b/api-spec/paths/auth/oauth/_provider/index.yaml new file mode 100644 index 00000000..20997031 --- /dev/null +++ b/api-spec/paths/auth/oauth/_provider/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: oauthProvider.yaml diff --git a/api-spec/paths/auth/oauth/_provider/oauthProvider.yaml b/api-spec/paths/auth/oauth/_provider/oauthProvider.yaml new file mode 100644 index 00000000..824227d7 --- /dev/null +++ b/api-spec/paths/auth/oauth/_provider/oauthProvider.yaml @@ -0,0 +1,37 @@ +summary: Login Using an OAuth Provider +description: Start OAuth flow using the specified provider. +operationId: oauthProvider +parameters: +- name: provider + in: path + description: Key of the activated OAuth provider. + required: true + schema: + type: string +- name: redirect + in: query + required: false + description: Where to redirect on successful login.
If set the authentication + details are set inside cookies otherwise a JSON is returned. + schema: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + public: + type: boolean + data: + type: object + properties: + token: + type: string + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Authentication diff --git a/api-spec/paths/auth/oauth/index.yaml b/api-spec/paths/auth/oauth/index.yaml new file mode 100644 index 00000000..2cfea1e0 --- /dev/null +++ b/api-spec/paths/auth/oauth/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: oauth.yaml diff --git a/api-spec/paths/auth/oauth/oauth.yaml b/api-spec/paths/auth/oauth/oauth.yaml new file mode 100644 index 00000000..516cad37 --- /dev/null +++ b/api-spec/paths/auth/oauth/oauth.yaml @@ -0,0 +1,37 @@ +summary: List Auth Providers +security: [] +tags: +- Authentication +operationId: oauth +description: List all the configured auth providers. +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + public: + type: boolean + data: + type: array + example: + - github + - facebook + items: + type: string + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readProviders } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readProviders()); + - label: GraphQL + lang: GraphQL + source: Not available in GraphQL diff --git a/api-spec/paths/auth/password/request/index.yaml b/api-spec/paths/auth/password/request/index.yaml new file mode 100644 index 00000000..03ce820b --- /dev/null +++ b/api-spec/paths/auth/password/request/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: passwordRequest.yaml diff --git a/api-spec/paths/auth/password/request/passwordRequest.yaml b/api-spec/paths/auth/password/request/passwordRequest.yaml new file mode 100644 index 00000000..7bfa2e73 --- /dev/null +++ b/api-spec/paths/auth/password/request/passwordRequest.yaml @@ -0,0 +1,51 @@ +summary: Request a Password Reset +operationId: passwordRequest +description: Request a reset password email to be sent. +requestBody: + content: + application/json: + schema: + type: object + required: + - email + properties: + email: + type: string + example: admin@example.com + description: Email address of the user you're requesting a reset for. + reset_url: + type: string + description: Provide a custom reset url which the link in the email will lead to. The reset token will be passed as a parameter. You need to configure the `PASSWORD_RESET_URL_ALLOW_LIST` environment variable to enable this feature. +responses: + '204': + description: Successful request, empty body + content: + application/json: + schema: + type: object + properties: + data: {} + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Authentication +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, passwordRequest } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(passwordRequest(user_email)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + mutation { + auth_password_request(email: "user_email") + } diff --git a/api-spec/paths/auth/password/reset/index.yaml b/api-spec/paths/auth/password/reset/index.yaml new file mode 100644 index 00000000..ae11c481 --- /dev/null +++ b/api-spec/paths/auth/password/reset/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: passwordReset.yaml diff --git a/api-spec/paths/auth/password/reset/passwordReset.yaml b/api-spec/paths/auth/password/reset/passwordReset.yaml new file mode 100644 index 00000000..95d6958a --- /dev/null +++ b/api-spec/paths/auth/password/reset/passwordReset.yaml @@ -0,0 +1,55 @@ +summary: Reset a Password +operationId: passwordReset +description: The request a password reset endpoint sends an email with a link to the + admin app which in turn uses this endpoint to allow the user to reset their password. +requestBody: + content: + application/json: + schema: + type: object + required: + - token + - password + properties: + token: + type: string + example: eyJ0eXAiOiJKV1Qi... + description: One-time use JWT token that is used to verify the user, as provided in the email sent by the request endpoint. + password: + type: string + example: password + format: password + description: New password for the user. +responses: + '204': + description: Successful request, empty body + content: + application/json: + schema: + type: object + properties: + data: {} + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Authentication +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, passwordReset } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(passwordReset(reset_token, new_password)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + mutation { + auth_password_reset(token: "password_reset_token", password: "password") + } diff --git a/api-spec/paths/auth/refresh/index.yaml b/api-spec/paths/auth/refresh/index.yaml new file mode 100644 index 00000000..abe63c27 --- /dev/null +++ b/api-spec/paths/auth/refresh/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: refresh.yaml diff --git a/api-spec/paths/auth/refresh/refresh.yaml b/api-spec/paths/auth/refresh/refresh.yaml new file mode 100644 index 00000000..e23d1e41 --- /dev/null +++ b/api-spec/paths/auth/refresh/refresh.yaml @@ -0,0 +1,75 @@ +summary: Refresh Token +description: Retrieve a new access token using a refresh token. +security: [] +tags: +- Authentication +operationId: refresh +requestBody: + content: + application/json: + schema: + type: object + properties: + refresh_token: + type: string + example: eyJ0eXAiOiJKV... + description: JWT access token you want to refresh. This token can't be + expired. + mode: + type: string + enum: + - json + - cookie + - session + default: json + description: Whether to submit and retrieve the refresh token in the JSON + response, or in a `httpOnly` cookie. +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + access_token: + type: string + example: eyJhbGciOiJI... + expires: + type: integer + example: 900 + refresh_token: + type: string + example: Gy-caJMpmGTA... + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, authentication, rest, refresh } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(authentication()).with(rest()); + + // refresh using the authentication composable + const result = await client.refresh(); + + // refresh http request using a cookie + const result = await client.request(refresh('cookie')); + + // refresh http request using json + const result = await client.request(refresh('json', refresh_token)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + mutation { + auth_refresh(refresh_token: "refresh_token", mode: refresh_mode) { + access_token + refresh_token + } + } diff --git a/api-spec/paths/collections/_id/deleteCollection.yaml b/api-spec/paths/collections/_id/deleteCollection.yaml new file mode 100644 index 00000000..d33dd62f --- /dev/null +++ b/api-spec/paths/collections/_id/deleteCollection.yaml @@ -0,0 +1,38 @@ +summary: Delete a Collection +description: 'Delete an existing collection. Warning: This will delete the whole collection, + including the items within. Proceed with caution.' +operationId: deleteCollection +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Collections +parameters: +- name: id + in: path + required: true + description: Unique identifier of the collection. + schema: + type: string +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteCollection } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteCollection(collection_name)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_collections_item(collection: String!): delete_collection + } diff --git a/api-spec/paths/collections/_id/getCollection.yaml b/api-spec/paths/collections/_id/getCollection.yaml new file mode 100644 index 00000000..d151e57e --- /dev/null +++ b/api-spec/paths/collections/_id/getCollection.yaml @@ -0,0 +1,45 @@ +summary: Retrieve a Collection +description: Retrieves the details of a single collection. +operationId: getCollection +parameters: +- name: id + in: path + required: true + description: Unique identifier of the collection. + schema: + type: string +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Collections.yaml + description: Successful request + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Collections +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readCollection } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readCollection(collection_name)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + collections_by_name(name: String!): directus_collections + } diff --git a/api-spec/paths/collections/_id/index.yaml b/api-spec/paths/collections/_id/index.yaml new file mode 100644 index 00000000..63fd9689 --- /dev/null +++ b/api-spec/paths/collections/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getCollection.yaml +patch: + $ref: updateCollection.yaml +delete: + $ref: deleteCollection.yaml diff --git a/api-spec/paths/collections/_id/updateCollection.yaml b/api-spec/paths/collections/_id/updateCollection.yaml new file mode 100644 index 00000000..9c0c4872 --- /dev/null +++ b/api-spec/paths/collections/_id/updateCollection.yaml @@ -0,0 +1,126 @@ +summary: Update a Collection +description: | + Update the metadata for an existing collection. + + You can only update the `meta` values of the collection object. Updating the collection name is not supported at this time. +operationId: updateCollection +parameters: +- name: id + in: path + required: true + description: Unique identifier of the collection. + schema: + type: string +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + type: object + properties: + meta: + type: object + description: Metadata of the collection. + properties: + icon: + type: string + description: Name of a Google Material Design Icon that's assigned + to this collection. + example: people + nullable: true + color: + type: string + description: Choose the color for the icon assigned to this collection. + example: '#6644ff' + nullable: true + note: + type: string + description: A note describing the collection. + example: + nullable: true + display_template: + type: string + description: Text representation of how items from this collection + are shown across the system. + example: + nullable: true + hidden: + type: boolean + description: Whether or not the collection is hidden from the navigation + in the admin app. + example: false + singleton: + type: boolean + description: Whether or not the collection is treated as a single + object. + example: false + translation: + type: string + description: Key value pairs of how to show this collection's name + in different languages in the admin app. + example: + nullable: true + versioning: + type: boolean + description: Whether or not Content Versioning is enabled for this + collection. + example: false + archive_field: + type: string + description: What field holds the archive value. + example: + nullable: true + archive_app_filter: + type: string + description: What value to use for "archived" items. + example: + nullable: true + archive_value: + type: string + description: What value to use to "unarchive" items. + example: + nullable: true + unarchive_value: + type: string + description: Whether or not to show the "archived" filter. + example: + nullable: true + sort_field: + type: string + description: The sort field in the collection. + example: + nullable: true +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Collections.yaml + description: Successful request + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Collections +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateCollection } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateCollection(collection_name, partial_collection_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_collections_item(collection: String!, data: update_directus_collections_input!): directus_collections + } diff --git a/api-spec/paths/collections/createCollection.yaml b/api-spec/paths/collections/createCollection.yaml new file mode 100644 index 00000000..83474ac9 --- /dev/null +++ b/api-spec/paths/collections/createCollection.yaml @@ -0,0 +1,127 @@ +summary: Create a Collection +description: | + Create a new collection in Directus. + + The `collection` and `schema` properties are required. To create a collection folder that doesn't have an underlying table, you can set `schema` to `null`. + + You are able to provide an array of `fields` to be created during the creation of the collection. See the fields object for more information on what properties are available in a field. +operationId: createCollection +parameters: +- $ref: ../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + type: object + required: + - collection + - fields + properties: + collection: + type: string + description: Unique name of the collection. + example: my_collection + fields: + type: array + description: The fields contained in this collection. See the fields reference + for more information. Each individual field requires field, type, and + interface to be provided. + items: + type: object + icon: + type: string + description: Name of a Google Material Design Icon that's assigned to + this collection. + example: people + nullable: true + note: + type: string + description: A note describing the collection. + example: + nullable: true + display_template: + type: string + description: Text representation of how items from this collection are + shown across the system. + example: + nullable: true + hidden: + type: boolean + description: Whether or not the collection is hidden from the navigation + in the admin app. + example: false + singleton: + type: boolean + description: Whether or not the collection is treated as a single object. + example: false + translation: + type: string + description: Key value pairs of how to show this collection's name in + different languages in the admin app. + example: + nullable: true + versioning: + type: boolean + description: Whether or not Content Versioning is enabled for this collection. + example: false + archive_field: + type: string + description: What field holds the archive value. + example: + nullable: true + archive_app_filter: + type: string + description: What value to use for "archived" items. + example: + nullable: true + archive_value: + type: string + description: What value to use to "unarchive" items. + example: + nullable: true + unarchive_value: + type: string + description: Whether or not to show the "archived" filter. + example: + nullable: true + sort_field: + type: string + description: The sort field in the collection. + example: + nullable: true +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../components/schemas/Collections.yaml + description: Successful request + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Collections +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createCollection } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request( + createCollection(collection_object) + ); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + create_collections_item(data: directus_collections): directus_collections + } diff --git a/api-spec/paths/collections/getCollections.yaml b/api-spec/paths/collections/getCollections.yaml new file mode 100644 index 00000000..b6f2e123 --- /dev/null +++ b/api-spec/paths/collections/getCollections.yaml @@ -0,0 +1,42 @@ +summary: List Collections +description: Returns a list of the collections available in the project. +operationId: getCollections +parameters: +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Collections.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Collections +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readCollections } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readCollections()); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + collections: [directus_collections] + } diff --git a/api-spec/paths/collections/index.yaml b/api-spec/paths/collections/index.yaml new file mode 100644 index 00000000..3e1ce06f --- /dev/null +++ b/api-spec/paths/collections/index.yaml @@ -0,0 +1,4 @@ +get: + $ref: getCollections.yaml +post: + $ref: createCollection.yaml diff --git a/api-spec/paths/comments/_id/deleteComment.yaml b/api-spec/paths/comments/_id/deleteComment.yaml new file mode 100644 index 00000000..827c4097 --- /dev/null +++ b/api-spec/paths/comments/_id/deleteComment.yaml @@ -0,0 +1,32 @@ +summary: Delete a Comment +description: Delete an existing comment. Deleted comments can not be retrieved. +operationId: deleteComment +parameters: +- $ref: ../../../components/parameters.yaml#/Id +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Comments +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteComment } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteComment(comment_id)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_comment(id: ID): delete_one + } diff --git a/api-spec/paths/comments/_id/getComment.yaml b/api-spec/paths/comments/_id/getComment.yaml new file mode 100644 index 00000000..c2b02f24 --- /dev/null +++ b/api-spec/paths/comments/_id/getComment.yaml @@ -0,0 +1,39 @@ +summary: Get Comment by ID +description: Returns a single comment by primary key. +operationId: getComment +parameters: +- $ref: ../../../components/parameters.yaml#/Id +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Comments.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Comments +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readComment } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readComment(comment_id, query_object)); +- label: GraphQL + lang: GraphQL + source: | + type Query { + comment_by_id(id: ID!): directus_comments + } diff --git a/api-spec/paths/comments/_id/index.yaml b/api-spec/paths/comments/_id/index.yaml new file mode 100644 index 00000000..c8bd2274 --- /dev/null +++ b/api-spec/paths/comments/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getComment.yaml +patch: + $ref: updateComment.yaml +delete: + $ref: deleteComment.yaml diff --git a/api-spec/paths/comments/_id/updateComment.yaml b/api-spec/paths/comments/_id/updateComment.yaml new file mode 100644 index 00000000..7dddc0ff --- /dev/null +++ b/api-spec/paths/comments/_id/updateComment.yaml @@ -0,0 +1,46 @@ +summary: Update a Comment +description: Update the content of an existing comment. +operationId: updateComment +parameters: +- $ref: ../../../components/parameters.yaml#/Id +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../../components/schemas/Comments.yaml +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Activity.yaml + description: Successful request + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Comments +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateComment } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateComment(comment_id, partial_comment_object)); + - label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_comments_item(id: ID!, data: update_directus_comments_input): directus_comments + } diff --git a/api-spec/paths/comments/createComments.yaml b/api-spec/paths/comments/createComments.yaml new file mode 100644 index 00000000..ab7b75c5 --- /dev/null +++ b/api-spec/paths/comments/createComments.yaml @@ -0,0 +1,59 @@ +summary: Create Multiple comments +description: Create multiple new comments. +operationId: createComments +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Comments.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Comments.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Comments +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createComments } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createComments(comments_object_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + create_comments_items(data: [create_directus_comments_input!]!): [directus_comments] + } diff --git a/api-spec/paths/comments/deleteComments.yaml b/api-spec/paths/comments/deleteComments.yaml new file mode 100644 index 00000000..be4769a7 --- /dev/null +++ b/api-spec/paths/comments/deleteComments.yaml @@ -0,0 +1,39 @@ + +summary: Delete Multiple Comments +description: Delete multiple existing Comments. +operationId: deleteComments +requestBody: + description: An array of comment primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Comments +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteComments } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteComments(comment_id_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_Comments_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/comments/getComments.yaml b/api-spec/paths/comments/getComments.yaml new file mode 100644 index 00000000..fb76b414 --- /dev/null +++ b/api-spec/paths/comments/getComments.yaml @@ -0,0 +1,48 @@ + +summary: Get Comments +description: Returns a list of comments. +operationId: getComments +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Comments.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + description: Successful request + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Comments +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readComments } from '@directus/sdk'; + + const client = createDirectus('directus_comment_example').with(rest()); + + const result = await client.request(readComments(query)); +- label: GraphQL + lang: GraphQL + source: | + type Query { + flows: [directus_comments] + } diff --git a/api-spec/paths/comments/index.yaml b/api-spec/paths/comments/index.yaml new file mode 100644 index 00000000..a7cbc056 --- /dev/null +++ b/api-spec/paths/comments/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getComments.yaml +post: + $ref: createComments.yaml +patch: + $ref: updateComments.yaml +delete: + $ref: deleteComments.yaml diff --git a/api-spec/paths/comments/updateComments.yaml b/api-spec/paths/comments/updateComments.yaml new file mode 100644 index 00000000..1e5c66a1 --- /dev/null +++ b/api-spec/paths/comments/updateComments.yaml @@ -0,0 +1,62 @@ + +summary: Update Multiple comments +description: Update multiple existing comments. +operationId: updateComments +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../components/schemas/Comments.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Comments.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Comments +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateComments } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateComments(comments_id_array, partial_comment_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_comments_items(ids: [ID!]!, data: update_directus_comments_input): [directus_comments] + } diff --git a/api-spec/paths/dashboards/_id/deleteDashboard.yaml b/api-spec/paths/dashboards/_id/deleteDashboard.yaml new file mode 100644 index 00000000..43ed59ca --- /dev/null +++ b/api-spec/paths/dashboards/_id/deleteDashboard.yaml @@ -0,0 +1,36 @@ + +summary: Delete a Dashboard +description: Delete an existing dashboard. +operationId: deleteDashboard +parameters: +- name: id + in: path + description: Unique identifier of the dashboard. + required: true + schema: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Dashboards +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteDashboard } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteDashboard(dashboard_id)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + delete_dashboards_item(id: ID!): delete_one + } diff --git a/api-spec/paths/dashboards/_id/getDashboard.yaml b/api-spec/paths/dashboards/_id/getDashboard.yaml new file mode 100644 index 00000000..17ff516b --- /dev/null +++ b/api-spec/paths/dashboards/_id/getDashboard.yaml @@ -0,0 +1,44 @@ +summary: Retrieve a Dashboard +description: List an existing dashboard by primary key. +operationId: getDashboard +parameters: +- name: id + in: path + description: Unique identifier of the Dashboard. + schema: + type: string + required: true +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Dashboards.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Dashboards +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readDashboard } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readDashboard(dashboard_id, query_object)); + - label: GraphQL + lang: GraphQL + source: | + type Query { + dashboards_by_id(id: ID!): directus_dashboards + } diff --git a/api-spec/paths/dashboards/_id/index.yaml b/api-spec/paths/dashboards/_id/index.yaml new file mode 100644 index 00000000..d26268ce --- /dev/null +++ b/api-spec/paths/dashboards/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getDashboard.yaml +patch: + $ref: updateDashboard.yaml +delete: + $ref: deleteDashboard.yaml diff --git a/api-spec/paths/dashboards/_id/updateDashboard.yaml b/api-spec/paths/dashboards/_id/updateDashboard.yaml new file mode 100644 index 00000000..27040fd1 --- /dev/null +++ b/api-spec/paths/dashboards/_id/updateDashboard.yaml @@ -0,0 +1,50 @@ +summary: Update a Dashboard +description: Update an existing dashboard. +operationId: updateDashboard +parameters: +- name: id + in: path + description: Unique identifier of the dashboard. + schema: + type: string + required: true +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../../components/schemas/Dashboards.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Dashboards.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Dashboards +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateDashboard } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateDashboard(dashboard_id, partial_dashboard_object)); + - label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_dashboards_item(id: ID!, data: update_directus_dashboards_input): directus_dashboards + } diff --git a/api-spec/paths/dashboards/createDashboards.yaml b/api-spec/paths/dashboards/createDashboards.yaml new file mode 100644 index 00000000..a0e6c778 --- /dev/null +++ b/api-spec/paths/dashboards/createDashboards.yaml @@ -0,0 +1,57 @@ +summary: Create Multiple Dashboards +description: Create multiple new dashboards. +operationId: createDashboards +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Dashboards.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Dashboards.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Dashboards +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createDashboards } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createDashboards(dashboard_object_array)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + create_dashboards_items(data: [create_directus_dashboards_input!]!): [directus_dashboards] + } diff --git a/api-spec/paths/dashboards/deleteDashboards.yaml b/api-spec/paths/dashboards/deleteDashboards.yaml new file mode 100644 index 00000000..bb86d021 --- /dev/null +++ b/api-spec/paths/dashboards/deleteDashboards.yaml @@ -0,0 +1,37 @@ + +summary: Delete Multiple Dashboards +description: Delete multiple existing dashboards. +operationId: deleteDashboards +requestBody: + description: An array of dashboard primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Dashboards +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteDashboards } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteDashboards(dashboard_id_array)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + delete_dashboards_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/dashboards/getDashboards.yaml b/api-spec/paths/dashboards/getDashboards.yaml new file mode 100644 index 00000000..2eb8c443 --- /dev/null +++ b/api-spec/paths/dashboards/getDashboards.yaml @@ -0,0 +1,49 @@ + +summary: List Dashboards +description: List all dashboards that exist in Directus. +operationId: getDashboards +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Page +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Dashboards.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Dashboards +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, (readDashboards } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readDashboards(query_object)); +- label: GraphQL + lang: GraphQL + source: | + type Query { + dashboards: [directus_dashboards] + } diff --git a/api-spec/paths/dashboards/index.yaml b/api-spec/paths/dashboards/index.yaml new file mode 100644 index 00000000..9b328ed0 --- /dev/null +++ b/api-spec/paths/dashboards/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getDashboards.yaml +post: + $ref: createDashboards.yaml +patch: + $ref: updateDashboards.yaml +delete: + $ref: deleteDashboards.yaml diff --git a/api-spec/paths/dashboards/updateDashboards.yaml b/api-spec/paths/dashboards/updateDashboards.yaml new file mode 100644 index 00000000..60c6dbe8 --- /dev/null +++ b/api-spec/paths/dashboards/updateDashboards.yaml @@ -0,0 +1,63 @@ + +summary: Update Multiple Dashboards +description: Update multiple dashboards at the same time. +operationId: updateDashboards +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - data + - keys + properties: + data: + $ref: ../../components/schemas/Dashboards.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Dashboards.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Dashboards +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateDashboards } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateDashboards(dashboard_id_array, partial_dashboard_object)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_dashboards_items(ids: [ID!]!, data: update_directus_dashboards_input): [directus_dashboards] + } diff --git a/api-spec/paths/extensions/_bundle/_name/index.yaml b/api-spec/paths/extensions/_bundle/_name/index.yaml new file mode 100644 index 00000000..21c418d0 --- /dev/null +++ b/api-spec/paths/extensions/_bundle/_name/index.yaml @@ -0,0 +1,2 @@ +patch: + $ref: updateExtensionBundle.yaml diff --git a/api-spec/paths/extensions/_bundle/_name/updateExtensionBundle.yaml b/api-spec/paths/extensions/_bundle/_name/updateExtensionBundle.yaml new file mode 100644 index 00000000..aeec9ec3 --- /dev/null +++ b/api-spec/paths/extensions/_bundle/_name/updateExtensionBundle.yaml @@ -0,0 +1,61 @@ +summary: Update an Extension Bundle +description: Update an existing extension bundle. +operationId: updateExtensionBundle +parameters: +- in: path + name: bundle + required: true + schema: + type: string +- in: path + name: name + required: true + schema: + type: string +requestBody: + content: + application/json: + schema: + type: object + properties: + meta: + type: object + description: Directus metadata for the extension. Where the configuration + for the extension in the current project is stored. + properties: + enabled: + type: boolean + description: Whether or not the extension is enabled. + example: true +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../../components/schemas/Extensions.yaml + description: Successful request + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Extensions +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateExtension } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateExtension(bundle, name, partial_extension_object)); + - label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_extensions_item(bundle: String, name: String!, data: update_directus_extensions_input!): directus_extensions + } diff --git a/api-spec/paths/extensions/_name/index.yaml b/api-spec/paths/extensions/_name/index.yaml new file mode 100644 index 00000000..1b969eb4 --- /dev/null +++ b/api-spec/paths/extensions/_name/index.yaml @@ -0,0 +1,2 @@ +patch: + $ref: updateExtensions.yaml diff --git a/api-spec/paths/extensions/_name/updateExtensions.yaml b/api-spec/paths/extensions/_name/updateExtensions.yaml new file mode 100644 index 00000000..c1541bc4 --- /dev/null +++ b/api-spec/paths/extensions/_name/updateExtensions.yaml @@ -0,0 +1,58 @@ +summary: Update an Extension +description: Update an existing extension. +operationId: updateExtensions +parameters: +- in: path + name: name + required: true + schema: + type: string +requestBody: + content: + application/json: + schema: + type: object + properties: + meta: + type: object + description: Directus metadata for the extension. Where the configuration + for the extension in the current project is stored. + properties: + enabled: + type: boolean + description: Whether or not the extension is enabled. + example: true +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Extensions.yaml + description: Successful request + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Extensions +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateExtension } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateExtension(bundle, name, partial_extension_object)); + - label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_extensions_item(bundle: String, name: String!, data: update_directus_extensions_input!): directus_extensions + } diff --git a/api-spec/paths/extensions/index.yaml b/api-spec/paths/extensions/index.yaml new file mode 100644 index 00000000..889d8e08 --- /dev/null +++ b/api-spec/paths/extensions/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: listExtensions.yaml diff --git a/api-spec/paths/extensions/listExtensions.yaml b/api-spec/paths/extensions/listExtensions.yaml new file mode 100644 index 00000000..39ec67a0 --- /dev/null +++ b/api-spec/paths/extensions/listExtensions.yaml @@ -0,0 +1,37 @@ +summary: List Extensions +description: List the installed extensions and their configuration in the project. +operationId: listExtensions +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Extensions.yaml + description: Successful request + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Extensions +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readExtensions } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readExtensions()); + - label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + extensions: [extension] + } diff --git a/api-spec/paths/fields/_collection/_id/deleteField.yaml b/api-spec/paths/fields/_collection/_id/deleteField.yaml new file mode 100644 index 00000000..e65ea59d --- /dev/null +++ b/api-spec/paths/fields/_collection/_id/deleteField.yaml @@ -0,0 +1,43 @@ +summary: Delete a Field +description: Delete an existing field. This action can't be undone. +operationId: deleteField +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Fields +parameters: +- name: collection + in: path + description: Unique identifier of the collection the item resides in. + schema: + type: string + required: true +- name: id + in: path + description: Unique identifier of the field. + schema: + type: string + required: true +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteField } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteField(collection_name, field_name)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_fields_item(collection: String!, field: String!): delete_field + } diff --git a/api-spec/paths/fields/_collection/_id/getCollectionField.yaml b/api-spec/paths/fields/_collection/_id/getCollectionField.yaml new file mode 100644 index 00000000..b7214861 --- /dev/null +++ b/api-spec/paths/fields/_collection/_id/getCollectionField.yaml @@ -0,0 +1,50 @@ +summary: Retrieve a Field +description: Retrieves the details of a single field in a given collection. +operationId: getCollectionField +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../../components/schemas/Fields.yaml + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Fields +parameters: +- name: collection + in: path + description: Unique identifier of the collection the item resides in. + schema: + type: string + required: true +- name: id + in: path + description: Unique identifier of the field. + schema: + type: string + required: true +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readField } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readField(collection_name, field_name)); + - label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + fields_by_name(collection: String!, field: String!): directus_fields + } diff --git a/api-spec/paths/fields/_collection/_id/index.yaml b/api-spec/paths/fields/_collection/_id/index.yaml new file mode 100644 index 00000000..bc9b50f6 --- /dev/null +++ b/api-spec/paths/fields/_collection/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getCollectionField.yaml +patch: + $ref: updateField.yaml +delete: + $ref: deleteField.yaml diff --git a/api-spec/paths/fields/_collection/_id/updateField.yaml b/api-spec/paths/fields/_collection/_id/updateField.yaml new file mode 100644 index 00000000..6cdf2ab6 --- /dev/null +++ b/api-spec/paths/fields/_collection/_id/updateField.yaml @@ -0,0 +1,224 @@ +summary: Update a Field +description: Update an existing field. +operationId: updateField +requestBody: + content: + application/json: + schema: + type: object + properties: + type: + description: Directus specific data type. Used to cast values in the API. + example: integer + type: string + field: + type: string + description: Unique name of the field. Field name is unique within the + collection. + example: id + schema: + type: object + description: The schema info. + properties: + type: + description: The type of the field. + example: string + type: string + name: + type: string + description: The name of the field. + example: title + table: + type: string + description: The collection of the field. + example: posts + default_value: + type: string + description: The default value of the field. + example: + nullable: true + max_length: + type: integer + description: The max length of the field. + example: + nullable: true + is_nullable: + type: boolean + description: If the field is nullable. + example: false + is_primary_key: + type: boolean + description: If the field is primary key. + example: false + has_auto_increment: + type: boolean + description: If the field has auto increment. + example: false + foreign_key_column: + type: string + description: Related column from the foreign key constraint. + example: + nullable: true + foreign_key_table: + type: string + description: Related table from the foreign key constraint. + example: + nullable: true + comment: + type: string + description: Comment as saved in the database. + example: + nullable: true + schema: + type: string + description: Database schema (pg only). + example: public + foreign_key_schema: + type: string + description: Related schema from the foreign key constraint (pg only). + example: + nullable: true + meta: + type: object + description: The meta info. + nullable: true + properties: + id: + type: integer + description: Unique identifier for the field in the `directus_fields` + collection. + example: 3 + collection: + type: string + description: Unique name of the collection this field is in. + example: posts + field: + type: string + description: Unique name of the field. Field name is unique within + the collection. + example: title + special: + type: array + description: Transformation flag for field + example: + items: + type: string + nullable: true + system-interface: + type: string + description: What interface is used in the admin app to edit the value + for this field. + example: primary-key + nullable: true + options: + type: object + description: Options for the interface that's used. This format is + based on the individual interface. + example: + nullable: true + display: + type: string + description: What display is used in the admin app to display the + value for this field. + example: + nullable: true + display_options: + type: object + description: Options for the display that's used. This format is based + on the individual display. + example: + nullable: true + locked: + type: boolean + description: If the field can be altered by the end user. Directus + system fields have this value set to `true`. + example: true + readonly: + type: boolean + description: Prevents the user from editing the value in the field. + example: false + hidden: + type: boolean + description: If this field should be hidden. + example: true + sort: + type: integer + description: Sort order of this field on the edit page of the admin + app. + example: 1 + nullable: true + width: + type: string + description: Width of the field on the edit form. + example: + nullable: true + enum: + - half + - half-left + - half-right + - full + - fill + - + group: + type: integer + description: What field group this field is part of. + example: + nullable: true + translation: + type: object + description: 'Key value pair of `: ` that allows + the user to change the displayed name of the field in the admin + app.' + example: + nullable: true + note: + type: string + description: A user provided note for the field. Will be rendered + alongside the interface on the edit page. + example: '' + nullable: true +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../../components/schemas/Fields.yaml + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Fields +parameters: +- name: collection + in: path + description: Unique identifier of the collection the item resides in. + schema: + type: string + required: true +- name: id + in: path + description: Unique identifier of the field. + schema: + type: string + required: true +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateField } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateField(collection_name, field_name, partial_field_object)); + - label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_fields_item(collection: String!, field: String!, data: update_directus_fields_input!): directus_fields + } diff --git a/api-spec/paths/fields/_collection/createField.yaml b/api-spec/paths/fields/_collection/createField.yaml new file mode 100644 index 00000000..11e3bf66 --- /dev/null +++ b/api-spec/paths/fields/_collection/createField.yaml @@ -0,0 +1,231 @@ +summary: Create Field in Collection +description: Create a new field in a given collection. +operationId: createField +requestBody: + content: + application/json: + schema: + type: object + required: + - field + - datatype + - type + - length + properties: + type: + description: Directus specific data type. Used to cast values in the API. + example: integer + type: string + field: + type: string + description: Unique name of the field. Field name is unique within the + collection. + example: id + schema: + type: object + description: The schema info. + properties: + type: + description: The type of the field. + example: string + type: string + name: + type: string + description: The name of the field. + example: title + table: + type: string + description: The collection of the field. + example: posts + default_value: + type: string + description: The default value of the field. + example: + nullable: true + max_length: + type: integer + description: The max length of the field. + example: + nullable: true + is_nullable: + type: boolean + description: If the field is nullable. + example: false + is_primary_key: + type: boolean + description: If the field is primary key. + example: false + has_auto_increment: + type: boolean + description: If the field has auto increment. + example: false + foreign_key_column: + type: string + description: Related column from the foreign key constraint. + example: + nullable: true + foreign_key_table: + type: string + description: Related table from the foreign key constraint. + example: + nullable: true + comment: + type: string + description: Comment as saved in the database. + example: + nullable: true + schema: + type: string + description: Database schema (pg only). + example: public + foreign_key_schema: + type: string + description: Related schema from the foreign key constraint (pg only). + example: + nullable: true + meta: + type: object + description: The meta info. + nullable: true + properties: + id: + type: integer + description: Unique identifier for the field in the `directus_fields` + collection. + example: 3 + collection: + type: string + description: Unique name of the collection this field is in. + example: posts + field: + type: string + description: Unique name of the field. Field name is unique within + the collection. + example: title + special: + type: array + description: Transformation flag for field + example: + items: + type: string + nullable: true + system-interface: + type: string + description: What interface is used in the admin app to edit the value + for this field. + example: primary-key + nullable: true + options: + type: object + description: Options for the interface that's used. This format is + based on the individual interface. + example: + nullable: true + display: + type: string + description: What display is used in the admin app to display the + value for this field. + example: + nullable: true + display_options: + type: object + description: Options for the display that's used. This format is based + on the individual display. + example: + nullable: true + locked: + type: boolean + description: If the field can be altered by the end user. Directus + system fields have this value set to `true`. + example: true + readonly: + type: boolean + description: Prevents the user from editing the value in the field. + example: false + hidden: + type: boolean + description: If this field should be hidden. + example: true + sort: + type: integer + description: Sort order of this field on the edit page of the admin + app. + example: 1 + nullable: true + width: + type: string + description: Width of the field on the edit form. + example: + nullable: true + enum: + - half + - half-left + - half-right + - full + - fill + - + group: + type: integer + description: What field group this field is part of. + example: + nullable: true + translation: + type: object + description: 'Key value pair of `: ` that allows + the user to change the displayed name of the field in the admin + app.' + example: + nullable: true + note: + type: string + description: A user provided note for the field. Will be rendered + alongside the interface on the edit page. + example: '' + nullable: true +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Fields.yaml + description: Successful request + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Fields +parameters: +- description: Unique identifier of the collection the item resides in. + in: path + name: collection + required: true + schema: + type: string +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createField } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request( + createField(collection_name, { + field: field_name, + type: field_type, + field_field: value, + }) + ); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + create_fields_item(collection: String!, data: create_directus_fields_input!): directus_fields + } diff --git a/api-spec/paths/fields/_collection/getCollectionFields.yaml b/api-spec/paths/fields/_collection/getCollectionFields.yaml new file mode 100644 index 00000000..997b9e9d --- /dev/null +++ b/api-spec/paths/fields/_collection/getCollectionFields.yaml @@ -0,0 +1,47 @@ +summary: List Fields in Collection +description: Returns a list of the fields available in the given collection. +operationId: getCollectionFields +parameters: +- description: Unique identifier of the collection the item resides in. + in: path + name: collection + required: true + schema: + type: string +- $ref: ../../../components/parameters.yaml#/Sort +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../../components/schemas/Fields.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Fields +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readFieldsByCollection } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readFieldsByCollection(collection_name)); + - label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + fields_in_collection(collection: String!): directus_fields + } diff --git a/api-spec/paths/fields/_collection/index.yaml b/api-spec/paths/fields/_collection/index.yaml new file mode 100644 index 00000000..2f3bc207 --- /dev/null +++ b/api-spec/paths/fields/_collection/index.yaml @@ -0,0 +1,4 @@ +get: + $ref: getCollectionFields.yaml +post: + $ref: createField.yaml diff --git a/api-spec/paths/fields/getFields.yaml b/api-spec/paths/fields/getFields.yaml new file mode 100644 index 00000000..dcf49f2b --- /dev/null +++ b/api-spec/paths/fields/getFields.yaml @@ -0,0 +1,42 @@ +summary: List All Fields +description: Returns a list of the fields available in the project. +operationId: getFields +parameters: +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Sort +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Fields.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Fields +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readFields } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readFields()); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + fields: [directus_fields] + } diff --git a/api-spec/paths/fields/index.yaml b/api-spec/paths/fields/index.yaml new file mode 100644 index 00000000..bee5b769 --- /dev/null +++ b/api-spec/paths/fields/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: getFields.yaml diff --git a/api-spec/paths/files/_id/deleteFile.yaml b/api-spec/paths/files/_id/deleteFile.yaml new file mode 100644 index 00000000..1593b059 --- /dev/null +++ b/api-spec/paths/files/_id/deleteFile.yaml @@ -0,0 +1,30 @@ +summary: Delete a File +description: Delete an existing file. This will also delete the file from disk. +security: [] +tags: +- Files +operationId: deleteFile +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteFile } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteFile(file_id)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_files_item(id: ID!): delete_one + } diff --git a/api-spec/paths/files/_id/getFile.yaml b/api-spec/paths/files/_id/getFile.yaml new file mode 100644 index 00000000..876cf991 --- /dev/null +++ b/api-spec/paths/files/_id/getFile.yaml @@ -0,0 +1,37 @@ +summary: Retrieve a File +description: Retrieve a single file by primary key. +security: [] +tags: +- Files +operationId: getFile +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Files.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readFiles } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readFile(file_id, query_object)); + - label: GraphQL + lang: GraphQL + source: | + type Query { + files_by_id(id: ID!): directus_files + } diff --git a/api-spec/paths/files/_id/index.yaml b/api-spec/paths/files/_id/index.yaml new file mode 100644 index 00000000..141ffa40 --- /dev/null +++ b/api-spec/paths/files/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getFile.yaml +patch: + $ref: updateFile.yaml +delete: + $ref: deleteFile.yaml diff --git a/api-spec/paths/files/_id/updateFile.yaml b/api-spec/paths/files/_id/updateFile.yaml new file mode 100644 index 00000000..3a45e3a8 --- /dev/null +++ b/api-spec/paths/files/_id/updateFile.yaml @@ -0,0 +1,54 @@ +summary: Update a File +description: Update an existing file, and/or replace it's file contents. +security: [] +tags: +- Files +operationId: updateFile +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + multipart/data: + schema: + type: object + required: + - file + properties: + file: + description: File contents. + format: binary + application/json: + schema: + anyOf: + - $ref: ../../../components/schemas/Items.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Files.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateFile } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateFile(file_id, partial_file_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_files_item(id: ID!, data: update_directus_files_input!): directus_files + } diff --git a/api-spec/paths/files/deleteFiles.yaml b/api-spec/paths/files/deleteFiles.yaml new file mode 100644 index 00000000..a9ae9319 --- /dev/null +++ b/api-spec/paths/files/deleteFiles.yaml @@ -0,0 +1,40 @@ +summary: Delete Multiple Files +description: Delete multiple existing files at once. This will also delete the files from disk. +security: [] +tags: +- Files +operationId: deleteFiles +requestBody: + description: An array of file primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteFiles } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteFiles(file_id_array)); + + //or + + const result = await client.request(deleteFiles(query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_files_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/files/getFiles.yaml b/api-spec/paths/files/getFiles.yaml new file mode 100644 index 00000000..e12a45b6 --- /dev/null +++ b/api-spec/paths/files/getFiles.yaml @@ -0,0 +1,47 @@ +summary: List Files +description: List all files that exist in Directus. +security: [] +tags: +- Files +operationId: getFiles +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Files.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readFiles } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readFile(file_id, query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + files_by_id(id: ID!): directus_files + } diff --git a/api-spec/paths/files/import/importFile.yaml b/api-spec/paths/files/import/importFile.yaml new file mode 100644 index 00000000..8292e448 --- /dev/null +++ b/api-spec/paths/files/import/importFile.yaml @@ -0,0 +1,50 @@ +summary: Import a File +description: Import a file from the web +operationId: importFile +requestBody: + content: + application/json: + schema: + type: object + required: + - url + properties: + url: + type: string + description: The URL to download the file from. + anyOf: + - $ref: ../../components/schemas/Files.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../components/schemas/Files.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Files +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, importFile } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(importFile(file_url, file_object)); + + const result = await client.request(uploadFiles(formData)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + import_file(url: String!, data: create_directus_files_input!): directus_files + } diff --git a/api-spec/paths/files/import/index.yaml b/api-spec/paths/files/import/index.yaml new file mode 100644 index 00000000..ff6549c4 --- /dev/null +++ b/api-spec/paths/files/import/index.yaml @@ -0,0 +1,3 @@ +post: + $ref: importFile.yaml + diff --git a/api-spec/paths/files/index.yaml b/api-spec/paths/files/index.yaml new file mode 100644 index 00000000..2706eaee --- /dev/null +++ b/api-spec/paths/files/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getFiles.yaml +post: + $ref: uploadFile.yaml +patch: + $ref: updateFiles.yaml +delete: + $ref: deleteFiles.yaml diff --git a/api-spec/paths/files/updateFiles.yaml b/api-spec/paths/files/updateFiles.yaml new file mode 100644 index 00000000..7fe31929 --- /dev/null +++ b/api-spec/paths/files/updateFiles.yaml @@ -0,0 +1,65 @@ +summary: Update Multiple Files +description: Update multiple files at the same time. +security: [] +tags: +- Files +operationId: updateFiles +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - data + - keys + properties: + data: + type: object + properties: + data: + type: string + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Files.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateFiles } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateFiles(file_id_array, partial_file_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_files_items(ids: [ID!]!, data: update_directus_files!): [directus_files] + } diff --git a/api-spec/paths/files/uploadFile.yaml b/api-spec/paths/files/uploadFile.yaml new file mode 100644 index 00000000..90436515 --- /dev/null +++ b/api-spec/paths/files/uploadFile.yaml @@ -0,0 +1,43 @@ +summary: Upload a File +description: Upload a new file. +operationId: uploadFile +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../components/schemas/Files.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../components/schemas/Files.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Files +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, uploadFiles } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const formData = new FormData(); + formData.append('file_1_property', 'Value'); + formData.append('file', raw_file); + formData.append('file_2_property', 'Value'); + formData.append('file', raw_file_2); + + const result = await client.request(uploadFiles(formData)); +- label: GraphQL + lang: GraphQL + source: | + //Not currently supported by GraphQL. diff --git a/api-spec/paths/flows/_id/deleteFlow.yaml b/api-spec/paths/flows/_id/deleteFlow.yaml new file mode 100644 index 00000000..1bf128db --- /dev/null +++ b/api-spec/paths/flows/_id/deleteFlow.yaml @@ -0,0 +1,32 @@ +summary: Delete a Flow +description: Delete an existing flow +operationId: deleteFlow +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Flows +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteFlow } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteFlow(flow_id)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_flows_item(id: ID!): delete_one + } diff --git a/api-spec/paths/flows/_id/getFlow.yaml b/api-spec/paths/flows/_id/getFlow.yaml new file mode 100644 index 00000000..88c75fff --- /dev/null +++ b/api-spec/paths/flows/_id/getFlow.yaml @@ -0,0 +1,39 @@ +summary: Retrieve a Flow +description: Retrieve a single flow by unique identifier. +operationId: getFlow +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Flows.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Flows +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readFlow } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readFlow(flow_id, query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + flows_by_id(id: ID!): directus_flows + } diff --git a/api-spec/paths/flows/_id/index.yaml b/api-spec/paths/flows/_id/index.yaml new file mode 100644 index 00000000..1a52dac0 --- /dev/null +++ b/api-spec/paths/flows/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getFlow.yaml +patch: + $ref: updateFlow.yaml +delete: + $ref: deleteFlow.yaml diff --git a/api-spec/paths/flows/_id/updateFlow.yaml b/api-spec/paths/flows/_id/updateFlow.yaml new file mode 100644 index 00000000..e87fa3a5 --- /dev/null +++ b/api-spec/paths/flows/_id/updateFlow.yaml @@ -0,0 +1,47 @@ +summary: Update a Flow +description: Update an existing flow. +operationId: updateFlow +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../../components/schemas/Flows.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Flows.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Flows +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateFlow } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateFlow(flow_id, partial_flow_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_flows_item(id: ID!, data: update_directus_flows_input): directus_flows + } diff --git a/api-spec/paths/flows/createFlows.yaml b/api-spec/paths/flows/createFlows.yaml new file mode 100644 index 00000000..a38b931a --- /dev/null +++ b/api-spec/paths/flows/createFlows.yaml @@ -0,0 +1,59 @@ +summary: Create Multiple Flows +description: Create multiple new flows. +operationId: createFlows +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Flows.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Flows.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Flows +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createFlows } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createFlows(flows_object_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + create_flows_items(data: [create_directus_flows_input!]!): [directus_flows] + } diff --git a/api-spec/paths/flows/deleteFlows.yaml b/api-spec/paths/flows/deleteFlows.yaml new file mode 100644 index 00000000..381b5434 --- /dev/null +++ b/api-spec/paths/flows/deleteFlows.yaml @@ -0,0 +1,36 @@ +summary: Delete Multiple Flows +description: Delete multiple existing flows. +operationId: deleteFlows +requestBody: + description: An array of flows primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Flows +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteFlows } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteFlows(flow_id_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_flows_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/flows/getFlows.yaml b/api-spec/paths/flows/getFlows.yaml new file mode 100644 index 00000000..67b2f964 --- /dev/null +++ b/api-spec/paths/flows/getFlows.yaml @@ -0,0 +1,49 @@ +summary: List Flows +description: List all flows that exist in Directus. +operationId: getFlows +parameters: + - $ref: ../../components/parameters.yaml#/Fields + - $ref: ../../components/parameters.yaml#/Limit + - $ref: ../../components/parameters.yaml#/Offset + - $ref: ../../components/parameters.yaml#/Sort + - $ref: ../../components/parameters.yaml#/Filter + - $ref: ../../components/parameters.yaml#/Search + - $ref: ../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Flows.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Flows +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readFlows } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readFlows(query)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + flows: [directus_flows] + } diff --git a/api-spec/paths/flows/index.yaml b/api-spec/paths/flows/index.yaml new file mode 100644 index 00000000..28552ce9 --- /dev/null +++ b/api-spec/paths/flows/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getFlows.yaml +post: + $ref: createFlows.yaml +patch: + $ref: updateFlows.yaml +delete: + $ref: deleteFlows.yaml diff --git a/api-spec/paths/flows/trigger/_id/index.yaml b/api-spec/paths/flows/trigger/_id/index.yaml new file mode 100644 index 00000000..ad9ff77f --- /dev/null +++ b/api-spec/paths/flows/trigger/_id/index.yaml @@ -0,0 +1,4 @@ +get: + $ref: triggerFlowGET.yaml +post: + $ref: triggerFlowPOST.yaml diff --git a/api-spec/paths/flows/trigger/_id/triggerFlowGET.yaml b/api-spec/paths/flows/trigger/_id/triggerFlowGET.yaml new file mode 100644 index 00000000..0d898cf6 --- /dev/null +++ b/api-spec/paths/flows/trigger/_id/triggerFlowGET.yaml @@ -0,0 +1,36 @@ +summary: Flow with GET webhook trigger +description: Start a flow with GET webhook trigger. +operationId: triggerFlowGET +parameters: +- $ref: ../../../../components/parameters.yaml#/Id +- $ref: ../../../../components/parameters.yaml#/Fields +- $ref: ../../../../components/parameters.yaml#/Meta +responses: + '200': + description: Result of the flow, if any. + content: + application/json: + schema: + type: object + properties: + data: {} + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Flows +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, triggerFlow } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(triggerFlow('GET', flow_id, query_object)); +- label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/flows/trigger/_id/triggerFlowPOST.yaml b/api-spec/paths/flows/trigger/_id/triggerFlowPOST.yaml new file mode 100644 index 00000000..8cdeae32 --- /dev/null +++ b/api-spec/paths/flows/trigger/_id/triggerFlowPOST.yaml @@ -0,0 +1,44 @@ +summary: Flow with POST webhook trigger +description: Start a flow with POST webhook trigger. +operationId: triggerFlowPOST +parameters: + - $ref: ../../../../components/parameters.yaml#/Id + - $ref: ../../../../components/parameters.yaml#/Fields + - $ref: ../../../../components/parameters.yaml#/Meta +requestBody: + description: Payload for the POST request. + content: + application/json: + schema: + type: object + properties: + data: {} +responses: + '200': + description: Result of the flow, if any. + content: + application/json: + schema: + type: object + properties: + data: {} + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Flows +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, triggerFlow } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(triggerFlow('POST', flow_id, webhook_payload)); +- label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/flows/updateFlows.yaml b/api-spec/paths/flows/updateFlows.yaml new file mode 100644 index 00000000..c3eb9d8a --- /dev/null +++ b/api-spec/paths/flows/updateFlows.yaml @@ -0,0 +1,63 @@ +summary: Update Multiple Flows +description: Update multiple flows at the same time. +security: [] +tags: +- Flows +operationId: updateFlows +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - data + - keys + properties: + data: + anyOf: + - $ref: ../../components/schemas/Flows.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Flows.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateFlows } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateFlows(flow_id_array, partial_flow_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_flows_items(ids: [ID!]!, data: update_directus_flows_input): [directus_flows] + } diff --git a/api-spec/paths/folders/_id/deleteFolder.yaml b/api-spec/paths/folders/_id/deleteFolder.yaml new file mode 100644 index 00000000..07e6f6fa --- /dev/null +++ b/api-spec/paths/folders/_id/deleteFolder.yaml @@ -0,0 +1,32 @@ +summary: Delete a Folder +description: Delete an existing folder. Any files in this folder will be moved to the root folder. +operationId: deleteFolder +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Folders +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteFolder } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteFolder(folder_id)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_folders_item(id: ID!): delete_one + } diff --git a/api-spec/paths/folders/_id/getFolder.yaml b/api-spec/paths/folders/_id/getFolder.yaml new file mode 100644 index 00000000..55c35c97 --- /dev/null +++ b/api-spec/paths/folders/_id/getFolder.yaml @@ -0,0 +1,41 @@ +summary: Retrieve a Folder +description: List an existing folder by primary key. +operationId: getFolder +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Folders.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Folders +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readFolder } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readFolder(folder_id, query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + folders_by_id(id: ID!): directus_folders + } diff --git a/api-spec/paths/folders/_id/index.yaml b/api-spec/paths/folders/_id/index.yaml new file mode 100644 index 00000000..6501c995 --- /dev/null +++ b/api-spec/paths/folders/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getFolder.yaml +patch: + $ref: updateFolder.yaml +delete: + $ref: deleteFolder.yaml diff --git a/api-spec/paths/folders/_id/updateFolder.yaml b/api-spec/paths/folders/_id/updateFolder.yaml new file mode 100644 index 00000000..c771a896 --- /dev/null +++ b/api-spec/paths/folders/_id/updateFolder.yaml @@ -0,0 +1,55 @@ +summary: Update a Folder +description: Update an existing folder. +operationId: updateFolder +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + type: object + properties: + name: + type: string + description: Name of the folder. Can't be null or empty. + parent: + type: integer + example: 3 + description: Unique identifier of the parent folder. This allows for nested + folders. +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Folders.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Folders +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateFolder } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateFolder(folder_id, partial_folder_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_folders_item(id: ID!, data: update_directus_folders_input): directus_folders + } diff --git a/api-spec/paths/folders/createFolders.yaml b/api-spec/paths/folders/createFolders.yaml new file mode 100644 index 00000000..553534d3 --- /dev/null +++ b/api-spec/paths/folders/createFolders.yaml @@ -0,0 +1,59 @@ +summary: Create Multiple Folders +description: Create multiple new folders. +operationId: createFolders +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Folders.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Folders.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Folders +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createFolders } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createFolders(folder_object_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + create_folders_items(data: [create_directus_folders_input!]!): [directus_folders] + } diff --git a/api-spec/paths/folders/deleteFolders.yaml b/api-spec/paths/folders/deleteFolders.yaml new file mode 100644 index 00000000..a7138c4c --- /dev/null +++ b/api-spec/paths/folders/deleteFolders.yaml @@ -0,0 +1,36 @@ +summary: Delete Multiple Folders +description: Delete multiple existing folders. +operationId: deleteFolders +requestBody: + description: An array of folder primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Folders +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteFolders } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteFolders(folder_id_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_folders_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/folders/getFolders.yaml b/api-spec/paths/folders/getFolders.yaml new file mode 100644 index 00000000..61a7f5ed --- /dev/null +++ b/api-spec/paths/folders/getFolders.yaml @@ -0,0 +1,49 @@ +summary: List Folders +description: List all folders that exist in Directus. +operationId: getFolders +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Folders.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Folders +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readFolders } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readFolders(query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + folders: directus_folders + } diff --git a/api-spec/paths/folders/index.yaml b/api-spec/paths/folders/index.yaml new file mode 100644 index 00000000..657aae67 --- /dev/null +++ b/api-spec/paths/folders/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getFolders.yaml +post: + $ref: createFolders.yaml +patch: + $ref: updateFolders.yaml +delete: + $ref: deleteFolders.yaml diff --git a/api-spec/paths/folders/updateFolders.yaml b/api-spec/paths/folders/updateFolders.yaml new file mode 100644 index 00000000..70658639 --- /dev/null +++ b/api-spec/paths/folders/updateFolders.yaml @@ -0,0 +1,76 @@ +summary: Update Multiple Folders +description: | + Update multiple folders at the same time. + + Any files in these folders will be moved to the root folder. +security: [] +tags: +- Folders +operationId: updateFolders +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - data + - keys + properties: + data: + type: object + properties: + name: + type: string + example: Amsterdam + description: Name of the folder. + parent: + type: integer + description: Unique identifier of the parent folder. This allows for + nested folders. + required: + - name + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Folders.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateFolders } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateFolders(folder_id_array, partial_folder_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_folders_items(ids: [ID!]!, data: update_directus_folders_input): [directus_folders] + } diff --git a/api-spec/paths/items/_collection/_id/deleteItem.yaml b/api-spec/paths/items/_collection/_id/deleteItem.yaml new file mode 100644 index 00000000..e5e0887f --- /dev/null +++ b/api-spec/paths/items/_collection/_id/deleteItem.yaml @@ -0,0 +1,36 @@ +summary: Delete an item +description: Delete an existing item. +operationId: deleteItem +parameters: +- name: id + in: path + required: true + description: Unique identifier of the item. + schema: + type: string +- $ref: ../../../../components/parameters.yaml#/Collection +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Items +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteItem } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteItem(collection_name, item_id)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + delete__item(id: ID!): delete_one + } diff --git a/api-spec/paths/items/_collection/_id/getCollectionItem.yaml b/api-spec/paths/items/_collection/_id/getCollectionItem.yaml new file mode 100644 index 00000000..81839ef0 --- /dev/null +++ b/api-spec/paths/items/_collection/_id/getCollectionItem.yaml @@ -0,0 +1,45 @@ +summary: Retrieve an Item +description: Retrieves an item in a given collection. +operationId: getCollectionItem +parameters: +- $ref: ../../../../components/parameters.yaml#/Id +- $ref: ../../../../components/parameters.yaml#/Collection +- $ref: ../../../../components/parameters.yaml#/Version +- $ref: ../../../../components/parameters.yaml#/Fields +- $ref: ../../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../../components/schemas/Items.yaml + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Items +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readItem } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readItem(collection_name, item_id, query_object)); + - label: GraphQL + lang: GraphQL + source: | + type Query { + _by_id(id: ID!, version: String): + } + + type Query { + _by_version(id: ID!, version: String!): + } diff --git a/api-spec/paths/items/_collection/_id/index.yaml b/api-spec/paths/items/_collection/_id/index.yaml new file mode 100644 index 00000000..02d714a2 --- /dev/null +++ b/api-spec/paths/items/_collection/_id/index.yaml @@ -0,0 +1,7 @@ +get: + $ref: getCollectionItem.yaml +patch: + $ref: updateItem.yaml +delete: + $ref: deleteItem.yaml + diff --git a/api-spec/paths/items/_collection/_id/updateItem.yaml b/api-spec/paths/items/_collection/_id/updateItem.yaml new file mode 100644 index 00000000..5a1bc5ca --- /dev/null +++ b/api-spec/paths/items/_collection/_id/updateItem.yaml @@ -0,0 +1,51 @@ +summary: Update an item +description: Update an existing item. +operationId: updateItem +parameters: +- name: id + in: path + description: Unique identifier of the item. + required: true + schema: + type: string +- $ref: ../../../../components/parameters.yaml#/Collection +- $ref: ../../../../components/parameters.yaml#/Fields +- $ref: ../../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../../../components/schemas/Items.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../../components/schemas/Items.yaml + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Items +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateItem } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateItem(collection_name, item_id, partial_item_object)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + update__item(id: ID!, data: update__input!): + } diff --git a/api-spec/paths/items/_collection/createItems.yaml b/api-spec/paths/items/_collection/createItems.yaml new file mode 100644 index 00000000..2fc4f6bc --- /dev/null +++ b/api-spec/paths/items/_collection/createItems.yaml @@ -0,0 +1,59 @@ + +summary: Create Multiple Items +description: Create new items in the given collection. +operationId: createItems +parameters: +- $ref: ../../../components/parameters.yaml#/Collection +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Limit +- $ref: ../../../components/parameters.yaml#/Offset +- $ref: ../../../components/parameters.yaml#/Sort +- $ref: ../../../components/parameters.yaml#/Filter +- $ref: ../../../components/parameters.yaml#/Search +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../../components/schemas/Items.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../../components/schemas/Items.yaml + meta: + $ref: ../../../components/schemas/x-metadata.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Items +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createItems } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createItems(collection_name, item_object_array)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + create__items(data: [create__input]): [] + } diff --git a/api-spec/paths/items/_collection/deleteItems.yaml b/api-spec/paths/items/_collection/deleteItems.yaml new file mode 100644 index 00000000..9462ec49 --- /dev/null +++ b/api-spec/paths/items/_collection/deleteItems.yaml @@ -0,0 +1,59 @@ +summary: Delete Multiple Items +description: Delete multiple items at the same time. +operationId: deleteItems +parameters: +- $ref: ../../../components/parameters.yaml#/Collection +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Limit +- $ref: ../../../components/parameters.yaml#/Meta +- $ref: ../../../components/parameters.yaml#/Offset +- $ref: ../../../components/parameters.yaml#/Sort +- $ref: ../../../components/parameters.yaml#/Filter +- $ref: ../../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + anyOf: + - type: array + description: Primary keys of items to be deleted. + items: + type: string + - type: object + description: Object containing either `keys` or `query` to selected what items to update. + properties: + keys: + type: array + items: + type: string + items: + type: object +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Items +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteItems } from '@directus/sdk'; + + const client = createDirectus('https://directus.example.com').with(rest()); + + const result = await client.request(deleteItems(collection_name, item_id_array)); + + //or + + const result = await client.request(deleteItems(collection_name, query_object)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + delete__items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/items/_collection/getCollectionItems.yaml b/api-spec/paths/items/_collection/getCollectionItems.yaml new file mode 100644 index 00000000..c9adce0b --- /dev/null +++ b/api-spec/paths/items/_collection/getCollectionItems.yaml @@ -0,0 +1,51 @@ +summary: List all items in a collection. +description: Returns a list of the items in the given collection. +operationId: getCollectionItems +parameters: +- description: Unique identifier of the collection the item resides in. + in: path + name: collection + required: true + schema: + type: string +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Limit +- $ref: ../../../components/parameters.yaml#/Offset +- $ref: ../../../components/parameters.yaml#/Meta +- $ref: ../../../components/parameters.yaml#/Sort +- $ref: ../../../components/parameters.yaml#/Filter +- $ref: ../../../components/parameters.yaml#/Search +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../../components/schemas/Items.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Items +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readItems } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readItems('collection_name', query_object)); + - label: GraphQL + lang: GraphQL + source: | + type Query { + : [] + } diff --git a/api-spec/paths/items/_collection/index.yaml b/api-spec/paths/items/_collection/index.yaml new file mode 100644 index 00000000..f372168d --- /dev/null +++ b/api-spec/paths/items/_collection/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getCollectionItems.yaml +post: + $ref: createItems.yaml +patch: + $ref: updateItems.yaml +delete: + $ref: deleteItems.yaml diff --git a/api-spec/paths/items/_collection/singleton/getSingleton.yaml b/api-spec/paths/items/_collection/singleton/getSingleton.yaml new file mode 100644 index 00000000..2c0f888b --- /dev/null +++ b/api-spec/paths/items/_collection/singleton/getSingleton.yaml @@ -0,0 +1,47 @@ +summary: Retrieve a Singleton +description: | + Retrieves a singleton of a given collection. + + The REST and GraphQL requests for singletons are the same as those used to Get Items but in contrast the response consists of a plain item object (the singleton) instead of an array of items. +operationId: getSingleton +parameters: +- $ref: ../../../../components/parameters.yaml#/Collection +- $ref: ../../../../components/parameters.yaml#/Version +- $ref: ../../../../components/parameters.yaml#/Fields +- $ref: ../../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../../components/schemas/Items.yaml + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Items +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readSingleton } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readSingleton(collection_name)); + - label: GraphQL + lang: GraphQL + source: | + type Query { + (version: String): + } + + type Query { + _by_version(version: String!): + } diff --git a/api-spec/paths/items/_collection/singleton/index.yaml b/api-spec/paths/items/_collection/singleton/index.yaml new file mode 100644 index 00000000..5a466884 --- /dev/null +++ b/api-spec/paths/items/_collection/singleton/index.yaml @@ -0,0 +1,4 @@ +get: + $ref: getSingleton.yaml +patch: + $ref: updateSingleton.yaml diff --git a/api-spec/paths/items/_collection/singleton/updateSingleton.yaml b/api-spec/paths/items/_collection/singleton/updateSingleton.yaml new file mode 100644 index 00000000..9a20f03e --- /dev/null +++ b/api-spec/paths/items/_collection/singleton/updateSingleton.yaml @@ -0,0 +1,48 @@ +summary: Update Singleton +description: | + Update a singleton item. + + The REST and GraphQL requests for singletons are the same as those used to Update Multiple Items but in contrast the request should consist of the plain item object. +operationId: updateSingleton +parameters: +- $ref: ../../../../components/parameters.yaml#/Collection +- $ref: ../../../../components/parameters.yaml#/Fields +- $ref: ../../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../../../components/schemas/Items.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../../components/schemas/Items.yaml + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Items +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateSingleton } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateSingleton(collection_name, partial_item_object)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + update__items(data: [update__input]): [] + } diff --git a/api-spec/paths/items/_collection/updateItems.yaml b/api-spec/paths/items/_collection/updateItems.yaml new file mode 100644 index 00000000..c40980fc --- /dev/null +++ b/api-spec/paths/items/_collection/updateItems.yaml @@ -0,0 +1,64 @@ + +summary: Update Multiple Items +description: Update multiple items at the same time. +operationId: updateItems +parameters: +- $ref: ../../../components/parameters.yaml#/Collection +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Limit +- $ref: ../../../components/parameters.yaml#/Meta +- $ref: ../../../components/parameters.yaml#/Offset +- $ref: ../../../components/parameters.yaml#/Sort +- $ref: ../../../components/parameters.yaml#/Filter +- $ref: ../../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - data + - keys + properties: + data: + $ref: ../../../components/schemas/Items.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../../components/schemas/Items.yaml + meta: + $ref: ../../../components/schemas/x-metadata.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Items +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateItems } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateItems(collection_name, item_id_array, partial_item_object)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + update__items(ids: [ID!]!, data: [update__input]): [] + } diff --git a/api-spec/paths/notifications/_id/deleteNotification.yaml b/api-spec/paths/notifications/_id/deleteNotification.yaml new file mode 100644 index 00000000..24dc92f0 --- /dev/null +++ b/api-spec/paths/notifications/_id/deleteNotification.yaml @@ -0,0 +1,36 @@ + +summary: Delete an notification +description: Delete an existing notification. +operationId: deleteNotification +parameters: +- name: id + in: path + required: true + description: Unique identifier of the notification. + schema: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Notifications +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteNotification } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteNotification(notification_id)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + delete_notifications_item(id: ID!): delete_one + } diff --git a/api-spec/paths/notifications/_id/getNotification.yaml b/api-spec/paths/notifications/_id/getNotification.yaml new file mode 100644 index 00000000..3a7848d3 --- /dev/null +++ b/api-spec/paths/notifications/_id/getNotification.yaml @@ -0,0 +1,44 @@ +summary: Retrieve a notification +description: List an existing notification by primary key. +operationId: getNotification +parameters: +- name: id + in: path + description: Unique identifier of the notification. + schema: + type: string + required: true +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Notifications.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Notifications +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readNotification } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readNotification(notification_id, query_object)); + - label: GraphQL + lang: GraphQL + source: | + type Query { + notifications_by_id(id: ID!): directus_notifications + } diff --git a/api-spec/paths/notifications/_id/index.yaml b/api-spec/paths/notifications/_id/index.yaml new file mode 100644 index 00000000..75214d12 --- /dev/null +++ b/api-spec/paths/notifications/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getNotification.yaml +patch: + $ref: updateNotification.yaml +delete: + $ref: deleteNotification.yaml diff --git a/api-spec/paths/notifications/_id/updateNotification.yaml b/api-spec/paths/notifications/_id/updateNotification.yaml new file mode 100644 index 00000000..9e27f96d --- /dev/null +++ b/api-spec/paths/notifications/_id/updateNotification.yaml @@ -0,0 +1,50 @@ +summary: Update a Notification +description: Update an existing notification. +operationId: updateNotification +parameters: + - name: id + in: path + description: Unique identifier of the notification. + schema: + type: string + required: true + - $ref: ../../../components/parameters.yaml#/Fields + - $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../../components/schemas/Notifications.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Notifications.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Notifications +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateNotification } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateNotification(notification_id, partial_notification_object)); + - label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_notifications_item(id: ID!, data: update_directus_notifications_input): directus_notifications + } diff --git a/api-spec/paths/notifications/createNotifications.yaml b/api-spec/paths/notifications/createNotifications.yaml new file mode 100644 index 00000000..353c064d --- /dev/null +++ b/api-spec/paths/notifications/createNotifications.yaml @@ -0,0 +1,57 @@ +summary: Create Multiple notifications +description: Create multiple new notifications. +operationId: createNotifications +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Notifications.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Notifications.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Notifications +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createNotifications } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createNotifications(notification_object_array)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + create_notifications_items(data: [create_directus_notifications_input!]!): [directus_notifications] + } diff --git a/api-spec/paths/notifications/deleteNotifications.yaml b/api-spec/paths/notifications/deleteNotifications.yaml new file mode 100644 index 00000000..0dedb59e --- /dev/null +++ b/api-spec/paths/notifications/deleteNotifications.yaml @@ -0,0 +1,45 @@ + +summary: Delete Multiple notifications +description: Delete multiple existing notifications. +operationId: deleteNotifications +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + description: An array of notification primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Notifications +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteNotifications } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteNotifications(notification_id_array)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + delete_notifications_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/notifications/getNotifications.yaml b/api-spec/paths/notifications/getNotifications.yaml new file mode 100644 index 00000000..c23c3b43 --- /dev/null +++ b/api-spec/paths/notifications/getNotifications.yaml @@ -0,0 +1,49 @@ + +summary: List notifications +description: List all notifications that exist in Directus. +operationId: getNotifications +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Page +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Notifications.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Notifications +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readNotifications } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readNotifications(query_object)); +- label: GraphQL + lang: GraphQL + source: | + type Query { + notifications: [directus_notifications] + } diff --git a/api-spec/paths/notifications/index.yaml b/api-spec/paths/notifications/index.yaml new file mode 100644 index 00000000..8568cbd1 --- /dev/null +++ b/api-spec/paths/notifications/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getNotifications.yaml +post: + $ref: createNotifications.yaml +patch: + $ref: updateNotifications.yaml +delete: + $ref: deleteNotifications.yaml diff --git a/api-spec/paths/notifications/updateNotifications.yaml b/api-spec/paths/notifications/updateNotifications.yaml new file mode 100644 index 00000000..440c2c72 --- /dev/null +++ b/api-spec/paths/notifications/updateNotifications.yaml @@ -0,0 +1,63 @@ + +summary: Update Multiple notifications +description: Update multiple notifications at the same time. +operationId: updateNotifications +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - data + - keys + properties: + data: + $ref: ../../components/schemas/Notifications.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Notifications.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Notifications +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateNotifications } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateNotifications(notification_id_array, partial_notification_object)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_notifications_items(ids: [ID!]!, data: update_directus_notifications_input): [directus_notifications] + } diff --git a/api-spec/paths/operations/_id/deleteOperation.yaml b/api-spec/paths/operations/_id/deleteOperation.yaml new file mode 100644 index 00000000..e3e503a1 --- /dev/null +++ b/api-spec/paths/operations/_id/deleteOperation.yaml @@ -0,0 +1,32 @@ +summary: Delete an Operation +description: Delete an existing operation +operationId: deleteOperation +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Operations +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteOperation } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteOperation(operation_id)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_operations_item(id: ID!): delete_one + } diff --git a/api-spec/paths/operations/_id/getOperation.yaml b/api-spec/paths/operations/_id/getOperation.yaml new file mode 100644 index 00000000..2e3d3c6c --- /dev/null +++ b/api-spec/paths/operations/_id/getOperation.yaml @@ -0,0 +1,44 @@ +summary: Retrieve an Operation +description: Retrieve a single operation by primary key. +operationId: getOperation +parameters: + - $ref: ../../../components/parameters.yaml#/UUId + - $ref: ../../../components/parameters.yaml#/Fields + - $ref: ../../../components/parameters.yaml#/Limit + - $ref: ../../../components/parameters.yaml#/Meta + - $ref: ../../../components/parameters.yaml#/Offset + - $ref: ../../../components/parameters.yaml#/Sort + - $ref: ../../../components/parameters.yaml#/Filter + - $ref: ../../../components/parameters.yaml#/Search +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Operations.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Operations +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readOperation } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readOperation(operation_id, query_object)); + - label: GraphQL + lang: GraphQL + source: | + type Query { + operations_by_id(id: ID!): directus_operations + } diff --git a/api-spec/paths/operations/_id/index.yaml b/api-spec/paths/operations/_id/index.yaml new file mode 100644 index 00000000..542617f4 --- /dev/null +++ b/api-spec/paths/operations/_id/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getOperation.yaml +post: + $ref: triggerOperation.yaml +patch: + $ref: updateOperation.yaml +delete: + $ref: deleteOperation.yaml diff --git a/api-spec/paths/operations/_id/triggerOperation.yaml b/api-spec/paths/operations/_id/triggerOperation.yaml new file mode 100644 index 00000000..c4929fcd --- /dev/null +++ b/api-spec/paths/operations/_id/triggerOperation.yaml @@ -0,0 +1,40 @@ +summary: Triggering an Operation +description: Trigger an operation based on primary key. +operationId: triggerOperation +parameters: + - $ref: ../../../components/parameters.yaml#/Id +requestBody: + description: Payload for the operation, if needed. + content: + application/json: + schema: + type: object +responses: + '200': + description: Result of the operation, if any. + content: + application/json: + schema: + type: object + properties: + data: {} + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: + - Operations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, triggerOperation } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(triggerOperation(operation_id, webhook_payload_object)); +- label: GraphQL + lang: GraphQL + source: | + // Not currently supported in GraphQL diff --git a/api-spec/paths/operations/_id/updateOperation.yaml b/api-spec/paths/operations/_id/updateOperation.yaml new file mode 100644 index 00000000..82bfd2e0 --- /dev/null +++ b/api-spec/paths/operations/_id/updateOperation.yaml @@ -0,0 +1,47 @@ +summary: Update an Operation +description: Update an existing operation. +operationId: updateOperation +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../../components/schemas/Operations.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Operations.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Operations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateOperation } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateOperation(operation_id, partial_operation_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_operations_item(id: ID!, data: update_directus_operations_input): directus_operations + } diff --git a/api-spec/paths/operations/createOperations.yaml b/api-spec/paths/operations/createOperations.yaml new file mode 100644 index 00000000..f3ed5ac4 --- /dev/null +++ b/api-spec/paths/operations/createOperations.yaml @@ -0,0 +1,60 @@ + +summary: Create Multiple Operations +description: Create multiple new operations. +operationId: createOperations +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Operations.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Operations.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Operations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createOperations } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createOperations(operations_object_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + create_operations_items(data: [create_directus_operations_input!]!): [directus_operations] + } diff --git a/api-spec/paths/operations/deleteOperations.yaml b/api-spec/paths/operations/deleteOperations.yaml new file mode 100644 index 00000000..c3485f41 --- /dev/null +++ b/api-spec/paths/operations/deleteOperations.yaml @@ -0,0 +1,36 @@ +summary: Delete Multiple Operations +description: Delete multiple existing operations. +operationId: deleteOperations +requestBody: + description: An array of operations primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Operations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteOperations } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteOperations(operations_id_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_operations_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/operations/getOperations.yaml b/api-spec/paths/operations/getOperations.yaml new file mode 100644 index 00000000..e62efe84 --- /dev/null +++ b/api-spec/paths/operations/getOperations.yaml @@ -0,0 +1,50 @@ +summary: List Operations +description: List all operations that exist in Directus. +operationId: getOperations +parameters: + - $ref: ../../components/parameters.yaml#/Fields + - $ref: ../../components/parameters.yaml#/Limit + - $ref: ../../components/parameters.yaml#/Offset + - $ref: ../../components/parameters.yaml#/Meta + - $ref: ../../components/parameters.yaml#/Sort + - $ref: ../../components/parameters.yaml#/Filter + - $ref: ../../components/parameters.yaml#/Search + - $ref: ../../components/parameters.yaml#/Page +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Operations.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Operations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readOperations } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readOperations(query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + operations: [directus_operations] + } diff --git a/api-spec/paths/operations/index.yaml b/api-spec/paths/operations/index.yaml new file mode 100644 index 00000000..d3a7d90e --- /dev/null +++ b/api-spec/paths/operations/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getOperations.yaml +post: + $ref: createOperations.yaml +patch: + $ref: updateOperations.yaml +delete: + $ref: deleteOperations.yaml diff --git a/api-spec/paths/operations/updateOperations.yaml b/api-spec/paths/operations/updateOperations.yaml new file mode 100644 index 00000000..3f215762 --- /dev/null +++ b/api-spec/paths/operations/updateOperations.yaml @@ -0,0 +1,61 @@ +summary: Update Multiple Operations +description: Update multiple operations at the same time. +security: [] +tags: +- Operations +operationId: updateOperations +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - data + - keys + properties: + data: + anyOf: + - $ref: ../../components/schemas/Operations.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Operations.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateOperations } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateOperations(operations_id_array, partial_operations_object)); + - label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_operations_items(ids: [ID!]!, data: update_directus_operations_input): [directus_operations] + } diff --git a/api-spec/paths/panels/_id/deletePanel.yaml b/api-spec/paths/panels/_id/deletePanel.yaml new file mode 100644 index 00000000..83af36a0 --- /dev/null +++ b/api-spec/paths/panels/_id/deletePanel.yaml @@ -0,0 +1,36 @@ + +summary: Delete an panel +description: Delete an existing panel. +operationId: deletePanel +parameters: +- name: id + in: path + description: Unique identifier of the panel. + required: true + schema: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Panels +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deletePanel } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deletePanel(panel_id)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + delete_panels_item(id: ID!): delete_one + } diff --git a/api-spec/paths/panels/_id/getPanel.yaml b/api-spec/paths/panels/_id/getPanel.yaml new file mode 100644 index 00000000..8e1b0276 --- /dev/null +++ b/api-spec/paths/panels/_id/getPanel.yaml @@ -0,0 +1,44 @@ +summary: Retrieve a panel +description: List an existing panel by primary key. +operationId: getPanel +parameters: +- name: id + in: path + description: Unique identifier of the panel. + schema: + type: string + required: true +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Panels.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Panels +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readPanel } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readPanel(panel_id, query_object)); + - label: GraphQL + lang: GraphQL + source: | + type Query { + panels_by_id(id: ID!): directus_panels + } diff --git a/api-spec/paths/panels/_id/index.yaml b/api-spec/paths/panels/_id/index.yaml new file mode 100644 index 00000000..4bf1388a --- /dev/null +++ b/api-spec/paths/panels/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getPanel.yaml +patch: + $ref: updatePanel.yaml +delete: + $ref: deletePanel.yaml diff --git a/api-spec/paths/panels/_id/updatePanel.yaml b/api-spec/paths/panels/_id/updatePanel.yaml new file mode 100644 index 00000000..4ccce0dd --- /dev/null +++ b/api-spec/paths/panels/_id/updatePanel.yaml @@ -0,0 +1,50 @@ +summary: Update a panel +description: Update an existing panel. +operationId: updatePanel +parameters: +- name: id + in: path + description: Unique identifier of the panel. + schema: + type: string + required: true +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../../components/schemas/Panels.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Panels.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Panels +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updatePanel } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updatePanel(panel_id, partial_panel_object)); + - label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_panels_item(id: ID!, data: update_directus_panels_input): directus_panels + } diff --git a/api-spec/paths/panels/createPanels.yaml b/api-spec/paths/panels/createPanels.yaml new file mode 100644 index 00000000..3408758b --- /dev/null +++ b/api-spec/paths/panels/createPanels.yaml @@ -0,0 +1,57 @@ +summary: Create Multiple panels +description: Create multiple new panels. +operationId: createPanels +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Panels.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Panels.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Panels +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createPanel } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createPanels(panel_object_array)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + create_panels_items(data: [create_directus_panels_input!]!): [directus_panels] + } diff --git a/api-spec/paths/panels/deletePanels.yaml b/api-spec/paths/panels/deletePanels.yaml new file mode 100644 index 00000000..56da57c8 --- /dev/null +++ b/api-spec/paths/panels/deletePanels.yaml @@ -0,0 +1,37 @@ + +summary: Delete Multiple panels +description: Delete multiple existing panels. +operationId: deletePanels +requestBody: + description: An array of panel primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Panels +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deletePanels } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deletePanels(panel_id_array)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + delete_panels_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/panels/getPanels.yaml b/api-spec/paths/panels/getPanels.yaml new file mode 100644 index 00000000..aa09ab31 --- /dev/null +++ b/api-spec/paths/panels/getPanels.yaml @@ -0,0 +1,49 @@ + +summary: List panels +description: List all panels that exist in Directus. +operationId: getPanels +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Page +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Panels.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Panels +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readPanels } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readPanels(query_object)); +- label: GraphQL + lang: GraphQL + source: | + type Query { + panels: [directus_panels] + } diff --git a/api-spec/paths/panels/index.yaml b/api-spec/paths/panels/index.yaml new file mode 100644 index 00000000..40dc6123 --- /dev/null +++ b/api-spec/paths/panels/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getPanels.yaml +post: + $ref: createPanels.yaml +patch: + $ref: updatePanels.yaml +delete: + $ref: deletePanels.yaml diff --git a/api-spec/paths/panels/updatePanels.yaml b/api-spec/paths/panels/updatePanels.yaml new file mode 100644 index 00000000..92902ab2 --- /dev/null +++ b/api-spec/paths/panels/updatePanels.yaml @@ -0,0 +1,63 @@ + +summary: Update Multiple panels +description: Update multiple panels at the same time. +operationId: updatePanels +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - keys + - data + properties: + data: + $ref: ../../components/schemas/Panels.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Panels.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Panels +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updatePanels } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updatePanels(panel_id_array, partial_panel_object)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_panels_items(ids: [ID!]!, data: update_directus_panels_input): [directus_panels] + } diff --git a/api-spec/paths/permissions/_id/deletePermission.yaml b/api-spec/paths/permissions/_id/deletePermission.yaml new file mode 100644 index 00000000..f7d2db5a --- /dev/null +++ b/api-spec/paths/permissions/_id/deletePermission.yaml @@ -0,0 +1,32 @@ +summary: Delete a Permission +description: Delete an existing permission +operationId: deletePermission +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Permissions +parameters: +- $ref: ../../../components/parameters.yaml#/Id +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deletePermission } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deletePermission(permission_id)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_permissions_item(id: ID!): delete_one + } diff --git a/api-spec/paths/permissions/_id/getPermission.yaml b/api-spec/paths/permissions/_id/getPermission.yaml new file mode 100644 index 00000000..32553f32 --- /dev/null +++ b/api-spec/paths/permissions/_id/getPermission.yaml @@ -0,0 +1,41 @@ +summary: Retrieve a Permission Rule +description: Retrieve a single permission rules object by unique identifier. +operationId: getPermission +parameters: +- $ref: ../../../components/parameters.yaml#/Id +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Permissions.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Permissions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readPermission } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readPermission(permission_id, query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + permissions_by_id(id: ID!): directus_permissions + } diff --git a/api-spec/paths/permissions/_id/index.yaml b/api-spec/paths/permissions/_id/index.yaml new file mode 100644 index 00000000..9f4e4d71 --- /dev/null +++ b/api-spec/paths/permissions/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getPermission.yaml +patch: + $ref: updatePermission.yaml +delete: + $ref: deletePermission.yaml diff --git a/api-spec/paths/permissions/_id/updatePermission.yaml b/api-spec/paths/permissions/_id/updatePermission.yaml new file mode 100644 index 00000000..ed1e0ce2 --- /dev/null +++ b/api-spec/paths/permissions/_id/updatePermission.yaml @@ -0,0 +1,110 @@ +summary: Update a Permission Rule +description: Update an existing permission rule +operationId: updatePermission +parameters: +- $ref: ../../../components/parameters.yaml#/Id +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + type: object + properties: + collection: + type: object + description: What collection this permission applies to. + comment: + type: string + description: If the user can post comments. full. + enum: + - none + - create + - update + create: + type: string + description: If the user can create items. + enum: + - none + - full + delete: + type: string + description: If the user can update items. + enum: + - none + - mine + - role + - full + explain: + type: string + description: If the user is required to leave a comment explaining what + was changed. + enum: + - none + - create + - update + - always + read: + type: string + description: If the user can read items. + enum: + - none + - mine + - role + - full + read_field_blacklist: + type: object + description: Explicitly denies read access for specific fields. + role: + type: object + description: Unique identifier of the role this permission applies to. + status: + type: object + description: What status this permission applies to. + status_blacklist: + type: object + description: Explicitly denies specific statuses to be used. + update: + type: string + description: If the user can update items. + enum: + - none + - mine + - role + - full + write_field_blacklist: + type: object + description: Explicitly denies write access for specific fields. +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Permissions.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Permissions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updatePermission } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updatePermission(permission_id, partial_permission_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_permissions_item(id: ID!, data: update_directus_permissions_input!): directus_permissions + } diff --git a/api-spec/paths/permissions/createPermissions.yaml b/api-spec/paths/permissions/createPermissions.yaml new file mode 100644 index 00000000..cd6709f7 --- /dev/null +++ b/api-spec/paths/permissions/createPermissions.yaml @@ -0,0 +1,63 @@ +summary: Create Multiple Permission Rules +description: Create multiple new permission rules +operationId: createPermissions +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Page +requestBody: + content: + application/json: + schema: + type: object + required: + - action + - collection + properties: + data: + type: array + items: + $ref: ../../components/schemas/Permissions.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Permissions.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Permissions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createPermissions } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createPermissions(permission_object_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + create_permissions_items(data: [create_directus_permissions_input!]!): [directus_permissions] + } diff --git a/api-spec/paths/permissions/deletePermissions.yaml b/api-spec/paths/permissions/deletePermissions.yaml new file mode 100644 index 00000000..33e70dcc --- /dev/null +++ b/api-spec/paths/permissions/deletePermissions.yaml @@ -0,0 +1,36 @@ +summary: Delete Multiple Permission Ruless +description: Delete multiple existing permission rules. +operationId: deletePermissions +requestBody: + description: An array of permissions primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Permissions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deletePermissions } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deletePermissions(permission_id_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_permissions_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/permissions/getPermissions.yaml b/api-spec/paths/permissions/getPermissions.yaml new file mode 100644 index 00000000..ea4e02d9 --- /dev/null +++ b/api-spec/paths/permissions/getPermissions.yaml @@ -0,0 +1,50 @@ +summary: List Permissions +description: List all permissions that exist in Directus. +operationId: getPermissions +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Page +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Permissions.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Permissions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readPermissions } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readPermissions(query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + permissions: directus_permissions + } diff --git a/api-spec/paths/permissions/index.yaml b/api-spec/paths/permissions/index.yaml new file mode 100644 index 00000000..349bd9a1 --- /dev/null +++ b/api-spec/paths/permissions/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getPermissions.yaml +post: + $ref: createPermissions.yaml +patch: + $ref: updatePermissions.yaml +delete: + $ref: deletePermissions.yaml diff --git a/api-spec/paths/permissions/me/_collection/_id/getItemPermissions.yaml b/api-spec/paths/permissions/me/_collection/_id/getItemPermissions.yaml new file mode 100644 index 00000000..7987513d --- /dev/null +++ b/api-spec/paths/permissions/me/_collection/_id/getItemPermissions.yaml @@ -0,0 +1,59 @@ +summary: Check Permissions for a Specific Item +description: | + Check the current user's permissions on a specific item. + + For a singleton where update access is given, the presets and fields properties from the corresponding update permission are additionally returned. + + The response structure is maintained in any case, even if the collection or item does not exist. To check for the existence of an item, use the get items endpoint instead. +operationId: readItemPermissions +parameters: + - $ref: ../../../../../components/parameters.yaml#/Collection + - $ref: ../../../../../components/parameters.yaml#/Id +responses: + '200': + description: Successful request + content: + application/json: + examples: + collection: + value: + update: + access: boolean + delete: + access: boolean + share: + access: boolean + singleton: + value: + update: + access: boolean + presets: permission_presets + fields: permission_fields + delete: + access: boolean + share: + access: boolean + '401': + $ref: ../../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Permissions +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readItemPermissions } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + // collection item + const result = await client.request(readItemPermissions(collection_name, item_id)); + + // singleton + const result = await client.request(readItemPermissions(collection_name)); + - label: GraphQL + lang: GraphQL + source: | + //Currently not supported in GraphQL. diff --git a/api-spec/paths/permissions/me/_collection/_id/index.yaml b/api-spec/paths/permissions/me/_collection/_id/index.yaml new file mode 100644 index 00000000..14aa0205 --- /dev/null +++ b/api-spec/paths/permissions/me/_collection/_id/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: getItemPermissions.yaml diff --git a/api-spec/paths/permissions/me/getUserPermissions.yaml b/api-spec/paths/permissions/me/getUserPermissions.yaml new file mode 100644 index 00000000..67b7bafa --- /dev/null +++ b/api-spec/paths/permissions/me/getUserPermissions.yaml @@ -0,0 +1,60 @@ +summary: Get Current User Permissions +description: | + Check the current user's permissions across all collections. + + The response is an object that contains one entry for every collection with at least one permission. Each collection has entries corresponding to the actions the user is able to perform on the collection. + + The `access` property indicates the level of access the user has for an action for a collection. `"none"` means the user has no access, `"partial"` means the user has access to some items, but may not have access to all items, and `"full"` means the user has access to all items. +operationId: getUserPermissions +responses: + '200': + description: The request was successful. + content: + application/json: + examples: + example: + value: + "": + create: + access: "none | partial | full" + fields: permission_fields + presets: permission_presets + read: + access: "none | partial | full" + full_access: boolean + presets: permission_presets + update: + access: "none | partial | full" + full_access: boolean + fields: permission_fields + presets: permission_presets + delete: + access: "none | partial | full" + full_access: boolean + share: + access: "none | partial | full" + full_access: boolean + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Permissions +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readUserPermissions } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readUserPermissions()); + - label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + query { + permissions_me + } diff --git a/api-spec/paths/permissions/me/index.yaml b/api-spec/paths/permissions/me/index.yaml new file mode 100644 index 00000000..fd6ed7e9 --- /dev/null +++ b/api-spec/paths/permissions/me/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: getUserPermissions.yaml diff --git a/api-spec/paths/permissions/updatePermissions.yaml b/api-spec/paths/permissions/updatePermissions.yaml new file mode 100644 index 00000000..64b4e641 --- /dev/null +++ b/api-spec/paths/permissions/updatePermissions.yaml @@ -0,0 +1,62 @@ +summary: Update Multiple Permission Rules +description: Update multiple permissions at the same time. +security: [] +tags: +- Permissions +operationId: updatePermissions +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - data + - keys + properties: + data: + $ref: ../../components/schemas/Permissions.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Permissions.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updatePermissions } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updatePermissions(permission_id_array, permission_object_panel)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_permissions_items(id: [ID!]!, data: update_directus_permissions_input!): [directus_permissions] + } diff --git a/api-spec/paths/policies/_id/deletePolicy.yaml b/api-spec/paths/policies/_id/deletePolicy.yaml new file mode 100644 index 00000000..9e4ff026 --- /dev/null +++ b/api-spec/paths/policies/_id/deletePolicy.yaml @@ -0,0 +1,36 @@ + +summary: Delete a policy +description: Delete an existing policy. +operationId: deletePolicy +parameters: +- name: id + in: path + description: Unique identifier of the policy. + required: true + schema: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Policies +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deletePolicy } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deletePolicy(policy_id)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + delete_policies_item(id: ID!): delete_one + } diff --git a/api-spec/paths/policies/_id/getPolicy.yaml b/api-spec/paths/policies/_id/getPolicy.yaml new file mode 100644 index 00000000..9d3be769 --- /dev/null +++ b/api-spec/paths/policies/_id/getPolicy.yaml @@ -0,0 +1,44 @@ +summary: Retrieve a policy +description: List an existing policy by primary key. +operationId: getPolicy +parameters: +- name: id + in: path + description: Unique identifier of the Policy. + schema: + type: string + required: true +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Policies.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Policies +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readPolicy } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readPolicy(policy_id, query_object)); + - label: GraphQL + lang: GraphQL + source: | + type Query { + policies_by_id(id: ID!): directus_policies + } diff --git a/api-spec/paths/policies/_id/index.yaml b/api-spec/paths/policies/_id/index.yaml new file mode 100644 index 00000000..f002ab0e --- /dev/null +++ b/api-spec/paths/policies/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getPolicy.yaml +patch: + $ref: updatePolicy.yaml +delete: + $ref: deletePolicy.yaml diff --git a/api-spec/paths/policies/_id/updatePolicy.yaml b/api-spec/paths/policies/_id/updatePolicy.yaml new file mode 100644 index 00000000..60a46f3f --- /dev/null +++ b/api-spec/paths/policies/_id/updatePolicy.yaml @@ -0,0 +1,50 @@ +summary: Update a policy +description: Update an existing policy. +operationId: updatePolicy +parameters: +- name: id + in: path + description: Unique identifier of the policy. + schema: + type: string + required: true +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../../components/schemas/Policies.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Policies.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Policies +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updatePolicy } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updatePolicy(policy_id, partial_policy_object)); + - label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_policies_item(id: ID!, data: update_directus_policys_input): directus_policies + } diff --git a/api-spec/paths/policies/createPolicies.yaml b/api-spec/paths/policies/createPolicies.yaml new file mode 100644 index 00000000..069c1e0f --- /dev/null +++ b/api-spec/paths/policies/createPolicies.yaml @@ -0,0 +1,57 @@ +summary: Create Multiple policies +description: Create multiple new policies. +operationId: createPolicies +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Policies.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Policies.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Policies +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createPolies } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createPolicies(policy_object_array)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + create_policies_items(data: [create_directus_policies_input!]!): [directus_policies] + } diff --git a/api-spec/paths/policies/deletePolicies.yaml b/api-spec/paths/policies/deletePolicies.yaml new file mode 100644 index 00000000..a3209101 --- /dev/null +++ b/api-spec/paths/policies/deletePolicies.yaml @@ -0,0 +1,37 @@ + +summary: Delete Multiple policies +description: Delete multiple existing policies. +operationId: deletePolicies +requestBody: + description: An array of policy primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Policies +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deletePolicies } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deletePolicies(policy_id_array)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + delete_policies_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/policies/getPolicies.yaml b/api-spec/paths/policies/getPolicies.yaml new file mode 100644 index 00000000..64a3c512 --- /dev/null +++ b/api-spec/paths/policies/getPolicies.yaml @@ -0,0 +1,49 @@ + +summary: List policies +description: List all policies that exist in Directus. +operationId: getPolicies +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Page +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Policies.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Policies +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readPolicies } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readPolicies(query_object)); +- label: GraphQL + lang: GraphQL + source: | + type Query { + policies: [directus_policies] + } diff --git a/api-spec/paths/policies/index.yaml b/api-spec/paths/policies/index.yaml new file mode 100644 index 00000000..9eed50e8 --- /dev/null +++ b/api-spec/paths/policies/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getPolicies.yaml +post: + $ref: createPolicies.yaml +patch: + $ref: updatePolicies.yaml +delete: + $ref: deletePolicies.yaml diff --git a/api-spec/paths/policies/updatePolicies.yaml b/api-spec/paths/policies/updatePolicies.yaml new file mode 100644 index 00000000..52e3c20e --- /dev/null +++ b/api-spec/paths/policies/updatePolicies.yaml @@ -0,0 +1,62 @@ +summary: Update Multiple policies +description: Update multiple existing policies. +operationId: updatePolicies +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - keys + - data + properties: + data: + $ref: ../../components/schemas/Policies.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Policies.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Policies +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updatePolicies } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updatePolicies(policies_id_array, partial_policy_object)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_policies_items(ids: [ID!]!, data: update_directus_policies_input): [directus_policies] + } diff --git a/api-spec/paths/presets/_id/deletePreset.yaml b/api-spec/paths/presets/_id/deletePreset.yaml new file mode 100644 index 00000000..a21a30ca --- /dev/null +++ b/api-spec/paths/presets/_id/deletePreset.yaml @@ -0,0 +1,30 @@ +summary: Delete a Preset +security: [] +tags: +- Presets +operationId: deletePreset +description: Delete an existing preset. +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError +parameters: +- $ref: ../../../components/parameters.yaml#/Id +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deletePreset } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deletePreset(preset_id)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_presets_item(id: ID!): delete_one + } diff --git a/api-spec/paths/presets/_id/getPreset.yaml b/api-spec/paths/presets/_id/getPreset.yaml new file mode 100644 index 00000000..758c6a2b --- /dev/null +++ b/api-spec/paths/presets/_id/getPreset.yaml @@ -0,0 +1,39 @@ +summary: Retrieve a Preset +security: [] +tags: +- Presets +operationId: getPreset +description: Retrieve a single preset by unique identifier. +parameters: +- $ref: ../../../components/parameters.yaml#/Id +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Presets.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readPreset } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readPreset(preset_id, query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + presets_by_id(id: ID!): directus_presets + } diff --git a/api-spec/paths/presets/_id/index.yaml b/api-spec/paths/presets/_id/index.yaml new file mode 100644 index 00000000..5c500613 --- /dev/null +++ b/api-spec/paths/presets/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getPreset.yaml +patch: + $ref: updatePreset.yaml +delete: + $ref: deletePreset.yaml diff --git a/api-spec/paths/presets/_id/updatePreset.yaml b/api-spec/paths/presets/_id/updatePreset.yaml new file mode 100644 index 00000000..551d4995 --- /dev/null +++ b/api-spec/paths/presets/_id/updatePreset.yaml @@ -0,0 +1,92 @@ +summary: Update a Preset +security: [] +tags: +- Presets +operationId: updatePreset +description: Update an existing preset. +parameters: +- $ref: ../../../components/parameters.yaml#/Id +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + type: object + required: + - collection + properties: + collection: + type: string + description: What collection this collection preset is used for. + example: articles + title: + type: string + description: Name for the bookmark. If this is set, the collection preset + will be considered to be a bookmark. + example: Highly rated articles + role: + type: integer + description: The unique identifier of a role in the platform. If user + is null, this will be used to apply the collection preset or bookmark + for all users in the role. + search_query: + type: string + description: What the user searched for in search/filter in the header + bar. + filters: + type: array + items: + type: object + properties: + field: + type: string + example: rating + operator: + type: string + example: gte + value: + type: integer + example: 4.5 + view_type: + type: string + description: Name of the view type that is used. Defaults to tabular. + view_query: + type: string + description: View query that's saved per view type. Controls what data + is fetched on load. These follow the same format as the JS SDK parameters. + view_options: + type: string + description: Options of the views. The properties in here are controlled + by the layout. + translation: + type: object + description: Key value pair of language-translation. Can be used to translate + the bookmark title in multiple languages. +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Presets.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updatePresets } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updatePreset(preset_id, partial_preset_object)); + - label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_presets_item(id: ID!, data: update_directus_presets_input): directus_presets + } diff --git a/api-spec/paths/presets/createPresets.yaml b/api-spec/paths/presets/createPresets.yaml new file mode 100644 index 00000000..a6bbfacc --- /dev/null +++ b/api-spec/paths/presets/createPresets.yaml @@ -0,0 +1,59 @@ +summary: Create Multiple Presets +description: Create multiple new Presets. +operationId: createPresets +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Presets.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Presets.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Presets +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createPresets } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createPresets(presets_object_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + create_presets_items(data: [create_directus_presets_input!]!): [directus_presets] + } diff --git a/api-spec/paths/presets/deletePresets.yaml b/api-spec/paths/presets/deletePresets.yaml new file mode 100644 index 00000000..a35a7051 --- /dev/null +++ b/api-spec/paths/presets/deletePresets.yaml @@ -0,0 +1,36 @@ +summary: Delete Multiple Presets +description: Delete multiple existing presets. +operationId: deletePresets +requestBody: + description: An array of preset primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Presets +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deletePresets } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deletePreset(preset_id_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_presets_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/presets/getPresets.yaml b/api-spec/paths/presets/getPresets.yaml new file mode 100644 index 00000000..c884d502 --- /dev/null +++ b/api-spec/paths/presets/getPresets.yaml @@ -0,0 +1,48 @@ +summary: List Presets +security: [] +tags: +- Presets +operationId: getPresets +description: List all presets that exist in Directus. The data returned in this endpoint will be filtered based on the user's permissions. For example, presets for a role other than the current user's role won't be returned. +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Page +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Presets.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readPresets } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readPresets(object_field)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + presets: [directus_presets] + } diff --git a/api-spec/paths/presets/index.yaml b/api-spec/paths/presets/index.yaml new file mode 100644 index 00000000..ab55a860 --- /dev/null +++ b/api-spec/paths/presets/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getPresets.yaml +post: + $ref: createPresets.yaml +patch: + $ref: updatePresets.yaml +delete: + $ref: deletePresets.yaml diff --git a/api-spec/paths/presets/updatePresets.yaml b/api-spec/paths/presets/updatePresets.yaml new file mode 100644 index 00000000..d6780373 --- /dev/null +++ b/api-spec/paths/presets/updatePresets.yaml @@ -0,0 +1,113 @@ +summary: Update Multiple Presets +description: Update multiple presets at the same time. +security: [] +tags: +- Presets +operationId: updatePresets +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - keys + - data + properties: + keys: + type: array + items: + type: string + data: + type: object + required: + - collection + properties: + collection: + type: string + description: What collection this collection preset is used for. + example: articles + title: + type: string + description: Name for the bookmark. If this is set, the collection + preset will be considered to be a bookmark. + example: Highly rated articles + role: + type: string + description: The unique identifier of a role in the platform. If user + is null, this will be used to apply the collection preset or bookmark + for all users in the role. + example: + search: + type: string + description: What the user searched for in search/filter in the header + bar. + filters: + type: array + items: + type: object + properties: + key: + type: string + example: aHKLAakdVghzD + field: + type: string + example: rating + operator: + type: string + example: gte + value: + type: integer + example: 4.5 + layout: + type: string + description: Name of the view type that is used. + layout_query: + type: string + description: Layout query that's saved per layout type. Controls what + data is fetched on load. These follow the same format as the JS + SDK parameters. + layout_options: + type: string + description: Options of the views. The properties in here are controlled + by the layout. +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Presets.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updatePresets } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updatePresets(preset_id_array, partial_preset_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_presets_items(ids: [ID!]!, data: update_directus_presets_input): [directus_presets] + } diff --git a/api-spec/paths/relations/_collection/getRelationByCollection.yaml b/api-spec/paths/relations/_collection/getRelationByCollection.yaml new file mode 100644 index 00000000..8e5c1d67 --- /dev/null +++ b/api-spec/paths/relations/_collection/getRelationByCollection.yaml @@ -0,0 +1,39 @@ +summary: List relations in collection +description: List all relations that exist in a given collection. +operationId: getRelationByCollection +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Relations.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Relations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readRelationByCollection } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readRelationByCollection(collection_name)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + relations_in_collection(collection: String!): [directus_relations] + } diff --git a/api-spec/paths/relations/_collection/index.yaml b/api-spec/paths/relations/_collection/index.yaml new file mode 100644 index 00000000..48e39768 --- /dev/null +++ b/api-spec/paths/relations/_collection/index.yaml @@ -0,0 +1,3 @@ +post: + $ref: getRelationByCollection.yaml + diff --git a/api-spec/paths/relations/_id/deleteRelation.yaml b/api-spec/paths/relations/_id/deleteRelation.yaml new file mode 100644 index 00000000..dbd5a319 --- /dev/null +++ b/api-spec/paths/relations/_id/deleteRelation.yaml @@ -0,0 +1,32 @@ +summary: Delete a Relation +description: Delete an existing relation. +operationId: deleteRelation +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Relations +parameters: +- $ref: ../../../components/parameters.yaml#/Id +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteRelation } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteRelation(collection_name, field_name)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_relations_item(collection: String!, field: String!): delete_one + } diff --git a/api-spec/paths/relations/_id/getRelation.yaml b/api-spec/paths/relations/_id/getRelation.yaml new file mode 100644 index 00000000..597a5903 --- /dev/null +++ b/api-spec/paths/relations/_id/getRelation.yaml @@ -0,0 +1,41 @@ +summary: Retrieve a Relation +description: Retrieve a single relation by unique identifier. +operationId: getRelation +parameters: +- $ref: ../../../components/parameters.yaml#/Id +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Relations.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Relations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readRelation } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readRelation(collection_name, field_name, query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + relations_by_name(collection: String!, field: String!): directus_relations + } diff --git a/api-spec/paths/relations/_id/index.yaml b/api-spec/paths/relations/_id/index.yaml new file mode 100644 index 00000000..e6fc7c4c --- /dev/null +++ b/api-spec/paths/relations/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getRelation.yaml +patch: + $ref: updateRelation.yaml +delete: + $ref: deleteRelation.yaml diff --git a/api-spec/paths/relations/_id/updateRelation.yaml b/api-spec/paths/relations/_id/updateRelation.yaml new file mode 100644 index 00000000..d1d7ed8c --- /dev/null +++ b/api-spec/paths/relations/_id/updateRelation.yaml @@ -0,0 +1,65 @@ +summary: Update a Relation +description: Update an existing relation +operationId: updateRelation +parameters: +- $ref: ../../../components/parameters.yaml#/Id +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + type: object + properties: + collection_many: + type: string + description: Collection that has the field that holds the foreign key. + collection_one: + type: string + description: Collection on the _one_ side of the relationship. + field_many: + type: string + description: Foreign key. Field that holds the primary key of the related + collection. + field_one: + type: string + description: Alias column that serves as the _one_ side of the relationship. + example: books + junction_field: + type: string + description: Field on the junction table that holds the primary key of + the related collection. +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Relations.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Relations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateRelation } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateRelation(collection_name, field_name, partial_relation_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_relations_item(collection: String!, field: String!, data: update_directus_relations_input!): directus_relations + } diff --git a/api-spec/paths/relations/createRelation.yaml b/api-spec/paths/relations/createRelation.yaml new file mode 100644 index 00000000..efd34957 --- /dev/null +++ b/api-spec/paths/relations/createRelation.yaml @@ -0,0 +1,67 @@ +summary: Create a Relation +description: Create a new relation. +operationId: createRelation +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + type: object + properties: + collection_many: + type: string + description: Collection that has the field that holds the foreign key. + example: articles + collection_one: + type: string + description: Collection on the _one_ side of the relationship. + example: authors + field_many: + type: string + description: Foreign key. Field that holds the primary key of the related + collection. + example: author + field_one: + type: string + description: Alias column that serves as the _one_ side of the relationship. + example: books + junction_field: + type: string + description: Field on the junction table that holds the primary key of + the related collection. +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../components/schemas/Relations.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Relations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createRelation } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createRelation(relation_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + create_relations_item(data: create_directus_relations_input!): directus_relations + } diff --git a/api-spec/paths/relations/getRelations.yaml b/api-spec/paths/relations/getRelations.yaml new file mode 100644 index 00000000..c777003d --- /dev/null +++ b/api-spec/paths/relations/getRelations.yaml @@ -0,0 +1,51 @@ +summary: List Relations +description: | + List all relations that exist in Directus. + + The data returned in this endpoint will be filtered based on the user's permissions. For example, relations that apply to a collection that the current user doesn't have access to are stripped out. +operationId: getRelations +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Page +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Relations.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Relations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readRelations } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readRelations(query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + relations: [directus_relations] + } diff --git a/api-spec/paths/relations/index.yaml b/api-spec/paths/relations/index.yaml new file mode 100644 index 00000000..e1b72808 --- /dev/null +++ b/api-spec/paths/relations/index.yaml @@ -0,0 +1,4 @@ +get: + $ref: getRelations.yaml +post: + $ref: createRelation.yaml diff --git a/api-spec/paths/revisions/_id/getRevision.yaml b/api-spec/paths/revisions/_id/getRevision.yaml new file mode 100644 index 00000000..c2bff6ae --- /dev/null +++ b/api-spec/paths/revisions/_id/getRevision.yaml @@ -0,0 +1,41 @@ +summary: Retrieve a Revision +description: List an existing revision by primary key. +operationId: getRevision +parameters: +- $ref: ../../../components/parameters.yaml#/Id +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Revisions.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Revisions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readRevision } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readRevision(revision_id, query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + revisions_by_id(id: ID!): directus_revisions + } diff --git a/api-spec/paths/revisions/_id/index.yaml b/api-spec/paths/revisions/_id/index.yaml new file mode 100644 index 00000000..b87dc0d3 --- /dev/null +++ b/api-spec/paths/revisions/_id/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: getRevision.yaml diff --git a/api-spec/paths/revisions/getRevisions.yaml b/api-spec/paths/revisions/getRevisions.yaml new file mode 100644 index 00000000..c6893b41 --- /dev/null +++ b/api-spec/paths/revisions/getRevisions.yaml @@ -0,0 +1,53 @@ +summary: List Revisions +description: | + List the revisions. + + The data returned in this endpoint will be filtered based on the user's permissions. For example, revisions that apply to a collection that the current user doesn't have access to are stripped out. +operationId: getRevisions +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Page +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Revisions.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Revisions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readRevisions } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readRevisions(query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + revisions: [directus_revisions] + } diff --git a/api-spec/paths/revisions/index.yaml b/api-spec/paths/revisions/index.yaml new file mode 100644 index 00000000..1c8be5e8 --- /dev/null +++ b/api-spec/paths/revisions/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: getRevisions.yaml diff --git a/api-spec/paths/roles/_id/deleteRole.yaml b/api-spec/paths/roles/_id/deleteRole.yaml new file mode 100644 index 00000000..78410a83 --- /dev/null +++ b/api-spec/paths/roles/_id/deleteRole.yaml @@ -0,0 +1,32 @@ +summary: Delete a Role +description: Delete an existing role +operationId: deleteRole +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Roles +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteRole } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteRole(role_id)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_roles_item(id: ID!): delete_one + } diff --git a/api-spec/paths/roles/_id/getRole.yaml b/api-spec/paths/roles/_id/getRole.yaml new file mode 100644 index 00000000..249dd8fe --- /dev/null +++ b/api-spec/paths/roles/_id/getRole.yaml @@ -0,0 +1,39 @@ +summary: Retrieve a Role +description: Retrieve a single role by unique identifier. +operationId: getRole +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Roles.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Roles +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readRole } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readRole(role_id, query_object)); + - label: GraphQL + lang: GraphQL + source: | + type Query { + roles_by_id(id: ID!): directus_roles + } diff --git a/api-spec/paths/roles/_id/index.yaml b/api-spec/paths/roles/_id/index.yaml new file mode 100644 index 00000000..dd6b7539 --- /dev/null +++ b/api-spec/paths/roles/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getRole.yaml +patch: + $ref: updateRole.yaml +delete: + $ref: deleteRole.yaml diff --git a/api-spec/paths/roles/_id/updateRole.yaml b/api-spec/paths/roles/_id/updateRole.yaml new file mode 100644 index 00000000..ee9bf9e6 --- /dev/null +++ b/api-spec/paths/roles/_id/updateRole.yaml @@ -0,0 +1,68 @@ +summary: Update a Role +description: Update an existing role +operationId: updateRole +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + type: object + properties: + description: + type: string + description: Description of the role. + enforce_tfa: + type: boolean + description: Whether or not this role enforces the use of 2FA. + external_id: + type: string + description: ID used with external services in SCIM. + ip_access: + type: array + description: Array of IP addresses that are allowed to connect to the + API as a user of this role. + items: + type: string + module_listing: + type: string + description: Custom override for the admin app module bar navigation. + name: + type: string + description: Name of the role. +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Roles.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Roles +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateRole } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateRole(role_id, partial_role_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_roles_item(id: ID!, data: update_directus_roles_input): directus_roles + } diff --git a/api-spec/paths/roles/createRoles.yaml b/api-spec/paths/roles/createRoles.yaml new file mode 100644 index 00000000..aff31d2f --- /dev/null +++ b/api-spec/paths/roles/createRoles.yaml @@ -0,0 +1,59 @@ +summary: Create Multiple Roles +description: Create multiple new roles. +operationId: createRoles +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Roles.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Roles.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Roles +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createRoles } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createRoles(roles_object_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + create_roles_items(data: [create_directus_roles_input!]!): [directus_roles] + } diff --git a/api-spec/paths/roles/deleteRoles.yaml b/api-spec/paths/roles/deleteRoles.yaml new file mode 100644 index 00000000..3ebef4e1 --- /dev/null +++ b/api-spec/paths/roles/deleteRoles.yaml @@ -0,0 +1,36 @@ +summary: Delete Multiple Roles +description: Delete multiple existing roles. +operationId: deleteRoles +requestBody: + description: An array of role primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Roles +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteRoles } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteRoles(role_id_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_roles_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/roles/getRoles.yaml b/api-spec/paths/roles/getRoles.yaml new file mode 100644 index 00000000..913a8515 --- /dev/null +++ b/api-spec/paths/roles/getRoles.yaml @@ -0,0 +1,50 @@ +summary: List Roles +description: List all roles that exist in Directus. +operationId: getRoles +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Page +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Roles.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Roles +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readRoles } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readRoles(query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + roles: [directus_roles] + } diff --git a/api-spec/paths/roles/index.yaml b/api-spec/paths/roles/index.yaml new file mode 100644 index 00000000..36fc1245 --- /dev/null +++ b/api-spec/paths/roles/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getRoles.yaml +post: + $ref: createRoles.yaml +patch: + $ref: updateRoles.yaml +delete: + $ref: deleteRoles.yaml diff --git a/api-spec/paths/roles/updateRoles.yaml b/api-spec/paths/roles/updateRoles.yaml new file mode 100644 index 00000000..d3406a60 --- /dev/null +++ b/api-spec/paths/roles/updateRoles.yaml @@ -0,0 +1,85 @@ +summary: Update Multiple Roles +description: Update multiple roles at the same time. +security: [] +tags: +- Roles +operationId: updateRoles +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - keys + - data + properties: + keys: + type: array + items: + type: string + data: + type: object + properties: + description: + type: string + description: Description of the role. + enforce_tfa: + type: boolean + description: Whether or not this role enforces the use of 2FA. + external_id: + type: string + description: ID used with external services in SCIM. + ip_access: + type: array + description: Array of IP addresses that are allowed to connect to + the API as a user of this role. + items: + type: string + module_listing: + type: string + description: Custom override for the admin app module bar navigation. + name: + type: string + description: Name of the role. + example: Interns +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Roles.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateRoles } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateRoles(role_id_array, partial_role_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_roles_items(ids: [ID!]!, data: update_directus_roles_input): [directus_roles] + } diff --git a/api-spec/paths/schema/apply/index.yaml b/api-spec/paths/schema/apply/index.yaml new file mode 100644 index 00000000..988b3ea2 --- /dev/null +++ b/api-spec/paths/schema/apply/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: schemaApply.yaml diff --git a/api-spec/paths/schema/apply/schemaApply.yaml b/api-spec/paths/schema/apply/schemaApply.yaml new file mode 100644 index 00000000..e5e0b601 --- /dev/null +++ b/api-spec/paths/schema/apply/schemaApply.yaml @@ -0,0 +1,189 @@ +summary: Apply Schema Difference +description: Update the instance's schema by passing the diff previously retrieved + via `/schema/diff` endpoint in the JSON request body or a JSON/YAML file. This endpoint + is only available to admin users. +operationId: schemaApply +requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Diff.yaml + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary +responses: + '204': + description: Successful request + '403': + $ref: ../../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Schema +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, schemaApply } from '@directus/sdk'; + + const client = createDirectus('https://directus.example.com').with(rest()); + + const result = await client.request( + schemaApply({ + hash: '7d4499bc1e09bab3558b46cc09cd83fea2c05144', + diff: { + collections: [ + { + collection: 'articles', + diff: [ + { + kind: 'N', + rhs: { + collection: 'articles', + meta: { + accountability: 'all', + archive_app_filter: true, + archive_field: null, + archive_value: null, + collapse: 'open', + collection: 'articles', + color: null, + display_template: null, + group: null, + hidden: false, + icon: null, + item_duplication_fields: null, + note: null, + singleton: false, + sort: null, + sort_field: null, + translations: null, + unarchive_value: null, + }, + schema: { + name: 'articles', + }, + }, + }, + ], + }, + ], + fields: [ + { + collection: 'articles', + field: 'id', + diff: [ + { + kind: 'N', + rhs: { + collection: 'articles', + field: 'id', + type: 'integer', + meta: { + collection: 'articles', + conditions: null, + display: null, + display_options: null, + field: 'id', + group: null, + hidden: true, + interface: 'input', + note: null, + options: null, + readonly: true, + required: false, + sort: null, + special: null, + translations: null, + validation: null, + validation_message: null, + width: 'full', + }, + schema: { + name: 'id', + table: 'articles', + data_type: 'integer', + default_value: null, + max_length: null, + numeric_precision: null, + numeric_scale: null, + is_nullable: false, + is_unique: false, + is_primary_key: true, + is_generated: false, + generation_expression: null, + has_auto_increment: true, + foreign_key_table: null, + foreign_key_column: null, + }, + }, + }, + ], + }, + { + collection: 'articles', + field: 'title', + diff: [ + { + kind: 'N', + rhs: { + collection: 'articles', + field: 'title', + type: 'string', + meta: { + collection: 'articles', + conditions: null, + display: null, + display_options: null, + field: 'title', + group: null, + hidden: false, + interface: 'input', + note: null, + options: null, + readonly: false, + required: false, + sort: null, + special: null, + translations: null, + validation: null, + validation_message: null, + width: 'full', + }, + schema: { + name: 'title', + table: 'articles', + data_type: 'varchar', + default_value: null, + max_length: 255, + numeric_precision: null, + numeric_scale: null, + is_nullable: true, + is_unique: false, + is_primary_key: false, + is_generated: false, + generation_expression: null, + has_auto_increment: false, + foreign_key_table: null, + foreign_key_column: null, + }, + }, + }, + ], + }, + ], + relations: [], + }, + }) + ); + - label: GraphQL + lang: GraphQL + source: | + // Not supported in GraphQL diff --git a/api-spec/paths/schema/diff/index.yaml b/api-spec/paths/schema/diff/index.yaml new file mode 100644 index 00000000..c55a8aee --- /dev/null +++ b/api-spec/paths/schema/diff/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: schemaDiff.yaml diff --git a/api-spec/paths/schema/diff/schemaDiff.yaml b/api-spec/paths/schema/diff/schemaDiff.yaml new file mode 100644 index 00000000..2fdf2dd8 --- /dev/null +++ b/api-spec/paths/schema/diff/schemaDiff.yaml @@ -0,0 +1,120 @@ +summary: Retrieve Schema Difference +description: | + Compare the current instance's schema against the schema snapshot in JSON request body and retrieve the difference. This endpoint is only available to admin users. + + Alternatively, upload a JSON or YAML schema file. + + Does not allow different Directus versions and database vendors by default. You can opt in to bypass these checks by passing the `force` query parameter. +operationId: schemaDiff +parameters: +- name: force + description: Bypass version and database vendor restrictions. + in: query + required: false + schema: + type: boolean +requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Schema.yaml + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Diff.yaml + '204': + description: No schema difference. + '403': + $ref: ../../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Schema +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + ::: details **Toggle Open to See Request** + + import { createDirectus, rest, schemaDiff } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request( + schemaDiff({ + version: version_num, + directus: 'directus_version', + vendor: 'database_type', + collections: [ + { + collection: 'collection_name', + meta: { + // Meta fields + }, + schema: { + // Schema fields + }, + }, + ], + fields: [ + { + collection: 'collection_name', + field: 'field_1_id', + type: 'field_1_type', + meta: { + // Meta fields + }, + schema: { + // Meta fields + }, + }, + { + collection: 'collection_name', + field: 'field_2_id', + type: 'field_2_type', + meta: { + // Meta fields + }, + schema: { + // Meta fields + }, + }, + { + collection: 'collection_name', + field: 'field_3_id', + type: 'field_3_type', + meta: { + // Meta fields + }, + schema: { + // Meta fields + }, + }, + ], + relations: [], + }) + ); + + console.dir(result, { depth: null }); + + ::: +- label: GraphQL + lang: GraphQL + source: | + // Not supported in GraphQL diff --git a/api-spec/paths/schema/snapshot/index.yaml b/api-spec/paths/schema/snapshot/index.yaml new file mode 100644 index 00000000..ede78ad1 --- /dev/null +++ b/api-spec/paths/schema/snapshot/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: schemaSnapshot.yaml diff --git a/api-spec/paths/schema/snapshot/schemaSnapshot.yaml b/api-spec/paths/schema/snapshot/schemaSnapshot.yaml new file mode 100644 index 00000000..73615ad6 --- /dev/null +++ b/api-spec/paths/schema/snapshot/schemaSnapshot.yaml @@ -0,0 +1,38 @@ +summary: Retrieve Schema Snapshot +description: Retrieve the current schema. This endpoint is only available to admin + users. +operationId: schemaSnapshot +parameters: +- $ref: ../../../components/parameters.yaml#/Export +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Schema.yaml + text/yaml: + schema: + type: string + format: binary + '403': + $ref: ../../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Schema +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, schemaSnapshot } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(schemaSnapshot()); +- label: GraphQL + lang: GraphQL + source: | + // Not supported in GraphQL diff --git a/api-spec/paths/server/health/index.yaml b/api-spec/paths/server/health/index.yaml new file mode 100644 index 00000000..970ff89e --- /dev/null +++ b/api-spec/paths/server/health/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: serverHealth.yaml diff --git a/api-spec/paths/server/health/serverHealth.yaml b/api-spec/paths/server/health/serverHealth.yaml new file mode 100644 index 00000000..abfba648 --- /dev/null +++ b/api-spec/paths/server/health/serverHealth.yaml @@ -0,0 +1,51 @@ +summary: Health +description: | + Shows you a general health status for the server and all connected (third party) services. + + By default, the endpoint only returns a status of ok, warn or error. + + By authenticating as an admin, it will return more in-depth information about the current health status of the system. +operationId: serverHealth +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + status: + description: One of ok, warn, error. + type: string + example: warn + releaseId: + description: Directus version in use. + type: string + example: '10.0.0' + serviceId: + description: Public URL of the current Directus instance. + type: string + example: https://directus.example.com + checks: + description: Array with the status of all individually connected services. + type: array +security: [] +tags: +- Server +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, serverHealth } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(serverHealth()); + - label: GraphQL + lang: GraphQL + source: | + GET /graphql/system + + type Query { + server_health: JSON + } diff --git a/api-spec/paths/server/info/index.yaml b/api-spec/paths/server/info/index.yaml new file mode 100644 index 00000000..46016aa1 --- /dev/null +++ b/api-spec/paths/server/info/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: serverInfo.yaml diff --git a/api-spec/paths/server/info/serverInfo.yaml b/api-spec/paths/server/info/serverInfo.yaml new file mode 100644 index 00000000..95e793f4 --- /dev/null +++ b/api-spec/paths/server/info/serverInfo.yaml @@ -0,0 +1,46 @@ +summary: System Info +description: Provides detailed information about the project server, its schema, and its health. +operationId: serverInfo +parameters: +- description: The first time you create a project, the provided token will be saved + and required for subsequent project installs. It can also be found and configured + in `/config/__api.json` on your server. + in: query + name: super_admin_token + required: true + schema: + type: integer +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Settings.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Server +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, serverInfo } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(serverInfo()); +- label: GraphQL + lang: GraphQL + source: | + GET /graphql/system + + type Query { + server_info: server_info + } diff --git a/api-spec/paths/server/ping/index.yaml b/api-spec/paths/server/ping/index.yaml new file mode 100644 index 00000000..fa33ebcc --- /dev/null +++ b/api-spec/paths/server/ping/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: ping.yaml diff --git a/api-spec/paths/server/ping/ping.yaml b/api-spec/paths/server/ping/ping.yaml new file mode 100644 index 00000000..146c3929 --- /dev/null +++ b/api-spec/paths/server/ping/ping.yaml @@ -0,0 +1,32 @@ +summary: Ping +description: Ping, pong. Ping.. pong. +operationId: ping +responses: + '200': + content: + application/text: + schema: + type: string + pattern: pong + example: pong + description: Successful request +security: [] +tags: +- Server +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, serverPing } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(serverPing()); + - label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + server_ping: String + } diff --git a/api-spec/paths/server/specs/graphql/index.yaml b/api-spec/paths/server/specs/graphql/index.yaml new file mode 100644 index 00000000..91dfb692 --- /dev/null +++ b/api-spec/paths/server/specs/graphql/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: readGraphqlSdl.yaml diff --git a/api-spec/paths/server/specs/graphql/readGraphqlSdl.yaml b/api-spec/paths/server/specs/graphql/readGraphqlSdl.yaml new file mode 100644 index 00000000..f0748edf --- /dev/null +++ b/api-spec/paths/server/specs/graphql/readGraphqlSdl.yaml @@ -0,0 +1,30 @@ +summary: Get GraphQL SDL +description: Retrieve the GraphQL SDL for the current project. +operationId: readGraphqlSdl +responses: + '200': + description: GraphQL SDL file. + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Server +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readGraphqlSdl } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readGraphqlSdl(scope)); +- label: GraphQL + lang: GraphQL + source: | + GET /graphql/system + + type Query { + server_specs_graphql(scope: graphql_sdl_scope): String + } diff --git a/api-spec/paths/server/specs/oas/index.yaml b/api-spec/paths/server/specs/oas/index.yaml new file mode 100644 index 00000000..145ffe8a --- /dev/null +++ b/api-spec/paths/server/specs/oas/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: readOpenApiSpec.yaml diff --git a/api-spec/paths/server/specs/oas/readOpenApiSpec.yaml b/api-spec/paths/server/specs/oas/readOpenApiSpec.yaml new file mode 100644 index 00000000..8d74f1bc --- /dev/null +++ b/api-spec/paths/server/specs/oas/readOpenApiSpec.yaml @@ -0,0 +1,35 @@ +summary: Get OpenAPI Specification +description: Retrieve the OpenAPI spec for the current project. +operationId: readOpenApiSpec +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + description: Object conforming to the OpenAPI Specification + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Server +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readOpenApiSpec } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readOpenApiSpec()); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + server_specs_oas: String + } diff --git a/api-spec/paths/settings/getSettings.yaml b/api-spec/paths/settings/getSettings.yaml new file mode 100644 index 00000000..9f4dd59c --- /dev/null +++ b/api-spec/paths/settings/getSettings.yaml @@ -0,0 +1,42 @@ +summary: Retrieve Settings +description: List the settings. +operationId: getSettings +parameters: +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Page +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../components/schemas/Settings.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Settings +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readSettings } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readSettings()); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + settings: directus_settings + } diff --git a/api-spec/paths/settings/index.yaml b/api-spec/paths/settings/index.yaml new file mode 100644 index 00000000..8af76254 --- /dev/null +++ b/api-spec/paths/settings/index.yaml @@ -0,0 +1,4 @@ +get: + $ref: getSettings.yaml +patch: + $ref: updateSettings.yaml diff --git a/api-spec/paths/settings/updateSettings.yaml b/api-spec/paths/settings/updateSettings.yaml new file mode 100644 index 00000000..e4d06e76 --- /dev/null +++ b/api-spec/paths/settings/updateSettings.yaml @@ -0,0 +1,46 @@ +summary: Update Settings +description: Update the settings +operationId: updateSettings +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../components/schemas/Settings.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../components/schemas/Settings.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Settings +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateSettings } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateSettings(settings_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_settings(data: update_directus_settings_input!): directus_settings + } diff --git a/api-spec/paths/shares/_id/deleteShare.yaml b/api-spec/paths/shares/_id/deleteShare.yaml new file mode 100644 index 00000000..ae25b413 --- /dev/null +++ b/api-spec/paths/shares/_id/deleteShare.yaml @@ -0,0 +1,36 @@ + +summary: Delete an share +description: Delete an existing share. +operationId: deleteShare +parameters: +- name: id + in: path + required: true + description: Unique identifier of the share. + schema: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Shares +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteShare } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteShare(share_id)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + delete_shares_item(id: ID!): delete_one + } diff --git a/api-spec/paths/shares/_id/getShare.yaml b/api-spec/paths/shares/_id/getShare.yaml new file mode 100644 index 00000000..6dff150a --- /dev/null +++ b/api-spec/paths/shares/_id/getShare.yaml @@ -0,0 +1,44 @@ +summary: Retrieve a share +description: List an existing share by primary key. +operationId: getShare +parameters: +- name: id + in: path + description: Unique identifier of the share. + schema: + type: string + required: true +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Shares.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Shares +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readShare } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readShare(share_id, query_object)); + - label: GraphQL + lang: GraphQL + source: | + type Query { + shares_by_id(id: ID!): directus_shares + } diff --git a/api-spec/paths/shares/_id/index.yaml b/api-spec/paths/shares/_id/index.yaml new file mode 100644 index 00000000..c58f5cb8 --- /dev/null +++ b/api-spec/paths/shares/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getShare.yaml +patch: + $ref: updateShare.yaml +delete: + $ref: deleteShare.yaml diff --git a/api-spec/paths/shares/_id/updateShare.yaml b/api-spec/paths/shares/_id/updateShare.yaml new file mode 100644 index 00000000..09523713 --- /dev/null +++ b/api-spec/paths/shares/_id/updateShare.yaml @@ -0,0 +1,50 @@ +summary: Update a share +description: Update an existing share. +operationId: updateShare +parameters: +- name: id + in: path + description: Unique identifier of the share. + schema: + type: string + required: true +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../../components/schemas/Shares.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Shares.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Shares +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateShare } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateShare(share_id, partial_share_object)); + - label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_shares_item(id: ID!, data: update_directus_shares_input): directus_shares + } diff --git a/api-spec/paths/shares/_share/getPublicShareInfo.yaml b/api-spec/paths/shares/_share/getPublicShareInfo.yaml new file mode 100644 index 00000000..c6553b29 --- /dev/null +++ b/api-spec/paths/shares/_share/getPublicShareInfo.yaml @@ -0,0 +1,40 @@ +summary: Send a Share by Email +description: Allows unauthenticated users to retrieve information about the share. +operationId: getPublicShareInfo +parameters: +- name: share + in: path + description: Unique identifier of the share. + schema: + type: string + required: true +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Shares.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Shares +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readShareInfo } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readShareInfo(share_id)); + - label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/shares/_share/index.yaml b/api-spec/paths/shares/_share/index.yaml new file mode 100644 index 00000000..9a6260cc --- /dev/null +++ b/api-spec/paths/shares/_share/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: getPublicShareInfo.yaml diff --git a/api-spec/paths/shares/auth/authenticateShare.yaml b/api-spec/paths/shares/auth/authenticateShare.yaml new file mode 100644 index 00000000..fd522ed2 --- /dev/null +++ b/api-spec/paths/shares/auth/authenticateShare.yaml @@ -0,0 +1,73 @@ +summary: Authenticate a Share +description: Authenticate as a share user. Shares work by returning a token, as it is the case with the regular login endpoint. These tokens are limited to a permissions set that only allows access to the item that was shared, and any relationally linked items that that associated role has access to. This means that all regular endpoints can be used with the token returned by this endpoint. +operationId: authenticateShare +requestBody: + content: + application/json: + schema: + type: object + required: + - share + properties: + share: + type: string + format: uuid + description: Primary key of the share you're authenticating against. + example: 3a606c3e-9d4d-4556-b7bb-f00860613da3 + password: + type: string + format: hash + description: Password for the share, if one is configured. + example: '**********' + mode: + type: string + enum: + - json + - cookie + - session + default: json + description: Whether to retrieve the refresh token in the JSON response, + or in a `httpOnly` cookie. +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + access_token: + type: string + description: 'Temporary access token to be used in follow-up requests. Note: if you used `session` as the mode in the request, the access token won\u0027t be returned in the JSON.' + example: eyJhbGciOiJI... + expires: + type: integer + description: How long before the access token will expire. Value is in milliseconds. + example: 900 + refresh_token: + type: string + description: 'The token that can be used to retrieve a new access token through `/auth/refresh`. Note: if you used `cookie` or `session` as the mode in the request, the refresh token won\u0027t be returned in the JSON.' + example: yuOJkjdPXMd... + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Shares +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, authenticateShare } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(authenticateShare('share_key', 'password')); +- label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/shares/auth/index.yaml b/api-spec/paths/shares/auth/index.yaml new file mode 100644 index 00000000..1b8441e1 --- /dev/null +++ b/api-spec/paths/shares/auth/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: authenticateShare.yaml diff --git a/api-spec/paths/shares/createShares.yaml b/api-spec/paths/shares/createShares.yaml new file mode 100644 index 00000000..f7cd60da --- /dev/null +++ b/api-spec/paths/shares/createShares.yaml @@ -0,0 +1,57 @@ +summary: Create Multiple shares +description: Create multiple new shares. +operationId: createShares +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Shares.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Shares.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Shares +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createShare } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createShares(share_object_array)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + create_shares_items(data: [create_directus_shares_input!]!): [directus_shares] + } diff --git a/api-spec/paths/shares/deleteShares.yaml b/api-spec/paths/shares/deleteShares.yaml new file mode 100644 index 00000000..a3c5d443 --- /dev/null +++ b/api-spec/paths/shares/deleteShares.yaml @@ -0,0 +1,37 @@ + +summary: Delete Multiple shares +description: Delete multiple existing shares. +operationId: deleteShares +requestBody: + description: An array of share primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Shares +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteShares } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteShares(share_id_array)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + delete_shares_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/shares/getShares.yaml b/api-spec/paths/shares/getShares.yaml new file mode 100644 index 00000000..0a630def --- /dev/null +++ b/api-spec/paths/shares/getShares.yaml @@ -0,0 +1,49 @@ + +summary: List shares +description: List all shares that exist in Directus. +operationId: getShares +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Page +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Shares.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Shares +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readShares } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readShares(query_object)); +- label: GraphQL + lang: GraphQL + source: | + type Query { + shares: [directus_shares] + } diff --git a/api-spec/paths/shares/index.yaml b/api-spec/paths/shares/index.yaml new file mode 100644 index 00000000..354697ee --- /dev/null +++ b/api-spec/paths/shares/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getShares.yaml +post: + $ref: createShares.yaml +patch: + $ref: updateShares.yaml +delete: + $ref: deleteShares.yaml diff --git a/api-spec/paths/shares/info/_id/getShareInfo.yaml b/api-spec/paths/shares/info/_id/getShareInfo.yaml new file mode 100644 index 00000000..44775cf6 --- /dev/null +++ b/api-spec/paths/shares/info/_id/getShareInfo.yaml @@ -0,0 +1,40 @@ +summary: Get Share Public Info +description: Allows unauthenticated users to retrieve information about the share. +operationId: getShareInfo +parameters: +- name: id + in: path + description: Unique identifier of the share. + schema: + type: string + required: true +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../../components/schemas/Shares.yaml + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Shares +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readShareInfo } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readShareInfo(share_id)); + - label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/shares/info/_id/index.yaml b/api-spec/paths/shares/info/_id/index.yaml new file mode 100644 index 00000000..6247dd2d --- /dev/null +++ b/api-spec/paths/shares/info/_id/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: getShareInfo.yaml diff --git a/api-spec/paths/shares/invite/index.yaml b/api-spec/paths/shares/invite/index.yaml new file mode 100644 index 00000000..4f1289cc --- /dev/null +++ b/api-spec/paths/shares/invite/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: inviteShare.yaml diff --git a/api-spec/paths/shares/invite/inviteShare.yaml b/api-spec/paths/shares/invite/inviteShare.yaml new file mode 100644 index 00000000..3934802b --- /dev/null +++ b/api-spec/paths/shares/invite/inviteShare.yaml @@ -0,0 +1,41 @@ +summary: Send a Share by Email +description: Sends an email to the provided email addresses with a link to the share. +operationId: inviteShare +requestBody: + content: + application/json: + schema: + type: object + required: + - share + properties: + share: + type: uuid + description: Primary key of the share you're authenticating against. + example: 3a606c3e-9d4d-4556-b7bb-f00860613da3 + emails: + type: array + description: Array of email strings to send the share link to. +responses: + '200': + description: Successful request + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Shares +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, inviteShare } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(inviteShare(share_id, email_address_array)); +- label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/shares/updateShares.yaml b/api-spec/paths/shares/updateShares.yaml new file mode 100644 index 00000000..1b394108 --- /dev/null +++ b/api-spec/paths/shares/updateShares.yaml @@ -0,0 +1,63 @@ + +summary: Update Multiple shares +description: Update multiple shares at the same time. +operationId: updatesShares +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - keys + - data + properties: + data: + $ref: ../../components/schemas/Shares.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Shares.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Shares +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateShares } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateShares(share_id_array, partial_share_object)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + update_shares_items(ids: [ID!]!, data: update_directus_shares_input): [directus_shares] + } diff --git a/api-spec/paths/translations/_id/deleteTranslation.yaml b/api-spec/paths/translations/_id/deleteTranslation.yaml new file mode 100644 index 00000000..8e71a731 --- /dev/null +++ b/api-spec/paths/translations/_id/deleteTranslation.yaml @@ -0,0 +1,34 @@ + +summary: Delete an Translation +description: Delete an existing Translation. +operationId: deleteTranslation +parameters: +- name: id + in: path + description: Unique identifier of the Translation. + required: true + schema: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Translations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteTranslation } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteTranslation(translation_id)); +- label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/translations/_id/getTranslation.yaml b/api-spec/paths/translations/_id/getTranslation.yaml new file mode 100644 index 00000000..a5eee523 --- /dev/null +++ b/api-spec/paths/translations/_id/getTranslation.yaml @@ -0,0 +1,42 @@ +summary: Retrieve a Translation +description: List an existing Translation by primary key. +operationId: getTranslation +parameters: +- name: id + in: path + description: Unique identifier of the Translation. + schema: + type: string + required: true +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Translations.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Translations +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readTranslation } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readTranslation(translation_id, query_object)); + - label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/translations/_id/index.yaml b/api-spec/paths/translations/_id/index.yaml new file mode 100644 index 00000000..c0aaec91 --- /dev/null +++ b/api-spec/paths/translations/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getTranslation.yaml +patch: + $ref: updateTranslation.yaml +delete: + $ref: deleteTranslation.yaml diff --git a/api-spec/paths/translations/_id/updateTranslation.yaml b/api-spec/paths/translations/_id/updateTranslation.yaml new file mode 100644 index 00000000..5e662496 --- /dev/null +++ b/api-spec/paths/translations/_id/updateTranslation.yaml @@ -0,0 +1,48 @@ +summary: Update a Translation +description: Update an existing Translation. +operationId: updateTranslation +parameters: +- name: id + in: path + description: Unique identifier of the Translation. + schema: + type: string + required: true +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../../components/schemas/Translations.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Translations.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Translations +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateTranslation } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateTranslation(translation_id, partial_translation_object)); + - label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/translations/createTranslations.yaml b/api-spec/paths/translations/createTranslations.yaml new file mode 100644 index 00000000..3b5f9cb9 --- /dev/null +++ b/api-spec/paths/translations/createTranslations.yaml @@ -0,0 +1,55 @@ +summary: Create Multiple Translations +description: Create multiple new translations. +operationId: createTranslations +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Translations.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Translations.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Translations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createtranslations } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createtranslations(translation_object_array)); +- label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/translations/deleteTranslations.yaml b/api-spec/paths/translations/deleteTranslations.yaml new file mode 100644 index 00000000..0b556858 --- /dev/null +++ b/api-spec/paths/translations/deleteTranslations.yaml @@ -0,0 +1,35 @@ + +summary: Delete Multiple Translations +description: Delete multiple existing translations. +operationId: deleteTranslations +requestBody: + description: An array of translation primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Translations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteTranslations } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteTranslations(translation_id_array)); +- label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/translations/getTranslations.yaml b/api-spec/paths/translations/getTranslations.yaml new file mode 100644 index 00000000..b9ac631c --- /dev/null +++ b/api-spec/paths/translations/getTranslations.yaml @@ -0,0 +1,47 @@ + +summary: List Translations +description: List all Translations that exist in Directus. +operationId: getTranslations +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Page +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Translations.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Translations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readTranlations } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readTranslations(query_object)); +- label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/translations/index.yaml b/api-spec/paths/translations/index.yaml new file mode 100644 index 00000000..cd48acac --- /dev/null +++ b/api-spec/paths/translations/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getTranslations.yaml +post: + $ref: createTranslations.yaml +patch: + $ref: updateTranslations.yaml +delete: + $ref: deleteTranslations.yaml diff --git a/api-spec/paths/translations/updateTranslations.yaml b/api-spec/paths/translations/updateTranslations.yaml new file mode 100644 index 00000000..6ede47d8 --- /dev/null +++ b/api-spec/paths/translations/updateTranslations.yaml @@ -0,0 +1,58 @@ + +summary: Update Multiple Translations +description: Update multiple Translations at the same time. +operationId: updateTranslations +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../components/schemas/Translations.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Translations.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Translations +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateTranslations } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateTranslations(translation_id_array, partial_translation_object)); +- label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/users/_id/deleteUser.yaml b/api-spec/paths/users/_id/deleteUser.yaml new file mode 100644 index 00000000..92d95c51 --- /dev/null +++ b/api-spec/paths/users/_id/deleteUser.yaml @@ -0,0 +1,32 @@ +summary: Delete a User +description: Delete an existing user +operationId: deleteUser +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteUser } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteUser(user_id)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_users_item(id: ID!): delete_one + } diff --git a/api-spec/paths/users/_id/getUser.yaml b/api-spec/paths/users/_id/getUser.yaml new file mode 100644 index 00000000..f184a6b0 --- /dev/null +++ b/api-spec/paths/users/_id/getUser.yaml @@ -0,0 +1,41 @@ +summary: Retrieve a User +description: List an existing user by primary key. +operationId: getUser +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Users.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readUser } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readUser(user_id, query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + users_by_id(id: ID!): directus_users + } diff --git a/api-spec/paths/users/_id/index.yaml b/api-spec/paths/users/_id/index.yaml new file mode 100644 index 00000000..e665e929 --- /dev/null +++ b/api-spec/paths/users/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getUser.yaml +patch: + $ref: updateUser.yaml +delete: + $ref: deleteUser.yaml diff --git a/api-spec/paths/users/_id/updateUser.yaml b/api-spec/paths/users/_id/updateUser.yaml new file mode 100644 index 00000000..16602f95 --- /dev/null +++ b/api-spec/paths/users/_id/updateUser.yaml @@ -0,0 +1,46 @@ +summary: Update a User +description: Update an existing user +operationId: updateUser +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + $ref: ../../../components/schemas/Users.yaml +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + type: object + description: Successful request + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateUser } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateUser(user_id, partial_user_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_users_item(id: ID!, data: update_directus_users_input!): directus_users + } diff --git a/api-spec/paths/users/createUsers.yaml b/api-spec/paths/users/createUsers.yaml new file mode 100644 index 00000000..028dc5da --- /dev/null +++ b/api-spec/paths/users/createUsers.yaml @@ -0,0 +1,61 @@ +summary: Create Multiple Users +description: Create multiple new users. +operationId: createUsers +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +- $ref: ../../components/parameters.yaml#/Page +requestBody: + description: "`email` and `password` are required." + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Users.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Users.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, createUsers } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(createUsers(user_object_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + create_users_items(data: [create_directus_users_input!]!): [directus_users] + } diff --git a/api-spec/paths/users/deleteUsers.yaml b/api-spec/paths/users/deleteUsers.yaml new file mode 100644 index 00000000..49a4b8cb --- /dev/null +++ b/api-spec/paths/users/deleteUsers.yaml @@ -0,0 +1,36 @@ +summary: Delete Multiple Users +description: Delete multiple existing users. +operationId: deleteUsers +requestBody: + description: An array of user primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteUsers } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteUsers(user_id_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_users_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/users/getUsers.yaml b/api-spec/paths/users/getUsers.yaml new file mode 100644 index 00000000..993dbc1b --- /dev/null +++ b/api-spec/paths/users/getUsers.yaml @@ -0,0 +1,49 @@ +summary: List Users +description: List all users that exist in Directus. +operationId: getUsers +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Users.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readUsers } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readUsers(query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + users: [directus_users] + } diff --git a/api-spec/paths/users/index.yaml b/api-spec/paths/users/index.yaml new file mode 100644 index 00000000..88835cd1 --- /dev/null +++ b/api-spec/paths/users/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getUsers.yaml +post: + $ref: createUsers.yaml +patch: + $ref: updateUsers.yaml +delete: + $ref: deleteUsers.yaml diff --git a/api-spec/paths/users/invite/accept/acceptInvite.yaml b/api-spec/paths/users/invite/accept/acceptInvite.yaml new file mode 100644 index 00000000..206b7f7e --- /dev/null +++ b/api-spec/paths/users/invite/accept/acceptInvite.yaml @@ -0,0 +1,47 @@ +summary: Accept User Invite +description: Accept your invite. The invite user endpoint sends the email a link to the Data Studio. This link includes a token, which is then used to activate the invited user. +operationId: acceptInvite +requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - token + - password + properties: + token: + type: string + example: eyJh...KmUk + description: Accept invite token. + password: + type: string + description: Password of the user. + format: password + example: d1r3ctu5 +responses: + '204': + description: Successful request + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, acceptUserInvite } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(acceptUserInvite(invite_token, user_password)); +- label: GraphQL + lang: GraphQL + source: | + type Mutation { + users_invite_accept(token: String!, password: String!): Boolean + } diff --git a/api-spec/paths/users/invite/accept/index.yaml b/api-spec/paths/users/invite/accept/index.yaml new file mode 100644 index 00000000..678bce1c --- /dev/null +++ b/api-spec/paths/users/invite/accept/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: acceptInvite.yaml diff --git a/api-spec/paths/users/invite/index.yaml b/api-spec/paths/users/invite/index.yaml new file mode 100644 index 00000000..15bd4363 --- /dev/null +++ b/api-spec/paths/users/invite/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: invite.yaml diff --git a/api-spec/paths/users/invite/invite.yaml b/api-spec/paths/users/invite/invite.yaml new file mode 100644 index 00000000..051018b7 --- /dev/null +++ b/api-spec/paths/users/invite/invite.yaml @@ -0,0 +1,51 @@ +summary: Invite User +description: Invites a user to this project. It creates a user with an + invited status, and then sends an email to the user with instructions on how to + activate their account. +operationId: invite +requestBody: + content: + application/json: + schema: + type: object + required: + - email + - role + properties: + email: + type: string + description: Email address of the to-be-invited user. + role: + description: Role of the new user + type: string + invite_url: + description: 'Provide a custom invite url which the link in the email will lead to. The invite token will be passed as a parameter. Note: You need to configure the USER_INVITE_URL_ALLOW_LIST environment variable to enable this feature.' + type: string + format: url +responses: + '204': + description: Successful request + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, inviteUser } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(inviteUser('another@example.com', 'c86c2761-65d3-43c3-897f-6f74ad6a5bd7')); + - label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + users_invite(email: String!, role: String!, invite_url: String): Boolean + } diff --git a/api-spec/paths/users/me/getMe.yaml b/api-spec/paths/users/me/getMe.yaml new file mode 100644 index 00000000..c6c6bff1 --- /dev/null +++ b/api-spec/paths/users/me/getMe.yaml @@ -0,0 +1,40 @@ +summary: Retrieve Current User +description: Retrieve the currently authenticated user. +operationId: getMe +parameters: +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Users.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readMe } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readMe(query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + users_me: directus_users + } diff --git a/api-spec/paths/users/me/index.yaml b/api-spec/paths/users/me/index.yaml new file mode 100644 index 00000000..9b9f4567 --- /dev/null +++ b/api-spec/paths/users/me/index.yaml @@ -0,0 +1,4 @@ +get: + $ref: getMe.yaml +patch: + $ref: updateMe.yaml diff --git a/api-spec/paths/users/me/tfa/disable/index.yaml b/api-spec/paths/users/me/tfa/disable/index.yaml new file mode 100644 index 00000000..2a0965a4 --- /dev/null +++ b/api-spec/paths/users/me/tfa/disable/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: meTfaDisable.yaml diff --git a/api-spec/paths/users/me/tfa/disable/meTfaDisable.yaml b/api-spec/paths/users/me/tfa/disable/meTfaDisable.yaml new file mode 100644 index 00000000..f0e56ca8 --- /dev/null +++ b/api-spec/paths/users/me/tfa/disable/meTfaDisable.yaml @@ -0,0 +1,41 @@ +summary: Disable Two-Factor Authentication +description: Disables two-factor authentication for the currently authenticated user. +operationId: meTfaDisable +requestBody: + content: + application/json: + schema: + type: object + required: + - otp + properties: + otp: + description: One-time password generated by the authenticator app. + type: string +responses: + '204': + description: Successful request + '401': + $ref: ../../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, disableTwoFactor } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(disableTwoFactor(otp)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + users_me_tfa_disable(otp: String!): Boolean + } diff --git a/api-spec/paths/users/me/tfa/enable/index.yaml b/api-spec/paths/users/me/tfa/enable/index.yaml new file mode 100644 index 00000000..007dfb71 --- /dev/null +++ b/api-spec/paths/users/me/tfa/enable/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: meTfaEnable.yaml diff --git a/api-spec/paths/users/me/tfa/enable/meTfaEnable.yaml b/api-spec/paths/users/me/tfa/enable/meTfaEnable.yaml new file mode 100644 index 00000000..94f28eeb --- /dev/null +++ b/api-spec/paths/users/me/tfa/enable/meTfaEnable.yaml @@ -0,0 +1,45 @@ +summary: Enable 2FA +description: Enables two-factor authentication for the currently authenticated user. +operationId: meTfaEnable +requestBody: + content: + application/json: + schema: + type: object + required: + - secret + - otp + properties: + secret: + description: 'The TFA secret from tfa/generate.' + type: string + otp: + description: OTP generated with the secret, to recheck if the user has a correct TFA setup + type: string +responses: + '204': + description: Successful request + '401': + $ref: ../../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, enableTwoFactor } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(enableTwoFactor(secret, otp)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + users_me_tfa_enable(otp: String!, secret: String!): Boolean + } diff --git a/api-spec/paths/users/me/tfa/generate/generateTwoFactorSecret.yaml b/api-spec/paths/users/me/tfa/generate/generateTwoFactorSecret.yaml new file mode 100644 index 00000000..373c3f62 --- /dev/null +++ b/api-spec/paths/users/me/tfa/generate/generateTwoFactorSecret.yaml @@ -0,0 +1,52 @@ +summary: Generate Two-Factor Authentication Secret +description: Generates a secret and returns the URL to be used in an authenticator app. +operationId: generateTwoFactorSecret +requestBody: + content: + application/json: + schema: + type: string + required: + - password + properties: + password: + description: The user's password. + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + secret: + type: string + description: OTP secret to be saved in the authenticator app. + otpauth_url: + type: string + description: 'otpauth:// formatted URL. Can be rendered as QR code and used in most authenticator apps.' + '401': + $ref: ../../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, generateTwoFactorSecret } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(generateTwoFactorSecret(user_password)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + users_me_tfa_generate(password: String!): users_me_tfa_generate_data + } diff --git a/api-spec/paths/users/me/tfa/generate/index.yaml b/api-spec/paths/users/me/tfa/generate/index.yaml new file mode 100644 index 00000000..b32fdce9 --- /dev/null +++ b/api-spec/paths/users/me/tfa/generate/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: generateTwoFactorSecret.yaml diff --git a/api-spec/paths/users/me/track/page/index.yaml b/api-spec/paths/users/me/track/page/index.yaml new file mode 100644 index 00000000..a20d8bc3 --- /dev/null +++ b/api-spec/paths/users/me/track/page/index.yaml @@ -0,0 +1,2 @@ +patch: + $ref: updateLastUsedPageMe.yaml diff --git a/api-spec/paths/users/me/track/page/updateLastUsedPageMe.yaml b/api-spec/paths/users/me/track/page/updateLastUsedPageMe.yaml new file mode 100644 index 00000000..6270ddef --- /dev/null +++ b/api-spec/paths/users/me/track/page/updateLastUsedPageMe.yaml @@ -0,0 +1,24 @@ +summary: Update Last Page +description: Updates the last used page field of the currently authenticated user. + This is used internally to be able to open the Directus admin app from the last + page you used. +operationId: updateLastUsedPageMe +requestBody: + content: + application/json: + schema: + type: object + properties: + last_page: + type: string + description: Path of the page you used last. +responses: + '200': + description: Successful request + '401': + $ref: ../../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users diff --git a/api-spec/paths/users/me/updateMe.yaml b/api-spec/paths/users/me/updateMe.yaml new file mode 100644 index 00000000..0a943f2a --- /dev/null +++ b/api-spec/paths/users/me/updateMe.yaml @@ -0,0 +1,40 @@ +summary: Update Current User +description: Update the currently authenticated user. +operationId: updateMe +parameters: +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Users.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateMe } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateMe(partial_user_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_users_me(data: update_directus_users_input!): directus_users + } diff --git a/api-spec/paths/users/register/index.yaml b/api-spec/paths/users/register/index.yaml new file mode 100644 index 00000000..b3983b93 --- /dev/null +++ b/api-spec/paths/users/register/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: registerUser.yaml diff --git a/api-spec/paths/users/register/registerUser.yaml b/api-spec/paths/users/register/registerUser.yaml new file mode 100644 index 00000000..8cce1243 --- /dev/null +++ b/api-spec/paths/users/register/registerUser.yaml @@ -0,0 +1,57 @@ +summary: Register a new User +description: Register a new user. +operationId: registerUser +parameters: +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + type: object + required: + - email + - password + properties: + email: + type: string + description: 'Email for the new user.' + password: + type: string + description: 'Password for the new user.' + first_name: + type: string + description: 'First name for the new user.' + last_name: + type: string + description: 'Last name for the new user.' + verification_url: + type: string + description: 'Provide a custom verification url which the link in the email will lead to. The verification token will be passed as a parameter. Note: You need to configure the USER_REGISTER_URL_ALLOW_LIST environment variable to enable this feature.' +responses: + '204': + description: Successful request + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, registerUser } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + await client.request(registerUser(user_email, user_password)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + users_register(email: String!, password: String!): True + } diff --git a/api-spec/paths/users/register/verify-email/_token/index.yaml b/api-spec/paths/users/register/verify-email/_token/index.yaml new file mode 100644 index 00000000..446e9475 --- /dev/null +++ b/api-spec/paths/users/register/verify-email/_token/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: registerUserVerify.yaml diff --git a/api-spec/paths/users/register/verify-email/_token/registerUserVerify.yaml b/api-spec/paths/users/register/verify-email/_token/registerUserVerify.yaml new file mode 100644 index 00000000..245d62d6 --- /dev/null +++ b/api-spec/paths/users/register/verify-email/_token/registerUserVerify.yaml @@ -0,0 +1,37 @@ +summary: Verify Registered Email +description: Verify the registered email address. The register user endpoint sends the email a link for verification. This link includes a token, which is then used to activate the registered user. +operationId: registerUserVerify +parameters: +- description: Emailed registration token. + in: path + name: token + required: true + schema: + type: string +responses: + '204': + description: Successful request + '401': + $ref: ../../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Users +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, verifyUserEmail } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + await client.request(registerUserVerify(emailed_token)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + users_register_verify(token: String!): True + } diff --git a/api-spec/paths/users/updateUsers.yaml b/api-spec/paths/users/updateUsers.yaml new file mode 100644 index 00000000..5bbca484 --- /dev/null +++ b/api-spec/paths/users/updateUsers.yaml @@ -0,0 +1,59 @@ +summary: Update Multiple Users +description: Update multiple users at the same time. +security: [] +tags: +- Users +operationId: updateUsers +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../components/schemas/Users.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Users.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateUsers } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateUsers(user_id_array, partial_user_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_users_items(ids: [ID!]!, data: update_directus_users_input!): [directus_users] + } diff --git a/api-spec/paths/utils/cache/clear/clear-cache.yaml b/api-spec/paths/utils/cache/clear/clear-cache.yaml new file mode 100644 index 00000000..567d3b2a --- /dev/null +++ b/api-spec/paths/utils/cache/clear/clear-cache.yaml @@ -0,0 +1,24 @@ +summary: Clear the Internal Cache +description: Resets the data cache of Directus. Optionally, can also clear system cache. This endpoint is only available to admin users. +operationId: clear-cache +responses: + '200': + description: Successful request +security: [] +tags: +- Utilities +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, clearCache } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(clearCache()); + - label: GraphQL + lang: GraphQL + source: | + mutation { + utils_cache_clear + } diff --git a/api-spec/paths/utils/cache/clear/index.yaml b/api-spec/paths/utils/cache/clear/index.yaml new file mode 100644 index 00000000..8916579a --- /dev/null +++ b/api-spec/paths/utils/cache/clear/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: clear-cache.yaml diff --git a/api-spec/paths/utils/export/_collection/export.yaml b/api-spec/paths/utils/export/_collection/export.yaml new file mode 100644 index 00000000..753bc1e2 --- /dev/null +++ b/api-spec/paths/utils/export/_collection/export.yaml @@ -0,0 +1,66 @@ +summary: Export Data to a File +description: Export a larger data set to a file in the file library. +operationId: export +parameters: +- description: Collection identifier + in: path + name: collection + required: true + schema: + type: string +requestBody: + content: + application/json: + schema: + properties: + format: + type: string + description: 'What file format to save the export to. One of `csv`, `xml`,`json`' + enum: + - csv + - xml + - json + query: + $ref: ../../../../components/schemas/Query.yaml + file: + $ref: ../../../../components/schemas/Files.yaml + required: + - format + - query + - file +responses: + '200': + description: Successful request +security: [] +tags: +- Utilities +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, utilsExport } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request( + utilsExport( + 'collection_name', + 'file_format', + { + query_type: { + field: { + query_operation: 'value', + }, + }, + }, + { + file: { + file_field: 'value', + }, + } + ) + ); + - label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/utils/export/_collection/index.yaml b/api-spec/paths/utils/export/_collection/index.yaml new file mode 100644 index 00000000..b0fa4462 --- /dev/null +++ b/api-spec/paths/utils/export/_collection/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: export.yaml diff --git a/api-spec/paths/utils/hash/generate/hash-generate.yaml b/api-spec/paths/utils/hash/generate/hash-generate.yaml new file mode 100644 index 00000000..c19ce7b7 --- /dev/null +++ b/api-spec/paths/utils/hash/generate/hash-generate.yaml @@ -0,0 +1,45 @@ +summary: Generate a Hash. +description: Generate a hash for a given string. +operationId: hash-generate +requestBody: + content: + application/json: + schema: + properties: + string: + type: string + description: String to hash. + required: + - string +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + type: string + example: + $argon2i$v=19$m=4096,t=3,p=1$pOyIa/zmRAjCVLb2f7kOyg$DasoO6LzMM+6iKfzCDq6JbsYsZWLSm33p7i9NxL9mDc + description: Successful request +security: [] +tags: +- Utilities +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, generateHash } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(generateHash(string_to_hash)); + - label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + utils_hash_generate(string: String!): String + } diff --git a/api-spec/paths/utils/hash/generate/index.yaml b/api-spec/paths/utils/hash/generate/index.yaml new file mode 100644 index 00000000..43c816f6 --- /dev/null +++ b/api-spec/paths/utils/hash/generate/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: hash-generate.yaml diff --git a/api-spec/paths/utils/hash/verify/hash-verify.yaml b/api-spec/paths/utils/hash/verify/hash-verify.yaml new file mode 100644 index 00000000..1e10e838 --- /dev/null +++ b/api-spec/paths/utils/hash/verify/hash-verify.yaml @@ -0,0 +1,48 @@ +summary: Verify a Hash. +description: Verify a string with a hash. +operationId: hash-verify +requestBody: + content: + application/json: + schema: + properties: + string: + type: string + description: String to hash. + hash: + type: string + description: Hash you want to verify against. + required: + - string + - hash +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + type: boolean + example: true + description: Successful request +security: [] +tags: +- Utilities +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, verifyHash } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(verifyHash(string_to_verify, hash)); + - label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + utils_hash_verify(hash: String!, string: String!): Boolean + } diff --git a/api-spec/paths/utils/hash/verify/index.yaml b/api-spec/paths/utils/hash/verify/index.yaml new file mode 100644 index 00000000..f3b4e0dd --- /dev/null +++ b/api-spec/paths/utils/hash/verify/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: hash-verify.yaml diff --git a/api-spec/paths/utils/import/_collection/import.yaml b/api-spec/paths/utils/import/_collection/import.yaml new file mode 100644 index 00000000..477cb4d0 --- /dev/null +++ b/api-spec/paths/utils/import/_collection/import.yaml @@ -0,0 +1,41 @@ +summary: Import Data from File +description: Import multiple records from a JSON or CSV file into a collection. +operationId: import +parameters: +- description: Collection identifier + in: path + name: collection + required: true + schema: + type: string +requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + file: + type: string + format: binary +responses: + '200': + description: Successful request +security: [] +tags: +- Utilities +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, utilsImport } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const formData = new FormData(); + formData.append('file', raw_file); + + const result = await client.request(utilsImport(formData)); + - label: GraphQL + lang: GraphQL + source: | + // Not currently available in GraphQL diff --git a/api-spec/paths/utils/import/_collection/index.yaml b/api-spec/paths/utils/import/_collection/index.yaml new file mode 100644 index 00000000..e8223fea --- /dev/null +++ b/api-spec/paths/utils/import/_collection/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: import.yaml diff --git a/api-spec/paths/utils/random/string/index.yaml b/api-spec/paths/utils/random/string/index.yaml new file mode 100644 index 00000000..137c5188 --- /dev/null +++ b/api-spec/paths/utils/random/string/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: random.yaml diff --git a/api-spec/paths/utils/random/string/random.yaml b/api-spec/paths/utils/random/string/random.yaml new file mode 100644 index 00000000..1a8bffe0 --- /dev/null +++ b/api-spec/paths/utils/random/string/random.yaml @@ -0,0 +1,41 @@ +summary: Get a Random String +description: Returns a random string of given length. +operationId: random +parameters: +- description: Length of the random string. + in: query + name: length + required: false + schema: + type: integer +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + type: string + example: 1>M3+4oh.S + description: Successful request +security: [] +tags: +- Utilities +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, randomString } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(randomString(length)); + - label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + utils_random_string(length: Int): String + } diff --git a/api-spec/paths/utils/sort/_collection/index.yaml b/api-spec/paths/utils/sort/_collection/index.yaml new file mode 100644 index 00000000..c5cbbf52 --- /dev/null +++ b/api-spec/paths/utils/sort/_collection/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: sort.yaml diff --git a/api-spec/paths/utils/sort/_collection/sort.yaml b/api-spec/paths/utils/sort/_collection/sort.yaml new file mode 100644 index 00000000..840cdbca --- /dev/null +++ b/api-spec/paths/utils/sort/_collection/sort.yaml @@ -0,0 +1,44 @@ +summary: Manually Sort Items in Collection +description: Re-sort items in collection based on start and to value of item +operationId: sort +parameters: +- description: Collection identifier + in: path + name: collection + required: true + schema: + type: string +requestBody: + content: + application/json: + schema: + properties: + item: + type: number + description: Primary key of item to move + to: + type: number + description: Primary key of item where to move the current item to +responses: + '200': + description: Successful request +security: [] +tags: +- Utilities +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, utilitySort } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(utilitySort(collection_name, id_item_to_move, id_item_moving_to)); + - label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + utils_sort(collection: String!, item: ID!, to: ID!): Boolean + } diff --git a/api-spec/paths/versions/_id/compare/compareContentVersion.yaml b/api-spec/paths/versions/_id/compare/compareContentVersion.yaml new file mode 100644 index 00000000..aaeaf726 --- /dev/null +++ b/api-spec/paths/versions/_id/compare/compareContentVersion.yaml @@ -0,0 +1,35 @@ +summary: Compare a Content Version +description: Compare an existing Content Version with the main version of the item. +operationId: compareContentVersion +parameters: +- $ref: ../../../../components/parameters.yaml#/UUId +responses: + '200': + content: + application/json: + schema: + type: object + properties: + data: + type: object + description: Successful request + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Versions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, compareContentVersion } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(compareContentVersion(content_version_id)); +- label: GraphQL + lang: GraphQL + source: | + // Not supported in GraphQL diff --git a/api-spec/paths/versions/_id/compare/index.yaml b/api-spec/paths/versions/_id/compare/index.yaml new file mode 100644 index 00000000..a9d98a43 --- /dev/null +++ b/api-spec/paths/versions/_id/compare/index.yaml @@ -0,0 +1,2 @@ +get: + $ref: compareContentVersion.yaml diff --git a/api-spec/paths/versions/_id/deleteContentVersion.yaml b/api-spec/paths/versions/_id/deleteContentVersion.yaml new file mode 100644 index 00000000..02deffb3 --- /dev/null +++ b/api-spec/paths/versions/_id/deleteContentVersion.yaml @@ -0,0 +1,32 @@ +summary: Delete a Content Version +description: Delete an existing Content Version. +operationId: deleteContentVersion +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Versions +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteContentVersion } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteContentVersion(content_version_id)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_versions_item(id: ID!): delete_one + } diff --git a/api-spec/paths/versions/_id/getContentVersion.yaml b/api-spec/paths/versions/_id/getContentVersion.yaml new file mode 100644 index 00000000..d2028283 --- /dev/null +++ b/api-spec/paths/versions/_id/getContentVersion.yaml @@ -0,0 +1,41 @@ +summary: Retrieve a Content Version +description: Retrieve a single Content Version by unique identifier. +operationId: getContentVersion +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Versions.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Versions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readContentVersion } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readContentVersion(content_version_id, query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + versions_by_id(id: ID!): directus_versions + } diff --git a/api-spec/paths/versions/_id/index.yaml b/api-spec/paths/versions/_id/index.yaml new file mode 100644 index 00000000..7eaca2b8 --- /dev/null +++ b/api-spec/paths/versions/_id/index.yaml @@ -0,0 +1,6 @@ +get: + $ref: getContentVersion.yaml +patch: + $ref: updateContentVersion.yaml +delete: + $ref: deleteContentVersion.yaml diff --git a/api-spec/paths/versions/_id/promote/index.yaml b/api-spec/paths/versions/_id/promote/index.yaml new file mode 100644 index 00000000..53569720 --- /dev/null +++ b/api-spec/paths/versions/_id/promote/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: promoteContentVersion.yaml diff --git a/api-spec/paths/versions/_id/promote/promoteContentVersion.yaml b/api-spec/paths/versions/_id/promote/promoteContentVersion.yaml new file mode 100644 index 00000000..4161626b --- /dev/null +++ b/api-spec/paths/versions/_id/promote/promoteContentVersion.yaml @@ -0,0 +1,46 @@ +summary: Promote a Content Version +description: Promote an existing Content Version to become the new main version of the item. +operationId: promoteContentVersion +parameters: +- $ref: ../../../../components/parameters.yaml#/UUId +requestBody: + content: + application/json: + schema: + type: object + properties: + mainHash: + type: string + description: Hash of the main version of the item to be promoted. + fields: + type: string + description: Optional array of field names of which the values are to + be promoted. +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: string + description: The primary key of the promoted item. + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Versions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, promoteContentVersion } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(promoteContentVersion(content_version_id, promote_object)); +- label: GraphQL + lang: GraphQL + source: | + // Not supported in GraphQL diff --git a/api-spec/paths/versions/_id/save/index.yaml b/api-spec/paths/versions/_id/save/index.yaml new file mode 100644 index 00000000..535c352b --- /dev/null +++ b/api-spec/paths/versions/_id/save/index.yaml @@ -0,0 +1,2 @@ +post: + $ref: saveContentVersion.yaml diff --git a/api-spec/paths/versions/_id/save/saveContentVersion.yaml b/api-spec/paths/versions/_id/save/saveContentVersion.yaml new file mode 100644 index 00000000..f3ca8d75 --- /dev/null +++ b/api-spec/paths/versions/_id/save/saveContentVersion.yaml @@ -0,0 +1,35 @@ +summary: Save to a Content Version +description: Save item changes to an existing Content Version. +operationId: saveContentVersion +parameters: +- $ref: ../../../../components/parameters.yaml#/UUId +responses: + '200': + description: Successful request, Returns the item object with the new state after save. + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../../components/schemas/Items.yaml + '401': + $ref: ../../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Versions +x-codeSamples: + - label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, saveToContentVersion } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(saveToContentVersion(content_version_id, partial_item_object)); + - label: GraphQL + lang: GraphQL + source: | + // Not supported in GraphQL diff --git a/api-spec/paths/versions/_id/updateContentVersion.yaml b/api-spec/paths/versions/_id/updateContentVersion.yaml new file mode 100644 index 00000000..814aef9e --- /dev/null +++ b/api-spec/paths/versions/_id/updateContentVersion.yaml @@ -0,0 +1,47 @@ +summary: Update a Content Version +description: Update an existing Content Version. +operationId: updateContentVersion +parameters: +- $ref: ../../../components/parameters.yaml#/UUId +- $ref: ../../../components/parameters.yaml#/Fields +- $ref: ../../../components/parameters.yaml#/Meta +requestBody: + content: + application/json: + schema: + anyOf: + - $ref: ../../../components/schemas/Versions.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + $ref: ../../../components/schemas/Versions.yaml + '401': + $ref: ../../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Versions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateContentVersion } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateContentVersion(content_version_id, partial_content_version_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_versions_item(id: ID!, data: update_directus_versions_input!): directus_versions + } diff --git a/api-spec/paths/versions/createContentVersions.yaml b/api-spec/paths/versions/createContentVersions.yaml new file mode 100644 index 00000000..c224205c --- /dev/null +++ b/api-spec/paths/versions/createContentVersions.yaml @@ -0,0 +1,57 @@ +summary: Create Multiple Content Versions +description: Create multiple new Content Versions. +operationId: createContentVersions +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Versions.yaml +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Versions.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Versions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateContentVersions } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateContentVersions(content_version_id_array, partial_content_version_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_versions_items(ids: [ID!]!, data: update_directus_versions_input!): [directus_versions] + } diff --git a/api-spec/paths/versions/deleteContentVersions.yaml b/api-spec/paths/versions/deleteContentVersions.yaml new file mode 100644 index 00000000..7a416230 --- /dev/null +++ b/api-spec/paths/versions/deleteContentVersions.yaml @@ -0,0 +1,36 @@ +summary: Delete Multiple Content Versions +description: Delete multiple existing Content Versions. +operationId: deleteContentVersions +requestBody: + description: An array of content version primary keys. + content: + application/json: + schema: + type: array + items: + type: string +responses: + '204': + description: The resource was deleted successfully. + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Versions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, deleteContentVersions } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(deleteContentVersions(content_version_id_array)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + delete_versions_items(ids: [ID!]!): delete_many + } diff --git a/api-spec/paths/versions/getContentVersions.yaml b/api-spec/paths/versions/getContentVersions.yaml new file mode 100644 index 00000000..3facbc13 --- /dev/null +++ b/api-spec/paths/versions/getContentVersions.yaml @@ -0,0 +1,49 @@ +summary: List Content Versions +description: List all Content Versions that exist in Directus. +operationId: getContentVersions +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Versions.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError + '404': + $ref: ../../components/responses.yaml#/NotFoundError +security: [] +tags: +- Versions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, readContentVersions } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(readContentVersions(query_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Query { + versions: [directus_versions] + } diff --git a/api-spec/paths/versions/index.yaml b/api-spec/paths/versions/index.yaml new file mode 100644 index 00000000..3cbbe567 --- /dev/null +++ b/api-spec/paths/versions/index.yaml @@ -0,0 +1,8 @@ +get: + $ref: getContentVersions.yaml +post: + $ref: createContentVersions.yaml +patch: + $ref: updateContentVersions.yaml +delete: + $ref: deleteContentVersions.yaml diff --git a/api-spec/paths/versions/updateContentVersions.yaml b/api-spec/paths/versions/updateContentVersions.yaml new file mode 100644 index 00000000..85f8bed7 --- /dev/null +++ b/api-spec/paths/versions/updateContentVersions.yaml @@ -0,0 +1,63 @@ +summary: Update Multiple Content Versions +description: Update multiple Content Versions at the same time. +operationId: updateContentVersions +parameters: +- $ref: ../../components/parameters.yaml#/Fields +- $ref: ../../components/parameters.yaml#/Limit +- $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/Offset +- $ref: ../../components/parameters.yaml#/Sort +- $ref: ../../components/parameters.yaml#/Filter +- $ref: ../../components/parameters.yaml#/Search +requestBody: + content: + application/json: + schema: + type: object + required: + - data + - keys + properties: + data: + anyOf: + - $ref: ../../components/schemas/Versions.yaml + keys: + type: array + items: + type: string +responses: + '200': + description: Successful request + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: ../../components/schemas/Versions.yaml + meta: + $ref: ../../components/schemas/x-metadata.yaml + '401': + $ref: ../../components/responses.yaml#/UnauthorizedError +security: [] +tags: +- Versions +x-codeSamples: +- label: Directus SDK + lang: JavaScript + source: | + import { createDirectus, rest, updateContentVersions } from '@directus/sdk'; + + const client = createDirectus('directus_project_url').with(rest()); + + const result = await client.request(updateContentVersions(content_version_id_array, partial_content_version_object)); +- label: GraphQL + lang: GraphQL + source: | + POST /graphql/system + + type Mutation { + update_versions_items(ids: [ID!]!, data: update_directus_versions_input!): [directus_versions] + } diff --git a/package.json b/package.json index 91b90677..dffab76e 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "type": "module", "scripts": { "oas:dev": "nodemon --watch './api-spec/**/*.yaml' --exec 'pnpm oas:build && pnpm scalar serve ./public/oas.yaml -p 5001' --ext yaml", - "oas:build": "redocly bundle api-spec/index.yaml -o public/oas.yaml --ext yaml", - "oas:lint": "redocly lint ./api-spec/index.yaml", + "oas:build": "redocly bundle ./api-spec/index.yaml -o ./public/oas.yaml --ext yaml", + "oas:lint": "redocly lint --max-problems=1000 ./api-spec/index.yaml", "nuxt:build": "nuxt generate", "nuxt:dev": "nuxt dev", "nuxt:preview": "pnpm dlx serve .output/public -p 3000",