Allow patch operation in bulk request
[aai/gizmo.git] / VERTEX.md
1 ## Vertex APIs
2
3 ### Create Vertex
4
5 Vertex payload data is validated against oxm.
6 * Mandatory attributes are required in payload
7 * Data type validation is enforced
8 * Defaults from oxm schema used when not specified in payload
9
10         URL: https://<host>:9520/services/inventory/v11/pserver/
11         Method: POST
12         Body:
13                 {   
14                         "properties":{   
15                                 "ptnii-equip-name":"e-name",
16                                 "equip-type":"server",
17                                 "hostname":"myhost",
18                                 "equip-vendor":"HP",
19                                 "equip-model":"DL380p-nd",
20                                 "fqdn":myhost.onap.net",
21                                 "purpose":"my-purpose",
22                                 "resource-version":"1477013499",
23                                 "ipv4-oam-address":"1.2.3.4"
24                         }
25                 }
26         Success Response:
27                 Code: 201
28                 Content:
29                         {   
30                                 "id":"1130672",
31                                 "type":"pserver",
32                                 "url":"services/inventory/v11/pserver/1130672",
33                                 "properties":{   
34                                         "ptnii-equip-name":"e-name",
35                                         "equip-type":"server",
36                                         "hostname":"myhost",
37                                         "equip-vendor":"HP",
38                                         "equip-model":"DL380p-nd",
39                                         "fqdn":myhost.onap.net",
40                                         "purpose":"my-purpose",
41                                         "resource-version":"1477013499",
42                                         "ipv4-oam-address":"1.2.3.4"
43                                 }
44                         }       
45         Error Response:
46                 Code: 400 (BAD REQUEST)
47                 Content: Error message describing the bad request failure.
48                 Situation: Invalid Payload or schema error.
49
50                 Code: 403 (FORBIDDEN)
51                 Content: Error message describing the Authorization failure.
52                 Situation: Authorization failure.
53
54                 Code: 415 (UNSUPPORTED MEDIA TYPE)
55                 Situation: Unsupported content type .
56                 
57                 Code: 500 (Internal Server Error)
58                 Content: Error message describing the failure.
59                 Situation: Any scenario not covered by the above error codes.
60
61 Optionally, a vertex can be created by posting to an endpoint which doesn't include the vertex type.
62
63         URL: https://<host>:9520/services/inventory/v11/
64         Method: POST
65         Body:
66                 {   
67                         "type":"pserver",
68                         "properties":{   
69                                 "ptnii-equip-name":"e-name",
70                                 "equip-type":"server",
71                                 "hostname":"myhost",
72                                 "equip-vendor":"HP",
73                                 "equip-model":"DL380p-nd",
74                                 "fqdn":myhost.onap.net",
75                                 "purpose":"my-purpose",
76                                 "resource-version":"1477013499",
77                                 "ipv4-oam-address":"1.2.3.4"
78                         }
79                 }
80         Success Response:
81                 Code: 201
82                 Content:
83                         {   
84                                 "id":"1130672",
85                                 "type":"pserver",
86                                 "url":"services/inventory/v11/pserver/1130672",
87                                 "properties":{   
88                                         "ptnii-equip-name":"e-name",
89                                         "equip-type":"server",
90                                         "hostname":"myhost",
91                                         "equip-vendor":"HP",
92                                         "equip-model":"DL380p-nd",
93                                         "fqdn":myhost.onap.net",
94                                         "purpose":"my-purpose",
95                                         "resource-version":"1477013499",
96                                         "ipv4-oam-address":"1.2.3.4"
97                                 }
98                         }       
99         Error Response:
100                 Code: 400 (BAD REQUEST)
101                 Content: Error message describing the bad request failure.
102                 Situation: Invalid Payload or schema error.
103
104                 Code: 403 (FORBIDDEN)
105                 Content: Error message describing the Authorization failure.
106                 Situation: Authorization failure.
107
108                 Code: 415 (UNSUPPORTED MEDIA TYPE)
109                 Situation: Unsupported content type .
110                 
111                 Code: 500 (Internal Server Error)
112                 Content: Error message describing the failure.
113                 Situation: Any scenario not covered by the above error codes.
114  
115 ### Get Vertex
116
117         URL: https://<host>:9520/services/inventory/v11/pserver/<id>
118         Method: GET
119         Success Response:
120                 Code: 200
121                 Content:
122                         {   
123                                 "id":"1130672",
124                                 "type":"pserver",
125                                 "url":"services/inventory/v11/pserver/<id>",
126                                 "properties":{   
127                                         "ptnii-equip-name":"e-name",
128                                         "equip-type":"server",
129                                         "hostname":"myhost",
130                                         "equip-vendor":"HP",
131                                         "equip-model":"DL380p-nd",
132                                         "fqdn":myhost.onap.net",
133                                         "purpose":"my-purpose",
134                                         "resource-version":"1477013499",
135                                         "ipv4-oam-address":"1.2.3.4"
136                                 },
137                                 "in":[   
138                                 ],
139                                 "out":[   
140                                         {   
141                                                 "id":"1crwnu-6hc-d6vp-oe08g",
142                                                 "type":"has",
143                                                 "target":"services/inventory/v11/vserver/40964272",
144                                                 "url":"services/inventory/relationships/v11/has/1crwnu-6hc-d6vp-oe08g"
145                                         }
146                                 ]
147                         }       
148         Error Response:
149                 Code: 404 (NOT FOUND)
150                 Situation: Resource Not found
151
152                 Code: 403 (FORBIDDEN)
153                 Content: Error message describing the Authorization failure.
154                 Situation: Authorization failure.
155
156                 Code: 415 (UNSUPPORTED MEDIA TYPE)
157                 Situation: Unsupported content type .
158                 
159                 Code: 500 (Internal Server Error)
160                 Content: Error message describing the failure.
161                 Situation: Any scenario not covered by the above error codes.
162
163 ### Get Vertices
164
165         URL: https://<host>:9520/services/inventory/v11/pserver/
166         Optional Query Param: ?equip-vendor=HP
167         Method: GET
168         Success Response:
169                 Code: 200
170                 Content:
171                         [   
172                                 {   
173                                         "id":"950296",
174                                         "type":"pserver",
175                                         "url":"services/inventory/v11/pserver/950296"
176                                 },
177                                 {   
178                                         "id":"1126576",
179                                         "type":"pserver",
180                                         "url":"services/inventory/v11/pserver/1126576"
181                                 },
182                                 {   
183                                         "id":"1032384",
184                                         "type":"pserver",
185                                         "url":"services/inventory/v11/pserver/1032384"
186                                 }
187                         ]       
188         Error Response:
189                 Code: 404 (NOT FOUND)
190                 Situation: Resource Not found
191
192                 Code: 403 (FORBIDDEN)
193                 Content: Error message describing the Authorization failure.
194                 Situation: Authorization failure.
195
196                 Code: 415 (UNSUPPORTED MEDIA TYPE)
197                 Situation: Unsupported content type .
198                 
199                 Code: 500 (Internal Server Error)
200                 Content: Error message describing the failure.
201                 Situation: Any scenario not covered by the above error codes.           
202
203 ### Update Vertex
204
205 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:
206 **X-HTTP-Method-Override=Patch**
207
208         URL: https://<host>:9520/services/inventory/v11/pserver/<id>
209         Method: PUT
210         Body: Same as POST      
211         Success Response:
212                 Code: 201
213                 Content: Same as POST   
214         Error Response:
215                 Code: 400 (BAD REQUEST)
216                 Content: Error message describing the bad request failure.
217                 Situation: Invalid Payload or schema error.
218
219                 Code: 403 (FORBIDDEN)
220                 Content: Error message describing the Authorization failure.
221                 Situation: Authorization failure.
222
223                 Code: 415 (UNSUPPORTED MEDIA TYPE)
224                 Situation: Unsupported content type .
225                 
226                 Code: 500 (Internal Server Error)
227                 Content: Error message describing the failure.
228                 Situation: Any scenario not covered by the above error codes.
229
230 ### Patch Vertex
231
232         URL: https://<host>:9520/services/inventory/v11/pserver/<id>
233         Method: PATCH (Content-Type header set to application/merge-patch+json)
234         Body:
235                 {   
236                         "properties":{   
237                                 "ptnii-equip-name":"e-name",
238                                 "resource-version":"1477013499",
239                                 "ipv4-oam-address":"1.2.3.99"
240                         }
241                 }
242         Success Response:
243                 Code: 200
244                 Content: Same as POST           
245         Error Response:
246                 Code: 400 (BAD REQUEST)
247                 Content: Error message describing the bad request failure.
248                 Situation: Invalid Payload or schema error.
249
250                 Code: 403 (FORBIDDEN)
251                 Content: Error message describing the Authorization failure.
252                 Situation: Authorization failure.
253
254                 Code: 415 (UNSUPPORTED MEDIA TYPE)
255                 Situation: Unsupported content type .
256                 
257                 Code: 500 (Internal Server Error)
258                 Content: Error message describing the failure.
259                 Situation: Any scenario not covered by the above error codes.
260  
261  ### Delete Vertex
262
263         URL: https://<host>:9520/services/inventory/v11/pserver/<id>
264         Method: DELETE
265         Success Response:
266                 Code: 200               
267         Error Response:
268                 Code: 404 (NOT FOUND)
269                 Situation: Resource not found
270
271                 Code: 403 (FORBIDDEN)
272                 Content: Error message describing the Authorization failure.
273                 Situation: Authorization failure.
274
275                 Code: 415 (UNSUPPORTED MEDIA TYPE)
276                 Situation: Unsupported content type .
277                 
278                 Code: 500 (Internal Server Error)
279                 Content: Error message describing the failure.
280                 Situation: Any scenario not covered by the above error codes.