CDS add API reference documentation
[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 :download:`cds-bp-processor-api-swagger.yaml <media/cds-bp-processor-api-swagger.yaml>`
27
28 You can find a postman collection including sample requests for all endpoints here: 
29 :download:`bp-processor.postman_collection.json <media/bp-processor.postman_collection.json>`.
30 Please keep the Postman Collection up-to-date for new endpoints.
31
32 General Setup
33 --------------
34
35 All endpoints are accessable under ``http://{{host}}:{{port}}/api/v1/``. Host and port depends on your CDS BP processor
36 deployment.
37
38
39 List all endpoints
40 -------------------
41
42 Lists all available endpoints from blueprints processor API.
43
44
45 Request
46 ~~~~~~~~~~
47
48 GET ``http://{{host}}:{{port}}/actuator/mappings``
49 ....................................................
50
51 Lists all endpoints from blueprints processor.
52
53 .. code-block:: curl
54    :caption: **request**
55
56    curl --location --request GET 'http://localhost:8081/actuator/mappings' \
57    --header 'Authorization: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw=='
58
59
60 Success Response
61 ~~~~~~~~~~~~~~~~~
62
63 HTTP Status 202 OK
64
65 .. code-block:: json
66    :caption: **sample response body**
67
68    {
69       "contexts": {
70          "application": {
71                "mappings": {
72                   "dispatcherHandlers": {
73                      "webHandler": [
74
75                            ...
76
77                            {
78                               "predicate": "{GET /api/v1/blueprint-model, produces [application/json]}",
79                               "handler": "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController#allBlueprintModel()",
80                               "details": {
81                                  "handlerMethod": {
82                                        "className": "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController",
83                                        "name": "allBlueprintModel",
84                                        "descriptor": "()Ljava/util/List;"
85                                  },
86                                  "handlerFunction": null,
87                                  "requestMappingConditions": {
88                                        "consumes": [],
89                                        "headers": [],
90                                        "methods": [
91                                           "GET"
92                                        ],
93                                        "params": [],
94                                        "patterns": [
95                                           "/api/v1/blueprint-model"
96                                        ],
97                                        "produces": [
98                                           {
99                                              "mediaType": "application/json",
100                                              "negated": false
101                                           }
102                                        ]
103                                  }
104                               }
105                            },
106                            {
107                               "predicate": "{GET /api/v1/blueprint-model/meta-data/{keyword}, produces [application/json]}",
108                               "handler": "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController#allBlueprintModelMetaData(String, Continuation)",
109                               "details": {
110                                  "handlerMethod": {
111                                        "className": "org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController",
112                                        "name": "allBlueprintModelMetaData",
113                                        "descriptor": "(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;"
114                                  },
115                                  "handlerFunction": null,
116                                  "requestMappingConditions": {
117                                        "consumes": [],
118                                        "headers": [],
119                                        "methods": [
120                                           "GET"
121                                        ],
122                                        "params": [],
123                                        "patterns": [
124                                           "/api/v1/blueprint-model/meta-data/{keyword}"
125                                        ],
126                                        "produces": [
127                                           {
128                                              "mediaType": "application/json",
129                                              "negated": false
130                                           }
131                                        ]
132                                  }
133                               }
134                            }
135
136                            ...
137
138                      ]
139                   }
140                },
141                "parentId": null
142          }
143       }
144    }
145
146
147 API Reference
148 --------------
149
150 .. warning::
151    In the used Sphinx plugin `sphinxcontrib-swaggerdoc` some information of the swagger file is not
152    rendered completely, e.g. the request body. Use your favorite Swagger Editor and paste the swagger file
153    to get a complete view of the API reference, e.g. on https://editor.swagger.io/.
154
155 .. swaggerv2doc:: media/cds-bp-processor-api-swagger.json