{ "swagger": "2.0", "info": { "title": "ADDP Portal API", "contact": {}, "version": "1.0" }, "host": "localhost:8184", "basePath": "/api/v1/portal", "paths": { "/assets": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "获取资产列表 | Get asset list", "parameters": [ { "type": "string", "description": "搜索关键词 | Search keyword", "name": "keyword", "in": "query" }, { "type": "integer", "description": "类型ID | Type ID", "name": "type_id", "in": "query" }, { "type": "integer", "description": "资产分类 ID | Asset category ID", "name": "category_id", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.entry.read" ] } }, "/assets/{id}": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "获取资产详情 | Get asset detail", "parameters": [ { "type": "integer", "description": "资产ID | Asset ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.entry.read" ] } }, "/assets/{id}/apply": { "post": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "申请使用资产 | Apply for asset access", "parameters": [ { "type": "integer", "description": "资产ID | Asset ID", "name": "id", "in": "path", "required": true }, { "description": "申请信息 | Application info", "name": "body", "in": "body", "required": true, "schema": { "type": "object", "additionalProperties": true } } ], "responses": { "201": { "description": "Created", "schema": { "type": "object", "additionalProperties": true } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.application.create" ] } }, "/assets/{id}/apply-status": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "获取资产申请状态 | Get asset apply status", "parameters": [ { "type": "integer", "description": "资产ID | Asset ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.application.read", "asset.authorization.read" ] } }, "/assets/{id}/my-rating": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "获取本人资产评价以修改 | Get own asset rating for editing", "parameters": [ { "type": "integer", "description": "资产ID | Asset ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.portalOwnRatingResponse" } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.rating.update" ] } }, "/assets/{id}/ratings": { "get": { "security": [ { "BearerAuth": [] } ], "description": "当前用户评价与全量平均分来自 Asset,不依赖公开列表的当前分页 | Current user's rating and overall average come from Asset independently of the public page", "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "获取资产评价列表 | Get asset ratings", "parameters": [ { "type": "integer", "description": "资产ID | Asset ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.portalRatingsResponse" } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.rating.read" ] }, "put": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "修改本人资产评价 | Update own asset rating", "parameters": [ { "type": "integer", "description": "资产ID | Asset ID", "name": "id", "in": "path", "required": true }, { "description": "评价信息 | Rating info", "name": "body", "in": "body", "required": true, "schema": { "type": "object", "additionalProperties": true } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.rating.update" ] }, "post": { "security": [ { "BearerAuth": [] } ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "创建资产评价 | Create asset rating", "parameters": [ { "type": "integer", "description": "资产ID | Asset ID", "name": "id", "in": "path", "required": true }, { "description": "评价信息 | Rating info", "name": "body", "in": "body", "required": true, "schema": { "type": "object", "additionalProperties": true } } ], "responses": { "201": { "description": "Created", "schema": { "type": "object", "additionalProperties": true } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.rating.create" ] } }, "/categories": { "get": { "security": [ { "BearerAuth": [] } ], "description": "仅包含有已上架资产的分支,count 为当前节点整棵子树的已上架资产数 | Contains only branches with published assets; count is the published asset total for the entire subtree", "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "获取资产分类树 | Get asset category tree", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "type": "object", "additionalProperties": true } } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.category.read" ] } }, "/categories/{id}/assets": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "获取资产目录子树的资产列表 | Get assets in an asset directory subtree", "parameters": [ { "type": "integer", "description": "资产目录节点 ID | Asset directory node ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.category.read", "asset.entry.read" ] } }, "/home": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "获取门户首页数据 | Get portal home data", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.entry.read" ] } }, "/my/applications": { "get": { "security": [ { "BearerAuth": [] } ], "description": "获取当前租户内当前 User 的申请 | List the current User's applications in the current tenant", "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "获取我的申请列表 | Get my applications", "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "type": "object", "additionalProperties": true } } }, "403": { "description": "禁止访问 | Forbidden", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.application.read" ] } }, "/search": { "get": { "security": [ { "BearerAuth": [] } ], "produces": [ "application/json" ], "tags": [ "Portal" ], "summary": "搜索资产 | Search assets", "parameters": [ { "type": "string", "description": "搜索关键词 | Search keyword", "name": "keyword", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "502": { "description": "资产服务调用失败 | Asset service request failed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } }, "x-addp-auth-mode": "permission", "x-addp-required-permissions": [ "asset.entry.read" ] } } }, "definitions": { "client.RatingItem": { "type": "object", "properties": { "asset_id": { "type": "integer" }, "comment": { "type": "string" }, "created_at": { "type": "string" }, "id": { "type": "integer" }, "is_handled": { "type": "boolean" }, "score": { "type": "number" }, "tags": { "type": "array", "items": { "type": "string" } }, "updated_at": { "type": "string" }, "user_id": { "type": "integer" }, "user_name": { "type": "string" } } }, "internal_api.portalOwnRatingResponse": { "type": "object", "properties": { "rating": { "$ref": "#/definitions/client.RatingItem" } } }, "internal_api.portalRatingsResponse": { "type": "object", "properties": { "avg_score": { "type": "number" }, "my_rating": { "$ref": "#/definitions/client.RatingItem" }, "ratings": { "type": "array", "items": { "$ref": "#/definitions/client.RatingItem" } }, "total": { "type": "integer" } } } }, "securityDefinitions": { "BearerAuth": { "type": "apiKey", "name": "Authorization", "in": "header" } } }