You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dc-rest/documentation/swagger-categories.json

364 lines
8.8 KiB
JSON

{
"swagger": "2.0",
"info": {
"title": "Dotclear API Categories Method",
"description": "Search Create Update Delete Categories",
"version": "0.0.2"
},
"host": "dotclear.localhost",
"schemes": [
"http"
],
"basePath": "/dotclear/index.php?rest",
"produces": [
"application/json"
],
"paths": {
"/{blog-id}/categories": {
"get": {
"summary": "Get list of available categories",
"parameters": [
{
"name": "x_dc_key",
"in": "header",
"type": "string",
"required": false
},
{
"name": "blog-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "filters",
"in": "query",
"type": "string",
"required": false,
"description": "UrlEncoded filters Separate each of them by a space ( \"+\" once urlencoded). Values are between double quotes Sample cat_title%3D%22SearchedTitle%22+cat_url%3D%22searched%2Furl%22 Available keys are \"cat_title\",\"cat_url\",\"cat_desc\", \"cat_level\",\"cat_parent_id\",\"cat_position\""
}
],
"responses": {
"200": {
"description": "array containing the categories properties",
"schema": {
"title": "categories",
"type": "array",
"items": {
"$ref": "#/definitions/category"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"post": {
"summary": "Create a new category",
"parameters": [
{
"name": "x_dc_key",
"in": "header",
"type": "string",
"required": true
},
{
"name": "blog-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "properties",
"in": "body",
"description": "cat_position is facultative. If unset, the new category will have the last cat_position. If setted and position_permute false or unsetted; It will shift the following categories.",
"schema": {
"$ref": "#/definitions/new_category"
}
}
],
"responses": {
"200": {
"description": "array containing the created category id",
"schema": {
"$ref": "#/definitions/Ids"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/{blog-id}/categories/{cat-id}": {
"get": {
"summary": "Get one category properties",
"parameters": [
{
"name": "x_dc_key",
"in": "header",
"type": "string",
"required": false
},
{
"name": "blog-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "cat-id",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "array containing the created category properties",
"schema": {
"$ref": "#/definitions/category"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"patch": {
"summary": "Update some attributes",
"parameters": [
{
"name": "x_dc_key",
"in": "header",
"type": "string"
},
{
"name": "blog-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "cat-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "category",
"in": "body",
"schema": {
"$ref": "#/definitions/patch_category"
}
}
],
"responses": {
"200": {
"description": "array containing the modified category id",
"schema": {
"$ref": "#/definitions/Ids"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"delete": {
"summary": "Delete a category",
"parameters": [
{
"name": "x_dc_key",
"in": "header",
"type": "string"
},
{
"name": "blog-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "cat-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "options",
"in": "body",
"description": "By default, all posts and subcategories contained on the deleted s one will be setted on the parent. If the category was a top level one, posts will be setted with no category, and subcategories will become top levels cat. However you can choose to put all of them on another category, or to delete them.",
"schema": {
"$ref": "#/definitions/delete_category"
}
}
],
"responses": {
"200": {
"description": "array containing Sucess message",
"schema": {
"$ref": "#/definitions/success"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
}
},
"definitions": {
"Ids": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "New blog id"
}
}
},
"category": {
"type": "object",
"description": "about the cat_position: The first position is 0. It's the relative postions with the same parent's child.",
"properties": {
"cat_id": {
"type": "integer"
},
"level": {
"type": "integer"
},
"cat_title": {
"type": "string"
},
"cat_url": {
"type": "string"
},
"cat_desc": {
"type": "string"
},
"cat_level": {
"type": "integer"
},
"cat_parent_id": {
"type": "integer"
},
"cat_position": {
"type": "integer"
}
}
},
"new_category": {
"type": "object",
"required": [
"cat_title"
],
"properties": {
"cat_title": {
"type": "string"
},
"cat_url": {
"type": "string"
},
"cat_desc": {
"type": "string"
},
"cat_parent_id": {
"type": "integer"
},
"cat_position": {
"type": "integer"
},
"position_permute": {
"type": "boolean"
},
"temporary": {
"type": "boolean"
}
}
},
"patch_category": {
"type": "object",
"properties": {
"cat_title": {
"type": "string"
},
"cat_url": {
"type": "string"
},
"cat_desc": {
"type": "string"
},
"cat_parent_id": {
"type": "integer"
},
"cat_position": {
"type": "integer"
},
"permute": {
"default": false,
"type": "boolean"
},
"temporary": {
"type": "boolean"
}
}
},
"delete_category": {
"type": "object",
"properties": {
"move_childs_on_cat_id": {
"type": "integer"
},
"delete_childs": {
"default": false,
"type": "boolean"
}
}
},
"Error": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"fields": {
"type": "string"
}
}
},
"success": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}