Skip to content

Instantly share code, notes, and snippets.

@SebastianStehle
Created November 17, 2021 10:47
Show Gist options
  • Save SebastianStehle/120493bea981f95228484cb3b8d906b8 to your computer and use it in GitHub Desktop.
Save SebastianStehle/120493bea981f95228484cb3b8d906b8 to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.0",
"info": {
"title": "Squidex Content API for 'self' App",
"description": "# Introduction\r\n\r\nThe API provides two specifications. The Content API usually returns one object per schema field where the keys are the languages (or `iv` for non-localized) fields and the values are the actual field values.\r\n\r\nYou can use the `X-Flatten` header to return a flat structure when you query content items. This is more performant and easier for code generation. Unfortunantely it cannot be modelled with OpenAPI. Therefore we provide two different documents for your API.\r\n\r\nRead more about this here: https://docs.squidex.io/02-documentation/concepts/localization#how-to-use-the-api\r\n\r\n## Normal Content API\r\n\r\nAll content fields are objects in the response.\r\n\r\nGo to: https://localhost:5001/api/content/self/docs/\r\n\r\n## Flat Content API\r\n\r\nAll content fields are single values.\r\n\r\nGo to: https://localhost:5001/api/content/self/docs/flat/",
"version": "1.0.0.0",
"x-logo": {
"url": "https://localhost:5001/images/logo-white.png",
"backgroundColor": "#3f83df"
}
},
"servers": [
{
"url": "https://localhost:5001/api"
}
],
"paths": {
"/content/self/self/": {
"get": {
"tags": [
"Self"
],
"summary": "Query 'Self' contents items.",
"description": "How to make queries?\r\n\r\nRead more about it at: https://docs.squidex.io/04-guides/02-api.html\r\n\r\nThe query endpoints support three options:\r\n\r\n### Query with OData\r\n\r\nSquidex supports a subset of the OData (https://www.odata.org/) syntax with with the following query options:\r\n\r\n* **$top**: The $top query option requests the number of items in the queried collection to be included in the result. The default value is 20 and the maximum allowed value is 200. You can change the maximum in the app settings, when you host Squidex yourself.\r\n* **$skip**: The $skip query option requests the number of items in the queried collection that are to be skipped and not included in the result. Use it together with $top to read the all your data page by page. \r\n* **$search**: The $search query option allows clients to request entities matching a free-text search expression. We add the data of all fields for all languages to our full text engine.\r\n* **$filter**: The $filter query option allows clients to filter a collection of resources that are addressed by a request URL.\r\n* **$orderby**: The $orderby query option allows clients to request resources in a particular order.\r\n\r\n### Query with JSON query\r\n\r\nSquidex also supports a query syntax based on JSON. You have to pass in the query object as query parameter:\r\n\r\n* **q**: A json text that represents the same query options as with OData, but is more performant to parse.\r\n\r\n### Query by IDs\r\n\r\nQuery your items by passing in one or many IDs with the following query parameter:\r\n\r\n* **ids**: A comma-separated list of ids. If you define this option all other settings are ignored.",
"operationId": "QuerySelfContent",
"parameters": [
{
"name": "$search",
"in": "query",
"description": "Optional number of contents to skip.",
"schema": {
"type": "string"
}
},
{
"name": "$top",
"in": "query",
"description": "Optional number of contents to take.",
"schema": {
"type": "number"
}
},
{
"name": "$skip",
"in": "query",
"description": "Optional number of contents to skip.",
"schema": {
"type": "number"
}
},
{
"name": "$orderby",
"in": "query",
"description": "Optional OData order definition.",
"schema": {
"type": "string"
}
},
{
"name": "$filter",
"in": "query",
"description": "Optional OData filter.",
"schema": {
"type": "string"
}
},
{
"name": "q",
"in": "query",
"description": "JSON query as well formatted json string. Overrides all other query parameters, except 'ids'.",
"schema": {
"type": "string"
}
},
{
"name": "ids",
"in": "query",
"description": "Comma separated list of object IDs. Overrides all other query parameters.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Content items retrieved.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelfContentResultDto"
}
}
}
},
"400": {
"description": "Query not valid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
},
"500": {
"description": "Operation failed.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
}
},
"security": [
{
"squidex-oauth-auth": [
"squidex.apps.self.contents.self.read.own"
]
}
]
},
"post": {
"tags": [
"Self"
],
"summary": "Create a 'Self' content item.",
"operationId": "CreateSelfContent",
"parameters": [
{
"name": "publish",
"in": "query",
"description": "True to automatically publish the content.",
"schema": {
"type": "boolean"
}
},
{
"name": "id",
"in": "query",
"description": "The optional custom content id.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"x-name": "data",
"description": "The data of the content.\r\n \r\nPlease note that each field is an object with one entry per language. \r\nIf the field is not localizable you must use `iv` (invariant language) as a key.\r\n\r\nRead more about it at: https://docs.squidex.io/04-guides/02-api.html",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelfDataDto"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Content item created",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelfContentDto"
}
}
}
},
"400": {
"description": "Content data not valid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
},
"500": {
"description": "Operation failed.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
}
},
"security": [
{
"squidex-oauth-auth": [
"squidex.apps.self.contents.self.create"
]
}
]
}
},
"/content/self/self/{id}": {
"get": {
"tags": [
"Self"
],
"summary": "Get a 'Self' content item.",
"operationId": "GetSelfContent",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The ID of the object.",
"schema": {
"type": "string"
}
}
],
"responses": {
"404": {
"description": "Content item not found."
},
"200": {
"description": "Content item returned.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelfContentDto"
}
}
}
},
"500": {
"description": "Operation failed.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
}
},
"security": [
{
"squidex-oauth-auth": [
"squidex.apps.self.contents.self.read.own"
]
}
]
},
"post": {
"tags": [
"Self"
],
"summary": "Upsert a 'Self' content item.",
"operationId": "UpsertSelfContent",
"parameters": [
{
"name": "publish",
"in": "query",
"description": "True to automatically publish the content.",
"schema": {
"type": "boolean"
}
},
{
"name": "id",
"in": "path",
"required": true,
"description": "The ID of the object.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"x-name": "data",
"description": "The data of the content.\r\n \r\nPlease note that each field is an object with one entry per language. \r\nIf the field is not localizable you must use `iv` (invariant language) as a key.\r\n\r\nRead more about it at: https://docs.squidex.io/04-guides/02-api.html",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelfDataDto"
}
}
},
"required": true
},
"responses": {
"404": {
"description": "Content item not found."
},
"200": {
"description": "Content item created or updated.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelfContentDto"
}
}
}
},
"400": {
"description": "Content data not valid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
},
"500": {
"description": "Operation failed.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
}
},
"security": [
{
"squidex-oauth-auth": [
"squidex.apps.self.contents.self.upsert"
]
}
]
},
"put": {
"tags": [
"Self"
],
"summary": "Update a 'Self' content item.",
"operationId": "UpdateSelfContent",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The ID of the object.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"x-name": "data",
"description": "The data of the content.\r\n \r\nPlease note that each field is an object with one entry per language. \r\nIf the field is not localizable you must use `iv` (invariant language) as a key.\r\n\r\nRead more about it at: https://docs.squidex.io/04-guides/02-api.html",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelfDataDto"
}
}
},
"required": true
},
"responses": {
"404": {
"description": "Content item not found."
},
"200": {
"description": "Content item updated.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelfContentDto"
}
}
}
},
"400": {
"description": "Content data not valid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
},
"500": {
"description": "Operation failed.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
}
},
"security": [
{
"squidex-oauth-auth": [
"squidex.apps.self.contents.self.update.own"
]
}
]
},
"patch": {
"tags": [
"Self"
],
"summary": "Patch a 'Self' content item.",
"operationId": "PatchSelfContent",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The ID of the object.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"x-name": "data",
"description": "The data of the content.\r\n \r\nPlease note that each field is an object with one entry per language. \r\nIf the field is not localizable you must use `iv` (invariant language) as a key.\r\n\r\nRead more about it at: https://docs.squidex.io/04-guides/02-api.html",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelfDataDto"
}
}
},
"required": true
},
"responses": {
"404": {
"description": "Content item not found."
},
"200": {
"description": "Content item updated.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelfContentDto"
}
}
}
},
"400": {
"description": "Content data not valid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
},
"500": {
"description": "Operation failed.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
}
},
"security": [
{
"squidex-oauth-auth": [
"squidex.apps.self.contents.self.update.own"
]
}
]
},
"delete": {
"tags": [
"Self"
],
"summary": "Delete a 'Self' content item.",
"operationId": "DeleteSelfContent",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The ID of the object.",
"schema": {
"type": "string"
}
}
],
"responses": {
"404": {
"description": "Content item not found."
},
"204": {
"description": "Content item deleted"
},
"500": {
"description": "Operation failed.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
}
},
"security": [
{
"squidex-oauth-auth": [
"squidex.apps.self.contents.self.delete.own"
]
}
]
}
},
"/content/self/self/{id}/{version}": {
"get": {
"tags": [
"Self"
],
"summary": "Get a 'Self' content item by id and version.",
"operationId": "GetSelfContent2",
"parameters": [
{
"name": "version",
"in": "path",
"required": true,
"description": "The version of the content item.",
"schema": {
"type": "number"
}
},
{
"name": "id",
"in": "path",
"required": true,
"description": "The ID of the object.",
"schema": {
"type": "string"
}
}
],
"responses": {
"404": {
"description": "Content item not found."
},
"200": {
"description": "Content item returned.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelfContentDto"
}
}
}
},
"500": {
"description": "Operation failed.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
}
},
"security": [
{
"squidex-oauth-auth": [
"squidex.apps.self.contents.self.read.own"
]
}
]
}
},
"/content/self/self/{id}/validity": {
"get": {
"tags": [
"Self"
],
"summary": "Validates a 'Self' content item.",
"operationId": "ValidateSelfContent",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The ID of the object.",
"schema": {
"type": "string"
}
}
],
"responses": {
"404": {
"description": "Content item not found."
},
"200": {
"description": "Content item is valid."
},
"400": {
"description": "Content item is not valid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
},
"500": {
"description": "Operation failed.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
}
},
"security": [
{
"squidex-oauth-auth": [
"squidex.apps.self.contents.self.read.own"
]
}
]
}
},
"/content/self/self/{id}/status": {
"put": {
"tags": [
"Self"
],
"summary": "Change the status of a 'Self' content item.",
"operationId": "ChangeSelfContent",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "The ID of the object.",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"x-name": "request",
"description": "The request to change content status.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ChangeStatusDto"
}
}
},
"required": true
},
"responses": {
"404": {
"description": "Content item not found."
},
"200": {
"description": "Content status updated.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelfContentDto"
}
}
}
},
"400": {
"description": "Content status not valid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
},
"500": {
"description": "Operation failed.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
}
},
"security": [
{
"squidex-oauth-auth": [
"squidex.apps.self.contents.self.changestatus.own"
]
}
]
}
},
"/content/self/": {
"get": {
"tags": [
"__Shared"
],
"summary": "Query contents across all schemas.",
"operationId": "Query__SharedContent",
"parameters": [
{
"name": "ids",
"in": "query",
"description": "Comma-separated list of content IDs.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Content items retrieved.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ContentResultDto"
}
}
}
},
"400": {
"description": "Query not valid.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
},
"500": {
"description": "Operation failed.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorDto"
}
}
}
}
},
"security": [
{
"squidex-oauth-auth": [
"squidex.apps.self.contents.__Shared.read.own"
]
}
]
}
}
},
"components": {
"schemas": {
"ChangeStatusDto": {
"type": "object",
"additionalProperties": false,
"required": [
"status"
],
"properties": {
"status": {
"type": "string",
"description": "The new status.",
"minLength": 1
},
"dueTime": {
"type": "string",
"description": "The due time.",
"format": "date-time",
"nullable": true
},
"checkReferrers": {
"type": "boolean",
"description": "True to check referrers of this content."
}
}
},
"SelfComponentDto": {
"type": "object",
"additionalProperties": false,
"properties": {
"self": {
"type": "object",
"discriminator": {
"propertyName": "schemaId",
"mapping": {
"self": "#/components/schemas/SelfComponentDto"
}
},
"description": "self",
"nullable": true,
"required": [
"schemaId"
],
"properties": {
"schemaId": {
"type": "string",
"nullable": false
}
},
"oneOf": [
{
"$ref": "#/components/schemas/SelfComponentDto"
}
]
}
}
},
"SelfDataDto": {
"type": "object",
"additionalProperties": false,
"properties": {
"self": {
"type": "object",
"description": "self",
"nullable": true,
"additionalProperties": {
"type": "object",
"discriminator": {
"propertyName": "schemaId",
"mapping": {
"self": "#/components/schemas/SelfComponentDto"
}
},
"nullable": true,
"required": [
"schemaId"
],
"properties": {
"schemaId": {
"type": "string",
"nullable": false
}
},
"oneOf": [
{
"$ref": "#/components/schemas/SelfComponentDto"
}
]
}
}
}
},
"SelfFlatDataDto": {
"type": "object",
"additionalProperties": false,
"properties": {
"self": {
"type": "object",
"discriminator": {
"propertyName": "schemaId",
"mapping": {
"self": "#/components/schemas/SelfComponentDto"
}
},
"description": "self",
"nullable": true,
"required": [
"schemaId"
],
"properties": {
"schemaId": {
"type": "string",
"nullable": false
}
},
"oneOf": [
{
"$ref": "#/components/schemas/SelfComponentDto"
}
]
}
}
},
"SelfContentDto": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"created",
"createdBy",
"lastModified",
"lastModifiedBy",
"status",
"schema",
"SchemaName",
"statusColor",
"data"
],
"properties": {
"id": {
"type": "string",
"description": "The ID of the object.",
"nullable": false
},
"created": {
"type": "string",
"description": "The timestamp when the object was created.",
"format": "date-time",
"nullable": false
},
"createdBy": {
"type": "string",
"description": "The user who created the object.",
"nullable": false
},
"lastModified": {
"type": "string",
"description": "The timestamp when the object was updated the last time.",
"format": "date-time",
"nullable": false
},
"lastModifiedBy": {
"type": "string",
"description": "The user who updated the object the last time.",
"nullable": false
},
"newStatus": {
"type": "string",
"description": "The new status of the content.",
"nullable": true
},
"status": {
"type": "string",
"description": "The status of the content.",
"nullable": false
},
"newStatusColor": {
"type": "string",
"description": "The new status color of the content.",
"nullable": true
},
"schema": {
"type": "string",
"description": "The name of the schema.",
"nullable": false
},
"SchemaName": {
"type": "string",
"description": "The display name of the schema.",
"nullable": false
},
"statusColor": {
"type": "string",
"description": "The status color of the content.",
"nullable": false
},
"data": {
"description": "The data of the content.",
"nullable": false,
"$ref": "#/components/schemas/SelfFlatDataDto"
}
}
},
"SelfContentResultDto": {
"type": "object",
"additionalProperties": false,
"required": [
"total",
"items"
],
"properties": {
"total": {
"type": "number",
"description": "The total count of contents.",
"nullable": false
},
"items": {
"type": "array",
"description": "The contents.",
"nullable": false,
"items": {
"$ref": "#/components/schemas/SelfContentDto"
}
}
}
},
"DataDto": {},
"ContentDto": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"created",
"createdBy",
"lastModified",
"lastModifiedBy",
"status",
"schema",
"SchemaName",
"statusColor",
"data"
],
"properties": {
"id": {
"type": "string",
"description": "The ID of the object.",
"nullable": false
},
"created": {
"type": "string",
"description": "The timestamp when the object was created.",
"format": "date-time",
"nullable": false
},
"createdBy": {
"type": "string",
"description": "The user who created the object.",
"nullable": false
},
"lastModified": {
"type": "string",
"description": "The timestamp when the object was updated the last time.",
"format": "date-time",
"nullable": false
},
"lastModifiedBy": {
"type": "string",
"description": "The user who updated the object the last time.",
"nullable": false
},
"newStatus": {
"type": "string",
"description": "The new status of the content.",
"nullable": true
},
"status": {
"type": "string",
"description": "The status of the content.",
"nullable": false
},
"newStatusColor": {
"type": "string",
"description": "The new status color of the content.",
"nullable": true
},
"schema": {
"type": "string",
"description": "The name of the schema.",
"nullable": false
},
"SchemaName": {
"type": "string",
"description": "The display name of the schema.",
"nullable": false
},
"statusColor": {
"type": "string",
"description": "The status color of the content.",
"nullable": false
},
"data": {
"description": "The data of the content.",
"nullable": false,
"$ref": "#/components/schemas/DataDto"
}
}
},
"ContentResultDto": {
"type": "object",
"additionalProperties": false,
"required": [
"total",
"items"
],
"properties": {
"total": {
"type": "number",
"description": "The total count of contents.",
"nullable": false
},
"items": {
"type": "array",
"description": "The contents.",
"nullable": false,
"items": {
"$ref": "#/components/schemas/ContentDto"
}
}
}
},
"ErrorDto": {
"type": "object",
"additionalProperties": false,
"required": [
"message"
],
"properties": {
"message": {
"type": "string",
"description": "Error message.",
"minLength": 1
},
"errorCode": {
"type": "string",
"description": "The error code.",
"nullable": true
},
"traceId": {
"type": "string",
"description": "The optional trace id.",
"nullable": true
},
"type": {
"type": "string",
"description": "Link to the error details.",
"nullable": true
},
"details": {
"type": "array",
"description": "Detailed error messages.",
"nullable": true,
"items": {
"type": "string"
}
},
"statusCode": {
"type": "integer",
"description": "Status code of the http response.",
"format": "int32"
}
}
}
},
"securitySchemes": {
"squidex-oauth-auth": {
"type": "oauth2",
"description": "Squidex uses oauth2 client authentication. Read more about it at: https://oauth.net/2/ and https://tools.ietf.org/html/rfc6750.\r\n\r\nTo retrieve an access token, the client id must make a request to the token url. For example:\r\n\r\n $ curl\r\n -X POST 'https://localhost:5001/identity-server/connect/token' \r\n -H 'Content-Type: application/x-www-form-urlencoded' \r\n -d 'grant_type=client_credentials&\r\n client_id=[CLIENT_ID]&\r\n client_secret=[CLIENT_SECRET]&\r\n\t\t\tscope=squidex-api'\r\n\r\nYou must send this token in the `Authorization` header when making requests to the API:\r\n\r\n Authorization: Bearer <token>",
"flows": {
"clientCredentials": {
"tokenUrl": "https://localhost:5001/identity-server/connect/token",
"scopes": {
"squidex-api": "Read and write access to the API"
}
}
}
}
}
},
"security": [
{
"squidex-oauth-auth": []
}
],
"tags": [
{
"name": "Self",
"description": "API endpoints for 'Self' content items."
},
{
"name": "__Shared",
"description": "API endpoints for operations across all schemas."
}
],
"externalDocs": {
"url": "https://docs.squidex.io"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment