From 3152bbbbd935e5f270e79cd886b2a5f620291fd7 Mon Sep 17 00:00:00 2001 From: timschaeren Date: Thu, 26 Sep 2024 08:05:59 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20swisspos?= =?UTF-8?q?t/myit-api-doc@5e1c296d063cf3f4f9ab1e349be1f5a7aa9fa76a=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dispoAPI/DispoAPI.yml | 327 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 327 insertions(+) create mode 100644 dispoAPI/DispoAPI.yml diff --git a/dispoAPI/DispoAPI.yml b/dispoAPI/DispoAPI.yml new file mode 100644 index 0000000..12e85cd --- /dev/null +++ b/dispoAPI/DispoAPI.yml @@ -0,0 +1,327 @@ +openapi: '3.0.2' +info: + title: DispoAPI + description: handles inventory changes in MyIT cmdb for DispoTool. + version: '0.0.1' + +servers: + - url: https://myit-dev.post.ch/api/x_ssagd_dispoapi/dispoapi + description: development server + +security: + - BasicAuth: [] + +paths: + /switchDevice: + patch: + summary: Switches one device for another in the cmdb, including any children the old device might have had. + description: tbd + requestBody: + content: + application/json: + schema: + type: object + properties: + inventoryNumber_old: + description: "The asset tag of the old device." + type: string + inventoryNumber_new: + description: "The asset tag of the new device." + type: string + storage_location: + description: "The sys-id of the storage location of the old device." + type: string + technician: + description: "The technician performing the action. This string will appear in the activity stream." + type: string + comment: + description: "A comment composed by the technician that will appear in the activity stream." + type: string + required: + - inventoryNumber_old + - inventoryNumber_new + - storage_location + - technician + - comment + + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: "Device 23282978 was switched for 23271091 successfully." + '400': + description: bad request + content: + application/json: + schema: + type: object + properties: + name: + type: string + example: "MyItRestException" + message: + type: string + example: "inventoryNumber_old is missing or null in the request body." + status: + type: integer + example: 400 + '403': + description: forbidden + content: + application/json: + schema: + type: object + properties: + clazz: + type: string + example: "IllegalAccessException" + status: + type: integer + example: 403 + message: + type: string + example: "You are not authorized to access this API" + '500': + description: Internal Server Error + content: + application/json: + schema: + type: object + properties: + clazz: + type: string + example: "MyItRestException" + status: + type: integer + example: 500 + message: + type: string + example: "something went wrong while writing data to the new device" + + /installDevice: + patch: + summary: Installs a device in the cmdb + description: tbd + requestBody: + content: + application/json: + schema: + type: object + properties: + inventoryNumber: + description: "The asset tag of the device." + type: string + location: + description: "The location of the device." + type: string + technician: + description: "The technician performing the action. This string will appear in the activity stream." + type: string + comment: + description: "A comment composed by the technician that will appear in the activity stream." + type: string + assigned_to: + description: "The sys-id of the user of the device." + type: string + cost_center: + description: "The sys-id of the cost-center of the device." + type: string + children: + description: "Any children to install alongside the device containing the sys-id of the child as well as the name of the relation." + type: array + example: [ + { + "child" : "0007047387bb39d06dc863540cbb0000", + "relation" : "Connects to::Connected by" + }, + { + "child" : "0007047387bb39d06dc863540cbb0001", + "relation" : "Connects to::Connected by" + } + ] + parents: + description: "Any parents the device has containing the sys-id of the parent as well as the name of the relation." + type: array + example: [ + { + "parent" : "0007047387bb39d06dc863540cbb0000", + "relation" : "Connects to::Connected by" + } + ] + required: + - inventoryNumber + - location + - technician + - comment + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: "Device 23282978 was installed successfully." + '400': + description: bad request + content: + application/json: + schema: + type: object + properties: + name: + type: string + example: "MyItRestException" + message: + type: string + example: "inventoryNumber is missing or null in the request body." + status: + type: integer + example: 400 + '403': + description: forbidden + content: + application/json: + schema: + type: object + properties: + clazz: + type: string + example: "IllegalAccessException" + status: + type: integer + example: 403 + message: + type: string + example: "You are not authorized to access this API" + '500': + description: Internal Server Error + content: + application/json: + schema: + type: object + properties: + clazz: + type: string + example: "MyItRestException" + status: + type: integer + example: 500 + message: + type: string + example: "something went wrong writing data to the new device" + + /uninstallDevice: + patch: + summary: Uninstalls a device in the cmdb including any children passed in the request. + description: tbd + requestBody: + content: + application/json: + schema: + type: object + properties: + inventoryNumber: + description: "The asset tag of the device." + type: string + storage_location: + description: "The sys-id of the storage location of the device." + type: string + technician: + description: "The technician performing the action. This string will appear in the activity stream." + type: string + comment: + description: "A comment composed by the technician that will appear in the activity stream." + type: string + children: + description: "The list of sys-id's of children to uninstall alongside the parent-device. This has to exactly match the existing children in the cmdb." + type: array + example: [ + { + "child" : "0007047387bb39d06dc863540cbb0000" + }, + { + "child" : "0007047387bb39d06dc863540cbb0001" + } + ] + + required: + - inventoryNumber + - storage_location + - technician + - comment + + responses: + '200': + description: OK + content: + application/json: + schema: + type: object + properties: + message: + type: string + example: "Device 23282978 was uninstalled successfully." + '400': + description: bad request + content: + application/json: + schema: + type: object + properties: + name: + type: string + example: "MyItRestException" + message: + type: string + example: "inventoryNumber is missing or null in the request body." + status: + type: integer + example: 400 + '403': + description: forbidden + content: + application/json: + schema: + type: object + properties: + clazz: + type: string + example: "IllegalAccessException" + status: + type: integer + example: 403 + message: + type: string + example: "You are not authorized to access this API" + '500': + description: Internal Server Error + content: + application/json: + schema: + type: object + properties: + clazz: + type: string + example: "MyItRestException" + status: + type: integer + example: 500 + message: + type: string + example: "something went wrong writing data to the device" + +components: + securitySchemes: + BasicAuth: + type: http + scheme: basic +