Fix sonar issues in /crud/util/CrudProperties.java
[aai/gizmo.git] / BULK.md
1 ## Bulk API
2
3 The bulk API allows a client to add/modify/patch/delete multiple vertexes and/or edges within a single request.  This request will be treated as an atomic transaction in that all operations within the bulk request will either fail or succeed together.
4
5 This is often useful when attempting to add an entire subgraph.  The following example shows how a client could create 2 vertexes (pserver and vserver) and link them with an edge.
6
7         URL: https://<host>:9520/services/inventory/v11/bulk
8         Method: POST
9         Body:
10         {  
11             "objects":[  
12                 {  
13                     "operation":"add",
14                     "v1":{  
15                         "type":"vserver",
16                         "properties":{  
17                             "in-maint":false,
18                             "vserver-name":"vserver1",
19                             "prov-status":"Provisioned",
20                             "vserver-id":"Vserver-AMT-002-HSGW",
21                             "vserver-name2":"Vs2-HSGW-OTT",
22                             "vserver-selflink":"AMT VserverLink",
23                             "is-closed-loop-disabled":false
24                         }
25                     }
26                 },
27                 {  
28                     "operation":"add",
29                     "v2":{  
30                         "type":"pserver",
31                         "properties":{  
32                             "ptnii-equip-name":"ps1993",
33                             "hostname":"pserver1",
34                             "equip-type":"server",
35                             "equip-vendor":"HP",
36                             "equip-model":"DL380p-nd",
37                             "in-maint":false,
38                             "fqdn":"pserver1.lab.com",
39                             "ipv4-oam-address":"199.1.138.60"
40                         }
41                     }
42                 }
43             ],
44             "relationships":[  
45                 {  
46                     "operation":"add",
47                     "e1":{  
48                         "type":"tosca.relationships.HostedOn",
49                         "source":"$v1",
50                         "target":"$v2",
51                         "properties":{  
52                             "contains-other-v": "NONE",
53                             "delete-other-v": "NONE",
54                             "SVC-INFRA": "OUT",
55                             "prevent-delete": "IN"
56                         }
57                     }
58                 }
59             ]
60         }
61
62         Success Response:
63                 Code: 200
64                 Content:
65             {
66                 "objects": [
67                     {
68                         "operation": "add",
69                         "v1": {
70                             "id": "1024143488",
71                             "type": "vserver",
72                             "url": "services/inventory/v11/vserver/1024143488",
73                             "properties": {
74                                 "in-maint":false,
75                                 "vserver-name":"vserver1",
76                                 "prov-status":"Provisioned",
77                                 "vserver-id":"Vserver-AMT-002-HSGW",
78                                 "vserver-name2":"Vs2-HSGW-OTT",
79                                 "vserver-selflink":"AMT VserverLink",
80                                 "is-closed-loop-disabled":false
81                             },
82                             "in": [],
83                             "out": []
84                         }
85                     },
86                     {
87                         "operation": "add",
88                         "v2": {
89                             "id": "1228865600",
90                             "type": "pserver",
91                             "url": "services/inventory/v11/pserver/1228865600",
92                             "properties": {
93                                 "ptnii-equip-name":"ps1993",
94                                 "hostname":"pserver1",
95                                 "equip-type":"server",
96                                 "equip-vendor":"HP",
97                                 "equip-model":"DL380p-nd",
98                                 "in-maint":false,
99                                 "fqdn":"pserver1.lab.com",
100                                 "ipv4-oam-address":"199.1.138.60"
101                             },
102                             "in": [],
103                             "out": []
104                         }
105                     }
106                 ],
107                 "relationships": [
108                     {
109                         "operation": "add",
110                         "e1": {
111                             "id": "kbrs40-gxqy68-108id-kbmurk",
112                             "type": "tosca.relationships.HostedOn",
113                             "url": "services/inventory/relationships/v11/tosca.relationships.HostedOn/kbrs40-gxqy68-108id-kbmurk",
114                             "source": "services/inventory/v11/vserver/1024143488",
115                             "target": "services/inventory/v11/pserver/1228865600",
116                             "properties": {
117                                 "SVC-INFRA": "OUT",
118                                 "prevent-delete": "IN",
119                                 "delete-other-v": "NONE",
120                                 "contains-other-v": "NONE"
121                             }
122                         }
123                     }
124                 ]
125             }
126
127         Error Response:
128                 Code: 400 (BAD REQUEST)
129                 Content: Error message describing the bad request failure.
130                 Situation: Invalid Payload or schema error.
131
132                 Code: 403 (FORBIDDEN)
133                 Content: Error message describing the Authorization failure.
134                 Situation: Authorization failure.
135
136                 Code: 415 (UNSUPPORTED MEDIA TYPE)
137                 Situation: Unsupported content type .
138                 
139                 Code: 500 (Internal Server Error)
140                 Content: Error message describing the failure.
141                 Situation: Any scenario not covered by the above error codes.