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-posts.json

587 lines
15 KiB
JSON

{
"swagger": "2.0",
"info": {
"title": "Dotclear API - manage posts",
"description": "SCRUD Posts entrys",
"version": "0.0.2"
},
"host": "dotclear.localhost",
"schemes": [
"http"
],
"basePath": "/dotclear/index.php?rest",
"produces": [
"application/json"
],
"paths": {
"/{blog-id}/posts": {
"get": {
"summary": "Get list of posts",
"parameters": [
{
"name": "x_dc_key",
"in": "header",
"type": "string",
"required": true
},
{
"name": "blog-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "limit-start",
"in": "query",
"required": false,
"type": "integer"
},
{
"name": "limit-count",
"in": "query",
"type": "integer",
"required": false
},
{
"name": "cat_id",
"in": "query",
"type": "string",
"required": false
},
{
"name": "post_status",
"type": "string",
"in": "query",
"required": false
},
{
"name": "password",
"type": "string",
"in": "query",
"required": false
},
{
"name": "post_selected",
"type": "boolean",
"in": "query",
"required": false
},
{
"name": "post_open_comment",
"type": "boolean",
"in": "query",
"required": false
},
{
"name": "post_open_tb",
"type": "boolean",
"in": "query",
"required": false
},
{
"name": "post_month",
"type": "string",
"in": "query",
"required": false
},
{
"name": "post_year",
"type": "string",
"in": "query",
"required": false
},
{
"name": "post_lang",
"type": "string",
"in": "query",
"required": false
},
{
"name": "post_format",
"type": "string",
"in": "query",
"required": false
},
{
"name": "sortby",
"type": "string",
"in": "query",
"required": false,
"description": "If many, separate them by a comma"
}
],
"responses": {
"200": {
"description": "list of posts",
"schema": {
"title": "posts",
"type": "array",
"items": {
"$ref": "#/definitions/dc_post"
}
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/{blog-id}/post": {
"post": {
"summary": "Create a new post",
"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": "Some non required fields you don't define will be set (default value) by the API. You can post many posts once by putting them on an array like [{'post_title':'blah',...},{'post_title':'bluh',...}]",
"schema": {
"$ref": "#/definitions/new_dc_post"
}
}
],
"responses": {
"200": {
"description": "Id of newly created post",
"schema": {
"$ref": "#/definitions/Ids"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
},
"/{blog-id}/post/{post-id}": {
"get": {
"summary": "Get a post entry",
"parameters": [
{
"name": "x_dc_key",
"in": "header",
"type": "string",
"required": false
},
{
"name": "blog-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "post-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "fields",
"in": "query",
"type": "array",
"items": {
"type": "string"
},
"required": false,
"description": "Fields you want to get. If unset, all available fields will be get."
}
],
"responses": {
"200": {
"description": "The post values",
"schema": {
"$ref": "#/definitions/dc_post"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"patch": {
"summary": "Not yet developed Update part of a post entry's properties",
"parameters": [
{
"name": "x_dc_key",
"in": "header",
"type": "string",
"required": true
},
{
"name": "blog-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "post-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "properties",
"in": "body",
"schema": {
"$ref": "#/definitions/dc_post"
}
}
],
"responses": {
"200": {
"description": "array containing the updated post's id",
"schema": {
"$ref": "#/definitions/Ids"
}
},
"404": {
"description": "this post does not exists"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"put": {
"summary": "Not yet developed Update full blog properties. Unsetted parameters will be erased",
"parameters": [
{
"name": "x_dc_key",
"in": "header",
"type": "string",
"required": true
},
{
"name": "blog-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "post-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "properties",
"in": "body",
"schema": {
"$ref": "#/definitions/new_dc_post"
}
}
],
"responses": {
"200": {
"description": "array containing the updated post's id",
"schema": {
"$ref": "#/definitions/Ids"
}
},
"404": {
"description": "this post does not exists"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
},
"delete": {
"summary": "Not yet developed Delete the post",
"parameters": [
{
"name": "x_dc_key",
"in": "header",
"type": "string",
"required": true
},
{
"name": "blog-id",
"in": "path",
"type": "string",
"required": true
},
{
"name": "post-id",
"in": "path",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "array containing the deleted post's id",
"schema": {
"$ref": "#/definitions/Ids"
}
},
"404": {
"description": "this post does not exists"
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/definitions/Error"
}
}
}
}
}
},
"definitions": {
"Ids": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "New blog id"
}
}
},
"new_dc_post": {
"type": "object",
"required": [
"post_format",
"post_status",
"post_content",
"post_title"
],
"properties": {
"post_title": {
"type": "string"
},
"post_format": {
"type": "string",
"description": "generally 'xhtml' or 'wiki'. If you put another value, not managed by Dotclear or a plugin, Fill in the post_content_xhtml field."
},
"post_content": {
"type": "string",
"description": "The content on WhatYouWant format"
},
"post_content_xhtml": {
"type": "string",
"description": "If post_format is wiki or xhtml and not set, It will be generated from post_content"
},
"post_status": {
"type": "string",
"enum": [
"Pending",
"Scheduled",
"Unpublished",
"Published"
]
},
"cat_id": {
"type": "integer"
},
"new_cat_title": {
"type": "string",
"description": "If creating a new category, this is the only required cat_ field. If given cat_id must not be given"
},
"new_cat_parent_id": {
"type": "integer",
"description": "Only if new_cat_id is given"
},
"new_cat_position": {
"type": "integer",
"description": "the new cat position relative to the brothers (same level) categories"
},
"new_cat_desc": {
"type": "string",
"description": "the new category description."
},
"new_cat_url": {
"type": "string",
"description": "the new category url"
},
"post_dt": {
"type": "string",
"description": "\\'YY-MM-dd hh:mm:ss\\' If not set, Current dateTime will be used."
},
"post_password": {
"type": "string",
"description": "Don\\'t set that value if your new post won\\'t be protected"
},
"post_url": {
"type": "string",
"description": "If not set, will be created using the date and the post_titlke"
},
"post_lang": {
"type": "string",
"description": "If not set, User lang will be used"
},
"post_excerpt": {
"type": "string"
},
"post_excerpt_xhtml": {
"type": "string",
"description": "If post_format is wiki or xhtml, It will be generated from post_excerpt"
},
"post_notes": {
"type": "string"
},
"post_selected": {
"type": "boolean"
},
"post_open_comment": {
"type": "boolean"
},
"post_open_tb": {
"type": "boolean"
},
"post_tags": {
"type": "array",
"description": "post tags"
}
}
},
"dc_post": {
"type": "object",
"properties": {
"post_id": {
"type": "string"
},
"post_title": {
"type": "string"
},
"post_format": {
"type": "string",
"description": "generally 'xhtml' or 'wiki'. If you put another value, not managed by Dotclear or a plugin, Fill in the post_content_xhtml field."
},
"post_content": {
"type": "string",
"description": "The content on WhatYouWant format"
},
"post_content_xhtml": {
"type": "string",
"description": "If post_format is wiki or xhtml and not set, It will be generated from post_content"
},
"post_status": {
"type": "string",
"enum": [
"Pending",
"Scheduled",
"Unpublished",
"Published"
]
},
"cat_id": {
"type": "integer"
},
"new_cat_id": {
"type": "string",
"description": "If creating a new category, this is the only required cat_ field. If given cat_id must not be given"
},
"new_cat_parent_id": {
"type": "integer",
"description": "Only if new_cat_id is given"
},
"new_cat_desc": {
"type": "string",
"description": "the new category description."
},
"new_cat_url": {
"type": "string",
"description": "the new category url"
},
"post_dt": {
"type": "string",
"description": "\\'YY-MM-dd hh:mm:ss\\' If not set, Current dateTime will be used."
},
"post_password": {
"type": "string",
"description": "Don\\'t set that value if your new post won\\'t be protected"
},
"post_url": {
"type": "string",
"description": "If not set, will be created using the date and the post_titlke"
},
"post_lang": {
"type": "string",
"description": "If not set, User lang will be used"
},
"post_excerpt": {
"type": "string"
},
"post_excerpt_xhtml": {
"type": "string",
"description": "If post_format is wiki or xhtml, It will be generated from post_excerpt"
},
"post_notes": {
"type": "string"
},
"post_selected": {
"type": "boolean"
},
"post_open_comment": {
"type": "boolean"
},
"post_open_tb": {
"type": "boolean"
},
"post_tags": {
"type": "array",
"description": "post tags"
},
"nb_comment": {
"type": "integer"
},
"nb_trackback": {
"type": "integer"
},
"post_firstpub": {
"type": "string"
},
"metas": {
"type": "array",
"items": {
"type": "object"
}
}
}
},
"Error": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"fields": {
"type": "string"
}
}
}
}
}