API » History » Revision 5
Revision 4 (Denis Kildishev, 04/22/2020 05:49 PM) → Revision 5/6 (Denis Kildishev, 04/22/2020 07:16 PM)
h1. API All api method calls are needs to have such header Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 h2. Experimental h3. Test data ed612ae4-ced3-408c-8d64-66d87981611f — id of document 5b9946fe-585c-47f6-93bb-5bb2e37a04d3 — id of new location b7088d84-9c96-4657-abab-7690585ddd8e — id of requirement h3. Methods *Description*: GET http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f get document and all locs PUT *Method*: GET http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/addlocation *Path*: http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f *Description*: add location to doc with id before addloc GET *Method*: PUT http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/locations *Path*: http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/addlocation *Description*: list all locations *Method*: GET *Path*: http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/locations *Description*: http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/contents get contents of document and all related resourses in form of multidata have fields *fileName* — name of xhtml file *resources* — list of related resources for example, "imgs/testDoc_html_2f94255ac1355d0d.jpg", "testDoc.xhtml", "imgs/testDoc_html_6a3c8113b28c3ae7.jpg" and several files. File with html content have name «html» *Method*: GET *Path*: http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/fulldata *Description*: Get contents of xhtml content of document *Method*: GET DELETE *Path*: http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/contents *Description*: Get contents of xhtml content of document *Method*: GET http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3 *Path*: http://localhost:9988/projects/someproject/documents/ed612ae4-ced3-408c-8d64-66d87981611f/contents/{subpath} where subpath is possible path to related resources like /images/1.jpg *Description*: removes location GET *Method*: DELETE http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3 *Path*: http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3 *Description*: get location *Method*: GET *Path*: http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3 *Description*: adds fragment to location *Method*: POST *Path*: http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3/addfragment *Body*: BODY { „start“:“0“, „end“:“20“ } *Description*: removes adds fragment from to location *Method*: POST *Path*: http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3/removefragment *Body*: BODY { „start“:“0“, „end“:“20“ } *Description*: removes fragment from location POST http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3/linkto/b7088d84-9c96-4657-abab-7690585ddd8e add link between requirement and location DELETE *Method*: POST http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3/linkto/b7088d84-9c96-4657-abab-7690585ddd8e *Path*: http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3/linkto/b7088d84-9c96-4657-abab-7690585ddd8e *Description*: remove link between requirement and location GET *Method*: DELETE http://localhost:9988/projects/someproject/resources/ed612ae4-ced3-408c-8d64-66d87981611f *Path*: http://localhost:9988/projects/someproject/documents/location/5b9946fe-585c-47f6-93bb-5bb2e37a04d3/linkto/b7088d84-9c96-4657-abab-7690585ddd8e *Description*: list all resources for node *Method*: GET *Path*: http://localhost:9988/projects/someproject/resources/ed612ae4-ced3-408c-8d64-66d87981611f *Description*: http://localhost:9988/projects/someproject/resources/ed612ae4-ced3-408c-8d64-66d87981611f/subpath.xhtml or http://localhost:9988/projects/someproject/resources/ed612ae4-ced3-408c-8d64-66d87981611f/images/1.jpg returns content of resource with given subpath *Method*: GET *Paths*: http://localhost:9988/projects/someproject/resources/ed612ae4-ced3-408c-8d64-66d87981611f/subpath.xhtml or http://localhost:9988/projects/someproject/resources/ed612ae4-ced3-408c-8d64-66d87981611f/images/1.jpg h2. Common api Old ru description Создание проекта *Description*: Путь: http://localhost:9988/projects/{имя_проекта} Create project *Method *: Метод: PUT *Path*: http://localhost:9988/projects/{project_name} Headers: Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 *Description*: Удаление проекта Путь: http://localhost:9988/projects/{имя_проекта} Delete project *Method*: Метод: DELETE *Path*: http://localhost:9988/projects/{project_name} Headers: Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 *Description*: Просмотр проекта, выдает полное дерево узлов и свойств Путь: http://localhost:9988/projects/{имя_проекта} List project and all its containment nodes and its attributes *Method*: Метод: GET *Path*: http://localhost:9988/projects/{project_name} Headers: Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 *Description*: List all Просмотр списка определений enum definitions(user-defined attr types) Путь: http://localhost:9988/projects/{имя_проекта}/enumDefs *Method*: Метод: GET *Path*: http://localhost:9988/projects/{project_name}/enumDefs Headers: Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 Добавление определений enum *Description*: Путь: http://localhost:9988/projects/{имя_проекта}/enumDefs Add enum definition *Method*: Метод: PUT *Path*: Headers: Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 http://localhost:9988/projects/{project_name}/enumDefs *Body*: Body: { "attributes":{ "3": { "value": [ { "value": "1" }, { "value": "2" }, { "comment"[optional]: "test", "value": "3" } ], "valuesType"[optional, STRING by def]: "STRING", "type": "ENUM_DEFINITION" } } } *Description*: Переустановка определений enum(удаляет старые) force new enum definitions Путь: http://localhost:9988/projects/{имя_проекта}/enumDefs *Method*: Метод: POST *Path*: http://localhost:9988/projects/{project_name}/enumDefs Body is the same as for prev. остальное см. выше Получение узла со свойствами *Description*: Путь: http://localhost:9988/projects/{имя_проекта}/node Get node and all its attributes *Method*: Метод: POST *Path*: Body: http://localhost:9988/projects/{project_name}/node *Body*: Path to node Путь к узлу - qualified id, UserVisible Id or UUID qid, uvid или uuid *Description*: Получение поддерева со свойствами Путь: http://localhost:9988/projects/{имя_проекта}/tree Get node and all its successors(subtree) *Method*: Метод: POST *Path*: Body: http://localhost:9988/projects/{project_name}/tree *Body*: Path to node Путь к узлу - qualified id, UserVisible Id or UUID qid, uvid или uuid *Description*: Получение поддерева требований со свойствами (начиная с Requirements) Путь: http://localhost:9988/projects/{имя_проекта}/tree Get requirements subtree with all attributes *Method*: Метод: GET *Path*: http://localhost:9988/projects/{project_name}/tree *Description*: Получение поддерева с ограничением по глубине Путь: http://localhost:9988/projects/{имя_проекта}/tree-{глубина} Get subtree up to {lvl} depth *Method*: Метод: POST *Path*: Body: http://localhost:9988/projects/{project_name}/tree-{lvl} *Body*: Path to node Путь к узлу - qualified id, UserVisible Id or UUID qid, uvid или uuid *Description*: Установка свойств Set attributes Путь: http://localhost:9988/projects/{имя_проекта}/nodes/{uuid_узла}/attributes/ *Method*: Метод: PUT *Path*: Headers: Content-Type=application/json Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/attributes/ *Datatype*: Тип данных - multipart/form-data *Body*: Body: two type of fields два вида полей - input contains содержит json, images contains images содержит изображения пример input example = { "attributes": { "test": { "value": "13d23", "type": "INT" }, "_name": { "value": "{test} test 123" }, "Ref": { "type": "REFERENCE", "value":"test" } "2": { "value": [ { "value": "001 2/001" }, { "value": "002/001/001" }, { "value": "Requirements" } ], "valuesType": "REFERENCE", "type": "LIST" }, "3val": { "value": "1", "enumName": "3", "type": "ENUM" } } *Description*: Удаление свойств Delete attributes Путь: http://localhost:9988/projects/{имя_проекта}/nodes/{uuid_узла}/attributes/ *Method*: Метод: DELETE *Path*: Headers: Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 Body: //пример установки свойств http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/attributes/ {имя1}, {имя2}... *Body*: {name1}, {name2}... *Returns*: Current set of attributes Возвращает текущий набор свойств *Description*: Удаление узла Delete node Путь: http://localhost:9988/projects/{имя_проекта}/node *Method*: Метод: DELETE *Path*: Body: http://localhost:9988/projects/{project_name}/node *Body*: Path to node Путь к узлу - qualified id, UserVisible Id or UUID qid, uvid или uuid *Returns*: New subtree from parent of deleted node Возвращает новое поддерево с предком выбранного узла после удаления *Description*: Перемещение узла без автопереименования, вернет ошибку при совпадении id Move node without autorename, if node with new name exists then returns error Путь: http://localhost:9988/projects/{имя_проекта}/nodes/{uuid_узла}/move *Method*: Метод: POST *Path*: Headers: Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/move Body: *Body*: Path to node Путь к новому предку узла - qualified id, UserVisible Id or UUID qid, uvid или uuid *Returns*: New subtree from parent of moved node Возвращает новое поддерево с предком выбранного узла после перемещения *Description*: Перемещение узла с автопереименованием Move node withautorename Путь: http://localhost:9988/projects/{имя_проекта}/nodes/{uuid_узла}/move-rename *Method*: Метод: POST *Path*: Headers: Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/move-rename Body: *Body*: Path to node Путь к новому предку узла - qualified id, UserVisible Id or UUID qid, uvid или uuid *Returns*: New subtree from parent of moved node Возвращает новое поддерево с предком выбранного узла после перемещения *Description*: Перемещение узла после указанного с автопереименованием Move node after given one with autorename Путь: http://localhost:9988/projects/{имя_проекта}/nodes/{uuid_узла}/move-after *Method*: Метод: POST *Path*: Headers: Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/move-after Body: *Body*: Path to node after which target node needs to be moved Путь к узлу в место после которого должен переместиться {uuid_узла} - qualified id, UserVisible Id or UUID qid, uvid или uuid New subtree from parent of moved node Возвращает новое поддерево с предком выбранного узла после перемещения *Description*: Получение идентефикаторов Get identifier Путь: http://localhost:9988/projects/{имя_проекта}/nodes/{uuid_узла}/id *Method*: Метод: GET *Path*: Headers: Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/id *Returns*: Id, qualifiedId and user-visible id Возвращает id, qid, uvid *Description*: Переименование узла Rename a node Путь: http://localhost:9988/projects/{имя_проекта}/nodes/{uuid_узла}/id *Method*: Метод: PUT *Path*: Headers: Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 http://localhost:9988/projects/{project_name}/nodes/{uuid_of_node}/id Body: *Body*: New Новый id of node *Returns*: new Возвращает новые id, qualifiedId and user-visible id of node qid, uvid *Description*: Создание узла Create a node Путь: http://localhost:9988/projects/{имя_проекта}/create *Method*: Метод: PUT *Path*: Headers: Authorization=Bearer 36AC0A0F7F271314B72986EB54DB2343 http://localhost:9988/projects/{project_name}/create *Datatype*: Тип данных - multipart/form-data *Body*: Body: two kinds of fields два вида полей - input contains содержит json, images contains images содержит изображения пример input example = { "parent": "516bbbbc-babf-45d6-a146-61db334411be", "type":"Requirement", "id":"002", "attributes":{ "test": { "value": "13d23", "type": "INT" }, "_name": { "value": "{test} test 123" }, "Ref": { "type": "REFERENCE", "value":"test" }, "_description": { "value":"test desc <img src='strange.png' alt='strange.xcf'/>", "type":"HTML" } } } Идентефикатор("id") опционален Примеры выдачи: "id" identifier is optional Список ссылок *Example of output*: List of references 2: { "valuesType": "REFERENCE", "value": [ { "nodes": [ "71f2c6d9-aa54-4293-95d4-ed0d50fba6c1" ], "value": "001 2/001" }, { "value": "*Missing: '002/001/001'" }, { "nodes": [ "516bbbbc-babf-45d6-a146-61db334411be" ], "value": "Requirements" } ], "type": "LIST" }, Ссылка с ошибкой Link with error 1: { "value": "*Missing: '002/001/001'", "type": "REFERENCE" }, enum def(GET http://localhost:9988/projects/{project_name}/enumDefs) http://localhost:9988/projects/{проект}/enumDefs) { "success": true, "result": { "attributes": { 3: { "value": [ { "comment": null, "value": "1" }, { "comment": null, "value": "2" }, { "comment": null, "value": "3" } ], "valuesType": "INT", "type": "ENUM_DEFINITION" } } } } Enum value needs to be contained in value, значение должно содержаться в enum def with name с именем enumName "3Value": { "type": "ENUM", "enumName": "3", "value": "1" },