updates api specs

This commit is contained in:
Thulio Prado
2020-10-05 16:47:01 -03:00
parent 96fa38f12c
commit ceb08b86d6
16 changed files with 693 additions and 234 deletions

View File

@@ -19,7 +19,7 @@ properties:
nullable: true
status:
description: The status of the webhook.
type: boolean
type: string
example: inactive
data:
description: If yes, send the content of what was done
@@ -27,9 +27,15 @@ properties:
example: true
actions:
description: The actions that triggers this webhook.
type: array
items:
type: string
example: null
nullable: true
collections:
description: The collections that triggers this webhook.
type: array
items:
type: string
example: null
nullable: true

View File

@@ -36,20 +36,14 @@ tags:
description: Folders don't do anything yet, but will be used in the (near) future to be able to group files.
- name: Items
description: Items are individual pieces of data in your database. They can be anything, from articles, to IoT status checks.
- name: Mail
description: Send electronic mail through the electronic post.
- name: Permissions
description: Permissions control who has access to what and when.
- name: Projects
description: Projects are the individual tenants of the platform. Each project has its own database and data.
- 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.
- 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.
- name: Roles
description: Roles are groups of users that share permissions.
- name: SCIM
description: Directus partially supports Version 2 of System for Cross-domain Identity Management (SCIM). It is an open standard that allows for the exchange of user information between systems, therefore allowing users to be externally managed using the endpoints described below.
- 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.
- name: Settings
@@ -106,7 +100,7 @@ paths:
# Collections
/collections:
$ref: "./paths/collections/collections.yaml"
/collections/{collection}:
/collections/{id}:
$ref: "./paths/collections/collection.yaml"
# Extensions
@@ -114,6 +108,8 @@ paths:
$ref: "./paths/extensions/interfaces.yaml"
/layouts:
$ref: "./paths/extensions/layouts.yaml"
/displays:
$ref: "./paths/extensions/displays.yaml"
/modules:
$ref: "./paths/extensions/modules.yaml"
@@ -122,7 +118,7 @@ paths:
$ref: "./paths/fields/fields.yaml"
/fields/{collection}:
$ref: "./paths/fields/collection-fields.yaml"
/fields/{collection}/{field}:
/fields/{collection}/{id}:
$ref: "./paths/fields/collection-field.yaml"
# Files
@@ -141,10 +137,6 @@ paths:
/folders/{id}:
$ref: "./paths/folders/folder.yaml"
# Mail
/mail:
$ref: "./paths/mail/mail.yaml"
# Permissions
/permissions:
$ref: "./paths/permissions/permissions.yaml"
@@ -152,8 +144,6 @@ paths:
$ref: "./paths/permissions/permissions-me.yaml"
/permissions/{id}:
$ref: "./paths/permissions/permission.yaml"
/permissions/me/{collection}:
$ref: "./paths/permissions/permissions-me-collection.yaml"
# Relations
/relations:
@@ -167,7 +157,7 @@ paths:
/revisions/{id}:
$ref: "./paths/revisions/revision.yaml"
# Revisions
# Roles
/roles:
$ref: "./paths/roles/roles.yaml"
/roles/{id}:
@@ -190,16 +180,22 @@ paths:
# Users
/users:
$ref: "./paths/users/users.yaml"
/users/me:
$ref: "./paths/users/me.yaml"
/users/invite:
$ref: "./paths/users/user-invite.yaml"
/users/{id}:
$ref: "./paths/users/user.yaml"
/users/invite/{token}:
$ref: "./paths/users/user-invite-token.yaml"
/users/{id}/track/page:
$ref: "./paths/users/user-tracking.yaml"
/users/invite:
$ref: "./paths/users/user-invite.yaml"
/users/invite/accept:
$ref: "./paths/users/user-invite-accept.yaml"
/users/me:
$ref: "./paths/users/me.yaml"
/users/me/track/page:
$ref: "./paths/users/me-tracking.yaml"
/users/me/tfa/enable:
$ref: "./paths/users/me-tfa-enable.yaml"
/users/me/tfa/disable:
$ref: "./paths/users/me-tfa-disable.yaml"
# Utilities
/utils/hash:
@@ -208,10 +204,14 @@ paths:
$ref: "./paths/utils/hash-match.yaml"
/utils/random/string:
$ref: "./paths/utils/random.yaml"
/utils/sort/{collection}:
$ref: "./paths/utils/sort.yaml"
# Webhooks
/webhooks:
$ref: "./paths/webhooks/webhooks.yaml"
/webhooks/{id}:
$ref: "./paths/webhooks/webhook.yaml"
components:
schemas:

View File

@@ -30,24 +30,63 @@ patch:
schema:
type: object
properties:
note:
type: string
description: A note describing the collection.
hidden:
type: boolean
description: Whether or not the collection is hidden from the navigation in the admin app.
single:
type: string
description: Whether or not the collection is treated as a single record.
managed:
type: string
description: If Directus is tracking and managing this collection currently.
icon:
type: string
description: Name of a Google Material Design Icon that's assigned to this collection.
translation:
meta:
description: Metadata of the collection.
type: object
description: Key value pairs of how to show this collection's name in different languages in the admin app.
properties:
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: null
nullable: true
display_template:
description: Text representation of how items from this collection are shown across the system.
type: string
example: null
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: null
nullable: true
archive_field:
description: What field holds the archive value.
type: string
example: null
nullable: true
archive_app_filter:
description: What value to use for "archived" items.
type: string
example: null
nullable: true
archive_value:
description: What value to use to "unarchive" items.
type: string
example: null
nullable: true
unarchive_value:
description: Whether or not to show the "archived" filter.
type: string
example: null
nullable: true
sort_field:
description: The sort field in the collection.
type: string
example: null
nullable: true
responses:
"200":
content:
@@ -77,9 +116,9 @@ delete:
tags:
- Collections
parameters:
- name: collection
- name: id
in: path
required: true
description: The unique name of the collection.
description: Unique identifier of the collection.
schema:
type: string

View File

@@ -40,26 +40,63 @@ post:
description: Unique name of the collection.
example: my_collection
fields:
type: object
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.
note:
type: string
description: A note describing the collection.
hidden:
type: string
description: Whether or not the collection is hidden from the navigation in the admin app.
single:
type: string
description: Whether or not the collection is treated as a single record.
managed:
type: string
description: If Directus is tracking and managing this collection currently.
items:
type: object
icon:
type: string
description: Name of a Google Material Design Icon that's assigned to this collection.
translation:
type: string
example: people
nullable: true
note:
description: A note describing the collection.
type: string
example: null
nullable: true
display_template:
description: Text representation of how items from this collection are shown across the system.
type: string
example: null
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: null
nullable: true
archive_field:
description: What field holds the archive value.
type: string
example: null
nullable: true
archive_app_filter:
description: What value to use for "archived" items.
type: string
example: null
nullable: true
archive_value:
description: What value to use to "unarchive" items.
type: string
example: null
nullable: true
unarchive_value:
description: Whether or not to show the "archived" filter.
type: string
example: null
nullable: true
sort_field:
description: The sort field in the collection.
type: string
example: null
nullable: true
responses:
"200":
content:

View File

@@ -1,11 +1,8 @@
get:
description: List the permissions that apply to the current user for the given collection
operationId: Enter text here
parameters:
- $ref: "#/components/parameters/Collection"
description: List all installed custom displays.
operationId: getDisplays
responses:
"200":
description: Successful request
content:
application/json:
schema:
@@ -14,10 +11,11 @@ get:
data:
type: array
items:
$ref: "#/components/schemas/Permissions"
type: object
description: Successful request
"401":
$ref: "#/components/responses/UnauthorizedError"
"404":
$ref: "#/components/responses/NotFoundError"
tags:
- Permissions
- Extensions

View File

@@ -24,66 +24,170 @@ patch:
content:
application/json:
schema:
properties:
datatype:
description: SQL datatype of the column that corresponds to this field.
type: string
auto_increment:
description: If the value in this field is auto incremented. Only applies to integer type fields.
type: boolean
group:
description: What field group this field is part of.
type: string
hidden_browse:
description: If this field should be hidden from the item browse (listing) page.
type: boolean
hidden_detail:
description: If this field should be hidden from the item detail (edit) page.
type: boolean
interface:
description: What interface is used in the admin app to edit the value for this field.
type: string
locked:
description: If the field can be altered by the end user. Directus system fields have this value set to `true`.
type: boolean
note:
description: A user provided note for the field. Will be rendered alongside the interface on the edit page.
type: string
options:
description: Options for the interface that's used. This format is based on the individual interface.
type: object
primary_key:
description: If this field is the primary key of the collection.
type: boolean
readonly:
description: Prevents the user from editing the value in the field.
type: boolean
required:
description: If this field requires a value.
type: boolean
signed:
description: If the value is signed or not. Only applies to integer type fields.
type: boolean
sort:
description: Sort order of this field on the edit page of the admin app.
type: integer
translation:
description: "Key value pair of `<locale>: <translation>` that allows the user to change the displayed name of the field in the admin app."
type: object
unique:
description: If the value of this field should be unique within the collection.
type: boolean
validation:
description: User provided regex that will be used in the API to validate incoming values.
type: string
width:
description: Width of the field on the edit form.
type: string
enum: [half, half-left, half-right, full, fill]
length:
description: Length of the field. Will be used in SQL to set the length property of the colummn. Requirement of this attribute depends on the provided datatype.
type: integer
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: null
type: string
nullable: true
max_length:
description: The max length of the field.
example: null
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: null
type: string
nullable: true
foreign_key_table:
description: Related table from the foreign key constraint.
example: null
type: string
nullable: true
comment:
description: Comment as saved in the database.
example: null
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: null
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: null
type: array
items:
type: string
nullable: true
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: null
type: object
nullable: true
display:
description: What display is used in the admin app to display the value for this field.
example: null
type: string
nullable: true
display_options:
description: Options for the display that's used. This format is based on the individual display.
example: null
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: null
type: string
nullable: true
enum: [half, half-left, half-right, full, fill, null]
group:
description: What field group this field is part of.
example: null
type: integer
nullable: true
translation:
description:
"Key value pair of `<locale>: <translation>` that allows the user
to change the displayed name of the field in the admin app."
example: null
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
@@ -100,7 +204,6 @@ patch:
$ref: "#/components/responses/NotFoundError"
tags:
- Fields
delete:
description: Delete an existing field.
operationId: deleteField
@@ -120,9 +223,9 @@ parameters:
schema:
type: string
required: true
- name: field
- name: id
in: path
description: The unique name of the field.
description: Unique identifier of the field.
schema:
type: string
required: true

View File

@@ -29,72 +29,170 @@ post:
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.
type: string
datatype:
description: SQL datatype of the column that corresponds to this field.
example: id
type: string
type:
description: Directus specific data type. Used to cast values in the API.
example: integer
type: string
auto_increment:
description: If the value in this field is auto incremented. Only applies to integer type fields.
type: boolean
group:
description: What field group this field is part of.
type: string
hidden_browse:
description: If this field should be hidden from the item browse (listing) page.
type: boolean
hidden_detail:
description: If this field should be hidden from the item detail (edit) page.
type: boolean
interface:
description: What interface is used in the admin app to edit the value for this field.
type: string
locked:
description: If the field can be altered by the end user. Directus system fields have this value set to `true`.
type: boolean
note:
description: A user provided note for the field. Will be rendered alongside the interface on the edit page.
type: string
options:
description: Options for the interface that's used. This format is based on the individual interface.
schema:
description: The schema info.
type: object
primary_key:
description: If this field is the primary key of the collection.
type: boolean
readonly:
description: Prevents the user from editing the value in the field.
type: boolean
required:
description: If this field requires a value.
type: boolean
signed:
description: If the value is signed or not. Only applies to integer type fields.
type: boolean
sort:
description: Sort order of this field on the edit page of the admin app.
type: integer
translation:
description: "Key value pair of `<locale>: <translation>` that allows the user to change the displayed name of the field in the admin app."
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: null
type: string
nullable: true
max_length:
description: The max length of the field.
example: null
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: null
type: string
nullable: true
foreign_key_table:
description: Related table from the foreign key constraint.
example: null
type: string
nullable: true
comment:
description: Comment as saved in the database.
example: null
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: null
type: string
nullable: true
meta:
description: The meta info.
type: object
unique:
description: If the value of this field should be unique within the collection.
type: boolean
validation:
description: User provided regex that will be used in the API to validate incoming values.
type: string
width:
description: Width of the field on the edit form.
type: string
enum: [half, half-left, half-right, full, fill]
length:
description: Length of the field. Will be used in SQL to set the length property of the colummn. Requirement of this attribute depends on the provided datatype.
type: integer
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: null
type: array
items:
type: string
nullable: true
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: null
type: object
nullable: true
display:
description: What display is used in the admin app to display the value for this field.
example: null
type: string
nullable: true
display_options:
description: Options for the display that's used. This format is based on the individual display.
example: null
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: null
type: string
nullable: true
enum: [half, half-left, half-right, full, fill, null]
group:
description: What field group this field is part of.
example: null
type: integer
nullable: true
translation:
description:
"Key value pair of `<locale>: <translation>` that allows the user
to change the displayed name of the field in the admin app."
example: null
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:

View File

@@ -1,52 +0,0 @@
post:
description: Send an email
operationId: sendMail
requestBody:
content:
application/json:
schema:
type: object
properties:
to:
description: User ID, email address, or object in the format { email, name }. You can send an email to multiple people at the same time by passing an array here.
type: array
example: ["user@example.com", "admin@example.com"]
items:
type: string
format: email
body:
description: Body of the email.
type: string
example: "Hello <b>{{name}}</b>, this is your new password: {{password}}."
data:
description: Key value pairs of variables that can be used in the body.
type: object
properties:
name:
type: string
example: John Doe
password:
type: string
example: secret
subject:
description: Email subject.
type: string
example: New Password
type:
description: HTML or plain text
example: html
type: string
enum: [html, text]
responses:
"200":
content:
application/json:
schema:
type: string
description: Successful request
"401":
$ref: "#/components/responses/UnauthorizedError"
"404":
$ref: "#/components/responses/NotFoundError"
tags:
- Mail

View File

@@ -0,0 +1,12 @@
post:
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

View File

@@ -0,0 +1,12 @@
post:
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

View File

@@ -0,0 +1,23 @@
patch:
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

View File

@@ -20,3 +20,22 @@ get:
$ref: "#/components/responses/NotFoundError"
tags:
- Users
patch:
description: Update the currently authenticated user.
operationId: me
responses:
"200":
description: Successful request
content:
application/json:
schema:
type: object
properties:
data:
$ref: "#/components/schemas/User"
"401":
$ref: "#/components/responses/UnauthorizedError"
"404":
$ref: "#/components/responses/NotFoundError"
tags:
- Users

View File

@@ -0,0 +1,23 @@
get:
description: Returns a random string of given length.
operationId: sort
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

View File

@@ -0,0 +1,87 @@
get:
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/Webhook"
"401":
$ref: "#/components/responses/UnauthorizedError"
"404":
$ref: "#/components/responses/NotFoundError"
tags:
- Webhooks
patch:
description: Update an existing webhook
operationId: updateWebhook
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: null
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: null
collections:
description: The collections that triggers this webhook.
example: null
type: object
responses:
"200":
description: Successful request
content:
application/json:
schema:
type: object
properties:
data:
$ref: "#/components/schemas/Role"
"401":
$ref: "#/components/responses/UnauthorizedError"
"404":
$ref: "#/components/responses/NotFoundError"
tags:
- Webhooks
delete:
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"

View File

@@ -17,3 +17,57 @@ get:
$ref: "#/components/responses/NotFoundError"
tags:
- Webhooks
post:
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: null
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: null
collections:
description: The collections that triggers this webhook.
example: null
type: object
responses:
"200":
description: Successful request
content:
application/json:
schema:
type: object
properties:
data:
$ref: "#/components/schemas/Role"
"401":
$ref: "#/components/responses/UnauthorizedError"
"404":
$ref: "#/components/responses/NotFoundError"
tags:
- Webhooks