ea888017474544d7e40896e289f78e41d3dc5813
[ccsdk/cds.git] / docs / api-reference / bp-processor.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0
2 .. International License. http://creativecommons.org/licenses/by/4.0
3 .. Copyright (C) 2020 Deutsche Telekom AG.
4
5 Blueprint Processor API Reference
6 ==================================
7
8 Introduction
9 --------------
10
11 This section shows all resources and endpoints which CDS BP processor currently provides through a swagger file
12 which is automatically created during CDS build process by Swagger Maven Plugin. A corresponding Postman collection is 
13 also included. Endpoints can also be described using this template
14 :download:`api-doc-template.rst <api-doc-template.rst>` but this is not the prefered way to describe the CDS API.
15
16 Authentification
17 -----------------
18
19 Use Basic athentification with `ccsdkapps` as a username and password, in Header ``Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==``.
20
21 Download
22 ------------
23
24 Here is the automatically created swagger file for CDS Blueprint Processor API:
25 :download:`cds-bp-processor-api-swagger.json <media/cds-bp-processor-api-swagger.json>`
26
27 You can find a postman collection including sample requests for all endpoints here:
28 :download:`bp-processor.postman_collection.json <media/bp-processor.postman_collection.json>`.
29 Please keep the Postman Collection up-to-date for new endpoints.
30
31 General Setup
32 --------------
33
34 All endpoints are accessable under ``http://{{host}}:{{port}}/api/v1/``. Host and port depends on your CDS BP processor
35 deployment.
36
37
38 List all endpoints
39 -------------------
40
41 Lists all available endpoints from blueprints processor API.
42
43
44 Request
45 ~~~~~~~~~~
46
47 GET ``http://{{host}}:{{port}}/actuator/mappings``
48 ....................................................
49
50 Lists all endpoints from blueprints processor.
51
52 .. code-block:: curl
53    :caption: **request**
54
55    curl --location --request GET 'http://localhost:8081/actuator/mappings' \
56    --header 'Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw=='
57
58
59 Success Response
60 ~~~~~~~~~~~~~~~~~
61
62 HTTP Status 202 OK
63
64 .. code-block:: json
65    :caption: **sample response body**
66
67    {
68       "contexts": {
69          "application": {
70                "mappings": {
71                   "dispatcherHandlers": {
72                      "webHandler": [
73
74                            ...
75
76                            {
77                               "predicate": "{GET /api/v1/blueprint-model, produces [application/json]}",
78                               "handler": "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController#allBlueprintModel()",
79                               "details": {
80                                  "handlerMethod": {
81                                        "className": "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController",
82                                        "name": "allBlueprintModel",
83                                        "descriptor": "()Ljava/util/List;"
84                                  },
85                                  "handlerFunction": null,
86                                  "requestMappingConditions": {
87                                        "consumes": [],
88                                        "headers": [],
89                                        "methods": [
90                                           "GET"
91                                        ],
92                                        "params": [],
93                                        "patterns": [
94                                           "/api/v1/blueprint-model"
95                                        ],
96                                        "produces": [
97                                           {
98                                              "mediaType": "application/json",
99                                              "negated": false
100                                           }
101                                        ]
102                                  }
103                               }
104                            },
105                            {
106                               "predicate": "{GET /api/v1/blueprint-model/meta-data/{keyword}, produces [application/json]}",
107                               "handler": "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController#allBlueprintModelMetaData(String, Continuation)",
108                               "details": {
109                                  "handlerMethod": {
110                                        "className": "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController",
111                                        "name": "allBlueprintModelMetaData",
112                                        "descriptor": "(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;"
113                                  },
114                                  "handlerFunction": null,
115                                  "requestMappingConditions": {
116                                        "consumes": [],
117                                        "headers": [],
118                                        "methods": [
119                                           "GET"
120                                        ],
121                                        "params": [],
122                                        "patterns": [
123                                           "/api/v1/blueprint-model/meta-data/{keyword}"
124                                        ],
125                                        "produces": [
126                                           {
127                                              "mediaType": "application/json",
128                                              "negated": false
129                                           }
130                                        ]
131                                  }
132                               }
133                            }
134
135                            ...
136
137                      ]
138                   }
139                },
140                "parentId": null
141          }
142       }
143    }
144
145
146 API Reference
147 --------------
148
149 .. warning::
150    In the used Sphinx plugin `sphinxcontrib-swaggerdoc` some information of the swagger file is not
151    rendered completely, e.g. the request body. Use your favorite Swagger Editor and paste the swagger file
152    to get a complete view of the API reference, e.g. on https://editor.swagger.io/.
153
154 .. swaggerv2doc:: media/cds-bp-processor-api-swagger.json