From e40c8844c8868d189903adfe2d16cac8fa9bad6a Mon Sep 17 00:00:00 2001 From: sblimkie Date: Wed, 22 Nov 2017 21:57:29 +0200 Subject: Update README Add description of new Bulk API to README Issue-ID: AAI-482 Change-Id: Icd5c39282644986f5677f67fa1101c54d8ee56f7 Signed-off-by: sblimkie --- VERTEX.md | 280 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100644 VERTEX.md (limited to 'VERTEX.md') diff --git a/VERTEX.md b/VERTEX.md new file mode 100644 index 0000000..603d748 --- /dev/null +++ b/VERTEX.md @@ -0,0 +1,280 @@ +## Vertex APIs + +### Create Vertex + +Vertex payload data is validated against oxm. +* Mandatory attributes are required in payload +* Data type validation is enforced +* Defaults from oxm schema used when not specified in payload + + URL: https://:9520/services/inventory/v11/pserver/ + Method: POST + Body: + { + "properties":{ + "ptnii-equip-name":"e-name", + "equip-type":"server", + "hostname":"myhost", + "equip-vendor":"HP", + "equip-model":"DL380p-nd", + "fqdn":myhost.onap.net", + "purpose":"my-purpose", + "resource-version":"1477013499", + "ipv4-oam-address":"1.2.3.4" + } + } + Success Response: + Code: 201 + Content: + { + "id":"1130672", + "type":"pserver", + "url":"services/inventory/v11/pserver/1130672", + "properties":{ + "ptnii-equip-name":"e-name", + "equip-type":"server", + "hostname":"myhost", + "equip-vendor":"HP", + "equip-model":"DL380p-nd", + "fqdn":myhost.onap.net", + "purpose":"my-purpose", + "resource-version":"1477013499", + "ipv4-oam-address":"1.2.3.4" + } + } + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +Optionally, a vertex can be created by posting to an endpoint which doesn't include the vertex type. + + URL: https://:9520/services/inventory/v11/ + Method: POST + Body: + { + "type":"pserver", + "properties":{ + "ptnii-equip-name":"e-name", + "equip-type":"server", + "hostname":"myhost", + "equip-vendor":"HP", + "equip-model":"DL380p-nd", + "fqdn":myhost.onap.net", + "purpose":"my-purpose", + "resource-version":"1477013499", + "ipv4-oam-address":"1.2.3.4" + } + } + Success Response: + Code: 201 + Content: + { + "id":"1130672", + "type":"pserver", + "url":"services/inventory/v11/pserver/1130672", + "properties":{ + "ptnii-equip-name":"e-name", + "equip-type":"server", + "hostname":"myhost", + "equip-vendor":"HP", + "equip-model":"DL380p-nd", + "fqdn":myhost.onap.net", + "purpose":"my-purpose", + "resource-version":"1477013499", + "ipv4-oam-address":"1.2.3.4" + } + } + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Get Vertex + + URL: https://:9520/services/inventory/v11/pserver/ + Method: GET + Success Response: + Code: 200 + Content: + { + "id":"1130672", + "type":"pserver", + "url":"services/inventory/v11/pserver/", + "properties":{ + "ptnii-equip-name":"e-name", + "equip-type":"server", + "hostname":"myhost", + "equip-vendor":"HP", + "equip-model":"DL380p-nd", + "fqdn":myhost.onap.net", + "purpose":"my-purpose", + "resource-version":"1477013499", + "ipv4-oam-address":"1.2.3.4" + }, + "in":[ + ], + "out":[ + { + "id":"1crwnu-6hc-d6vp-oe08g", + "type":"has", + "target":"services/inventory/v11/vserver/40964272", + "url":"services/inventory/relationships/v11/has/1crwnu-6hc-d6vp-oe08g" + } + ] + } + Error Response: + Code: 404 (NOT FOUND) + Situation: Resource Not found + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Get Vertices + + URL: https://:9520/services/inventory/v11/pserver/ + Optional Query Param: ?equip-vendor=HP + Method: GET + Success Response: + Code: 200 + Content: + [ + { + "id":"950296", + "type":"pserver", + "url":"services/inventory/v11/pserver/950296" + }, + { + "id":"1126576", + "type":"pserver", + "url":"services/inventory/v11/pserver/1126576" + }, + { + "id":"1032384", + "type":"pserver", + "url":"services/inventory/v11/pserver/1032384" + } + ] + Error Response: + Code: 404 (NOT FOUND) + Situation: Resource Not found + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Update Vertex + +The PUT command is used to modify an existing vertex. By default, the vertex data is replaced by the content of the payload. However, teh following parameter can be added to the header to perform a PATCH instead of a replace: +**X-HTTP-Method-Override=Patch** + + URL: https://:9520/services/inventory/v11/pserver/ + Method: PUT + Body: Same as POST + Success Response: + Code: 201 + Content: Same as POST + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + +### Patch Vertex + + URL: https://:9520/services/inventory/v11/pserver/ + Method: PATCH (Content-Type header set to application/merge-patch+json) + Body: + { + "properties":{ + "ptnii-equip-name":"e-name", + "resource-version":"1477013499", + "ipv4-oam-address":"1.2.3.99" + } + } + Success Response: + Code: 200 + Content: Same as POST + Error Response: + Code: 400 (BAD REQUEST) + Content: Error message describing the bad request failure. + Situation: Invalid Payload or schema error. + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. + + ### Delete Vertex + + URL: https://:9520/services/inventory/v11/pserver/ + Method: DELETE + Success Response: + Code: 200 + Error Response: + Code: 404 (NOT FOUND) + Situation: Resource not found + + Code: 403 (FORBIDDEN) + Content: Error message describing the Authorization failure. + Situation: Authorization failure. + + Code: 415 (UNSUPPORTED MEDIA TYPE) + Situation: Unsupported content type . + + Code: 500 (Internal Server Error) + Content: Error message describing the failure. + Situation: Any scenario not covered by the above error codes. -- cgit 1.2.3-korg