modified the document to remove errors
[dmaap/messagerouter/messageservice.git] / docs / message-router / message-router.rst
1 ============================================\r
2 Message Router (MR) API Guide\r
3 ============================================\r
4 Architecture\r
5 -------------\r
6 \r
7 In DMaaP Message Router, Restful web service is exposed to client to perform any needed action with Kafka. After getting the request it calls the Message router service layer which is created using AJSC ( AT&T Java Service Container) . AJSC finally calls Kafka services and response is sent back.\r
8 \r
9    |image0|\r
10 \r
11    .. |image0| image:: image1.png\r
12    \r
13 \r
14 HTTP Service APIs\r
15 ------------------\r
16 \r
17 DMaaP Message Router utilizes an HTTP REST API to service all Publish\r
18 and Consume transactions. HTTP and REST standards are followed so\r
19 clients as varied as CURL, Java applications and even Web Browsers will\r
20 work to interact with Message Router.Message Router uses AAF for user's\r
21 authentication and authorization.\r
22 \r
23 General HTTP Requirements\r
24 =========================\r
25 \r
26 A DMaaP Message Router transactions consists of 4 distinct segments,\r
27 HTTP URL, HTTP Header, HTTP Body (POST) and HTTP Response. The general\r
28 considerations for each segment are as follows and are required for each\r
29 of the specific transactions described in this section.\r
30 \r
31 HTTP URL\r
32 ========\r
33 \r
34 http[s]://Username:Password@serverBaseURL{/routing}{resourcePath}\r
35 \r
36 - The Username:Password utilizes HTTP Basic Authentication and HTTPS/TLS to securely transmit the authorization and authentication credentials that AAF needs to validate the client's access to the requested resource.\r
37 \r
38 - The serverBaseURL points to DMaaP Message Router host/port that will service the request. Optionally DME2 service end points for Message Router can be used.\r
39 \r
40 - The resourcePath specifies the specific service, or Topic, that the client is attempting to reach\r
41 \r
42 HTTP Header\r
43 ===========\r
44 \r
45 Specifies HTTP Headers, such as Content-Type, that define the parameters\r
46 of the HTTP Transaction\r
47 \r
48 HTTP Body\r
49 =========\r
50 \r
51 The HTTP Body contains the topic content when Publishing or Consuming.\r
52 The Body may contain topic messages in several formats (like below) but\r
53 it must be noted, that, except in very specific circumstances, messages\r
54 are not inspected for content.\r
55 \r
56 \r
57 +-------------------------+----------------------------------------------------------------------------------------------------------------+\r
58 | Content-Type            |  Description                                                                                                   |\r
59 +=========================+================================================================================================================+\r
60 | text/plain              | Each line in the POST body is treated as a separate message. No partition key is specified, and therefore no   |\r
61 |                                 |     order is guaranteed. This format is mainly for test, as messages are highly likely to be re-ordered when       |\r
62 |                             | delivered through the Kafka cluster.                                                                           |\r
63 +-------------------------+----------------------------------------------------------------------------------------------------------------+\r
64 | application/json        | The payload maybe a single JSON object or a JSON array of JSON objects. Each object is handled as an individual|\r
65 |                                                 | message..Note that use of this format may result in equivalent but altered JSON objects sent to consumers.     | \r
66 |                                                 | That's because MR uses a standard JSON parser to read each object into memory before pushing the object to the |\r
67 |                                                 | Kafka system. At that point, the JSON object is re-written from the in-memory object. This can result in       |\r
68 |                                                 | re-ordered fields or changes in whitespace. If you want to preseve JSON objects exactly,                       |\r
69 |                                                 | use application/cambria. Recommended to follow the JSON format after validating the                            |\r
70 |                                                 | message in https://jsonformatter.curiousconcept.com/                                                                                                           |\r
71 +-------------------------+----------------------------------------------------------------------------------------------------------------+\r
72 \r
73 Publishers\r
74 -----------\r
75 \r
76 **Description**:Publishes data to Kafka server on the topic mentioned in the URL.\r
77 Messages will be in the request body\r
78 \r
79 The MessageRouter service has no requirements on what publishers can put\r
80 onto a topic. The messages are opaque to the service and are treated as\r
81 raw bytes. In general, passing JSON messages is preferred, but this is\r
82 due to higher-level features and related systems, not the MessageRouter\r
83 broker itself. The only constraint placed on messages is their on their\r
84 size \96 messages must be under the maximum size, which is currently\r
85 configured at 1 MB.\r
86 \r
87 Request URL\r
88 ===========\r
89 \r
90 POST http(s)://{HOST:PORT}/events/{topicname}\r
91 \r
92 Request Parameters\r
93 ==================\r
94 \r
95 +--------------------------+---------------------------------+------------------+------------+-----------+-------------+--------------------------------+-----------------------------+\r
96 | Name                     | Description                     | Param Type       | Data type  | Max Len   | Required    | Format                         | Valid/EXample values        |\r
97 +==========================+=================================+==================+============+===========+=============+================================+=============================+\r
98 | Topicname                | topic name to be posted         | Path             | String     | 40        | Y           |  <app namespace>.<topicname>   | org.onap.crm.empdetails     |\r
99 +--------------------------+---------------------------------+------------------+------------+-----------+-------------+--------------------------------+-----------------------------+\r
100 | content-type             | To specify type of message      | Header           | String     | 20        | N           |                                | application/json            |\r
101 +--------------------------+---------------------------------+------------------+------------+-----------+-------------+--------------------------------+-----------------------------+| Username                 | userid                          | Header           | String     |           | N           | Basic Authentication Header    |                             |\r
102 +--------------------------+---------------------------------+------------------+------------+-----------+-------------+--------------------------------+-----------------------------+\r
103 | Password                 | userid                          | Header           | String     |           | N           | Basic Authentication Header    |                             |\r
104 +--------------------------+---------------------------------+------------------+------------+-----------+-------------+--------------------------------+-----------------------------+\r
105 | partitionKey             |                                 |  QueryParam      | String     |           | N           | String value                   |?Partitionkey=123            |\r
106 +--------------------------+---------------------------------+------------------+------------+-----------+-------------+--------------------------------+-----------------------------+\r
107 \r
108 **NOTE **: Publishers/user should have access on the topics. The user (id) and\r
109 permissions details needs to be in AAF.\r
110 \r
111 Response Parameters\r
112 ===================\r
113 \r
114 +------------------+------------------------+------------+--------------+------------------------------+\r
115 | Name             | Description            | Type       | Format       | Valid/Example Values         |\r
116 +==================+========================+============+==============+==============================+\r
117 | httpStatusCode   |                        |            |              | 200, 201 etc.                |\r
118 +------------------+------------------------+------------+--------------+------------------------------+\r
119 | mrErrorCode      | Numeric error code     |            |              | 200, 201 etc.                |\r
120 +------------------+------------------------+------------+--------------+------------------------------+\r
121 | errorMessage     |                        |            |              | SUCCESS, or error message.   |\r
122 +------------------+------------------------+------------+--------------+------------------------------+\r
123 | helpURL          | helpurl                |            |              |                              |\r
124 +------------------+------------------------+------------+--------------+------------------------------+\r
125 | transactionid    | transaction-id value   |            |              |                              |\r
126 +------------------+------------------------+------------+--------------+------------------------------+\r
127 \r
128  \r
129 \r
130 Response /Error Codes\r
131 =====================\r
132 \r
133 +---------------------------+------------------------------------+\r
134 | Response statusCode       |  Response statusMessage            |\r
135 +===========================+====================================+\r
136 | 200-299                   | Success                            |\r
137 +---------------------------+------------------------------------+\r
138 | 400-499                   | the client request has a problem   |\r
139 +---------------------------+------------------------------------+\r
140 | 500-599                   | the DMaaP service has a problem    |\r
141 +---------------------------+------------------------------------+\r
142 \r
143 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
144 | Error code             |  HTTPCode     |  Description                    | Issue Reason                                                                                            |\r
145 +========================+===============+=================================+=========================================================================================================+\r
146 | DMaaP\_MR\_ERR\_3001   | 413           | Request Entity too large        | Message size exceeds the batch limit <limit>.Reduce the batch size and try again                        |\r
147 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
148 | DMaaP\_MR\_ERR\_3002   | 500           | Internal Server Error           | Unable to publish messages. Please contact administrator                                                |\r
149 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
150 | DMaaP\_MR\_ERR\_3003   | 400           | Bad Request                     | Incorrect Batching format. Please correct the batching format and try again                             |\r
151 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
152 | DMaaP\_MR\_ERR\_3004   | 413           | Request Entity too large        | Message size exceeds the message size limit <limit>.Reduce the message size and try again               |\r
153 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
154 | DMaaP\_MR\_ERR\_3005   | 400           | Bad Request                     | Incorrect JSON object. Please correct the JSON format and try again                                     |\r
155 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
156 | DMaaP\_MR\_ERR\_3006   | 504           | Network Connect Timeout Error   | Connection to the DMaaP MR was timed out.Please try again                                               |\r
157 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
158 | DMaaP\_MR\_ERR\_3007   | 500           | Internal Server Error           | Failed to publish  messages to topic <topicName>. Successfully published <count > number of messages.   |\r
159 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
160 \r
161 Sample Request:\r
162 ==============\r
163 \r
164 +-----------------------------------------------------------------------------------+\r
165 | POST                                                                              |\r
166 |                                                                                   |\r
167 | *Payload-* *{"message":"message description"}* *Content-Type: application/json*   |\r
168 |                                                                                   |\r
169 | Example:                                                                          |\r
170 |                                                                                   |\r
171 | curl -u XXXX@abc.com:X -H 'Content-Type:text/plain' -X POST -d @sampleMsg.txt     |\r
172 |                                                                                   |\r
173 | {    "count": 1,                                                                  |\r
174 |                                                                                   |\r
175 |     "serverTimeMs": 19"                                                           |\r
176 |                                                                                   |\r
177 | }                                                                                 |\r
178 +-----------------------------------------------------------------------------------+\r
179 \r
180 Sample Response:\r
181 ===============\r
182 \r
183 +---------------------------------------------------------------------+\r
184 | HTTP/1.1 200 OK                                                     |\r
185 |                                                                     |\r
186 |     Server: Apache-Coyote/1.1                                       |\r
187 |                                                                     |\r
188 |     transactionId: 28-12-2015::08:18:50:682::<IP>::28122015552391   |\r
189 |                                                                     |\r
190 |     Content-Type: application/json                                  |\r
191 |                                                                     |\r
192 |     Content-Length: 42                                              |\r
193 |                                                                     |\r
194 |     Date: Mon, 28 Dec 2015 13:18:50 GMT                             |\r
195 +---------------------------------------------------------------------+\r
196 \r
197  \r
198 \r
199 Subscribers\r
200 -----------\r
201 **Description**:To subscribe to a MessageRouter topic, a subscriber issues a GET to the RESTful HTTP endpoint for events.\r
202 \r
203 Request URL:\r
204 ============\r
205 \r
206 GET http(s)://{HOST:PORT}}/events/{topicname}/{consumegroup}/{consumerid}/{timeout=x}\r
207 \r
208 Request Parameters:\r
209 ===================\r
210 \r
211 +-------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-------------------------------------------------+\r
212 | Name        | Description                     |  Param Type      |  data type |   MaxLen     |  Required   |  Format     |  Valid/Example Values                           |\r
213 +=============+=================================+==================+============+==============+=============+=============+=================================================+\r
214 | Topicname   | topic name to be posted         |     Path         |   String   |        40    |     Y       | namespace.  |                                                                                             |\r
215 |                         |                                                                     |                                  |            |              |             |  String     |                                                 |\r
216 +-------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-------------------------------------------------+\r
217 |Consumergroup| A name that uniquely identifies |     Path         |    String  |              |             |             |                                                 |\r
218 |                         | your subscribers                |                  |            |              |      Y      |             |               CG1                               |\r
219 +-------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-------------------------------------------------+\r
220 | consumerId  | Within your subscribers group,  |                  |            |              |             |             |                                                 |\r
221 |                         | a name that uniquely identifies |      Path        |   String   |              |       y     |             |              C1                                 |\r
222 |                         | your subscribers  process       |                  |            |              |             |             |                                                 | +-------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-------------------------------------------------+\r
223 | content-type| To specify type of message      |                  |            |              |             |             |aplication/json                                  |\r
224 |                         | content(json,text or cambria)   |      Header      |   String   |         20   |      N      |             |                                                 |\r
225 +-------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-------------------------------------------------+\r
226 |Username     |   userid                        | Header           | String     | 1            | N           |             |                                                 |\r
227 +-------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-------------------------------------------------+\r
228 | Password    |                                 | Header           | String     | 1            | N           |             |                                                 |\r
229 +-------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-------------------------------------------------+ \r
230 \r
231 **NOTE1**:Subscribers /user should have access on the topics. The user () and\r
232 permissions details needs to be in AAF.\r
233 \r
234 Response Parameters:\r
235 ===================\r
236 \r
237 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
238 | Name             | Description                    |  Type      | Format       | Valid/Example Values                                      |\r
239 +==================+================================+============+==============+===========================================================+\r
240 | httpStatusCode   |                                |            |              | 200, 201 etc.                                             |\r
241 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
242 | mrErrorCode      | Numeric error code             |            |              | 200, 201 etc.                                             |\r
243 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
244 | errorMessage     |                                |            |              | SUCCESS, or error message.                                |\r
245 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
246 | helpURL          | helpurl                        |            |              |                                                           |\r
247 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
248 | tranactionid     | transaction-id value           |            |              | 28-12-2015::08:18:50:682::135.25.227.66::28122015552391   |\r
249 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
250 | ResponseBody     | Messages consumed from topic   | Json       | Json         |                                                           |\r
251 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
252 \r
253 +---------------------------+------------------------------------+\r
254 | Response statusCode       | Response statusMessage             |\r
255 +===========================+====================================+\r
256 | 200-299                   | Success                            |\r
257 +---------------------------+------------------------------------+\r
258 | 400-499                   | the client request has a problem   |\r
259 +---------------------------+------------------------------------+\r
260 | 500-599                   | the DMaaP service has a problem    |\r
261 +---------------------------+------------------------------------+\r
262 \r
263 +-------------------------+-----------------+----------------------------+----------------------------------------------------------------------------------------------------+\r
264 | Error code              |  HTTP Code      |  Description               |Issue reason                                                                                        |\r
265 +=========================+=================+============================+====================================================================================================+\r
266 | DMaaP\_MR\_ERR\_3008    | 413             | Request Entity too large   | Message size exceeds the batch limit <limit>.Reduce the batch size and try again                   | +-------------------------+-----------------+----------------------------+----------------------------------------------------------------------------------------------------+\r
267 | DMaaP\_MR\_ERR\_3009    | 500             | Internal Server Error      | Unable to publish messages. Please contact administartor                                           | +-------------------------+-----------------+----------------------------+----------------------------------------------------------------------------------------------------+\r
268 | DMaaP\_MR\_ERR\_3010    | 400             | Bad Request                | Incorrect Batching format. Please correct the batching format and try again                        | +-------------------------+-----------------+----------------------------+----------------------------------------------------------------------------------------------------+\r
269 | DMaaP\_MR\_ERR\_3011    | 413             | Request Entity too large   | Message size exceeds the message size limit <limit>.Reduce the message size and try again          | +-------------------------+-----------------+----------------------------+----------------------------------------------------------------------------------------------------+\r
270 \r
271 \r
272 Sample Request:\r
273 ==============\r
274 \r
275 +----------------------------------------------------------------------------------------------------+\r
276 | GET  http://<hostname>:3904/events/com.att.dmaap.mr.sprint/mygroup/mycus                           |\r
277 |  Content-Type: application/json                                                                    |\r
278 | Example:                                                                                           |\r
279 |curl -u XXX@csp.abc.com:MRDmap2016$ -X GET -d 'MyfirstMessage'                                      | \r
280 |http://mrlocal00.dcae.proto.research.att.com:3904/events/com.att.ecomp_test.crm.preDeo/myG/C1       |\r
281 |[I am r sending first msg,I am R sending first msg]                                                 |\r
282 +----------------------------------------------------------------------------------------------------+\r
283 \r
284 Provisioning\r
285 ------------\r
286 **Description**: To create , modify or delete the MessageRouter topics. Generally Invenio application will use these  below apis to create , assign topics to the users. These APIs can also be used by other applications to provision topics in MessageRouter\r
287 \r
288 Create Topic\r
289 ============\r
290 Request URL:\r
291 ============\r
292 \r
293 POST http(s)://{HOST:PORT}/topics/create\r
294 \r
295 Request Parameters:\r
296 ==================\r
297 \r
298 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+\r
299 | Name           | Description                     |  Param Type      |  data type |   MaxLen     |  Req\92d      |  Format     |  Valid/Example Values             |\r
300 +================+=================================+==================+============+==============+=============+=============+===================================+\r
301 | Topicname      | topicname to be created in MR   |     Body         |   String   |        20    |     Y       | Json        |         com.att.dmaap.mr.metrics      |\r
302 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+       \r
303 |topicDescription|   description for topic         |      Body        |   String   |     15       |     Y       |             |                                   |\r
304 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+  \r
305 |partitionCount  |   Kafka topic partition         |     Body         |   String   |     1        | Y           |             |                                   |\r
306 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+ \r
307 |replicationCount|   Kafka topic replication       |     Body         |   String   |     1        | Y           |             |  3 (Default -for 3 node Kafka )   |\r
308 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+ \r
309 |transaction     |to create transaction id for     |     Body         | Boolean    |              |             |             |                                   |\r
310 |                |      each message transaction       |                  |            |      1       |        N    |             |   true                            |\r
311 | Enabled        |                                 |                  |            |              |             |             |                                   | \r
312 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+ \r
313 |Content-Type    |   application/json              |     Header       |   String   |              |             |             |  application/json                 |\r
314 +----------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+\r
315 \r
316 +---------------------------+------------------------------------+\r
317 | Response statusCode       | Response statusMessage             |\r
318 +===========================+====================================+\r
319 | 200-299                   | Success                            |\r
320 +---------------------------+------------------------------------+\r
321 | 400-499                   | the client request has a problem   |\r
322 +---------------------------+------------------------------------+\r
323 | 500-599                   | the DMaaP service has a problem    |\r
324 +---------------------------+------------------------------------+\r
325 \r
326 +-------------------------+-----------------+--------------------------------------------------+\r
327 | Error code              |  HTTP Code      |  Description                                     |\r
328 +=========================+=================+==================================================+\r
329 | DMaaP\_MR\_ERR\_5001    | 500             | Failed to retrieve list of all topics            | +-------------------------+-----------------+--------------------------------------------------+\r
330 | DMaaP\_MR\_ERR\_5002    | 500             | Failed to retrieve details of topic:<topicName>  |     +-------------------------+-----------------+--------------------------------------------------+\r
331 | DMaaP\_MR\_ERR\_5003    | 500             |Failed to create topic:<topicName>                | +-------------------------+-----------------+--------------------------------------------------+\r
332 | DMaaP\_MR\_ERR\_5004    | 500             | Failed to delete topic:<topicName>               | +-------------------------+-----------------+--------------------------------------------------+\r
333 \r
334 Response Parameters\r
335 ====================\r
336 \r
337 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
338 | Name             | Description                    |  Type      | Format       | Valid/Example Values                                      |\r
339 +==================+================================+============+==============+===========================================================+\r
340 | httpStatusCode   |                                |            |              | 200, 201 etc.                                             |\r
341 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
342 | mrErrorCode      | Numeric error code             |            |              | 5005                                                       |\r
343 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
344 | errorMessage     |                                |            |              | SUCCESS, or error message.                                |\r
345 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
346 | helpURL          | helpurl                        |            |              |                                                           |\r
347 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
348 | ResponseBody     | Topic details (owner,          |            |              |                                                           |\r
349 |                  | trxEnabled=true)               | Json       | Json         |                                                           |\r
350 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
351 \r
352 \r
353 Sample Request:\r
354 ==============\r
355 \r
356 +-----------------------------------------------------------------------------------+\r
357 | POST   http://<hostname>:3904/topic/create                                        |\r
358 |Request Body                                                                       |\r
359 |{"topicName":"com.abc.dmaap.mr.topicname","description":"This is a SAPTopic ",     |\r
360 | "partitionCount":"1","replicationCount":"3","transactionEnabled":"true"}          |\r
361 | Content-Type: application/json                                                    |\r
362 |Example:                                                                           |\r
363 |curl -u XXXc@csp.abc.com:xxxxx$  -H 'Content-Type:application/json' -X POST -d     |\r
364 |@topicname.txt  http://mrlocal00.dcae.proto.research.abc.com:3904/topics/create    |\r
365 |{                                                                                  |\r
366 |    "writerAcl": {                                                                 |\r
367 |        "enabled": false,                                                          |\r
368 |        "users": []                                                                |\r
369 |    },                                                                             |\r
370 |    "description": "This is a TestTopic",                                          |\r
371 |    "name": "com.abc.ecomp_test.crm.Load9",                                        |\r
372 |    "readerAcl": {                                                                 |\r
373 |        "enabled": false,                                                          |\r
374 |        "users": []                                                                |\r
375 +-----------------------------------------------------------------------------------+\r
376 \r
377 GetTopic Details\r
378 ----------------\r
379 \r
380 Request URL\r
381 ===========\r
382 \r
383 GET http(s)://{HOST:PORT}/topics    : To list the details of all the topics in Message Router.\r
384 \r
385 GET http(s)://{HOST:PORT}/topics/{topicname} : To list the details of specified topic .\r
386 \r
387 Request Parameters\r
388 ==================\r
389 \r
390 +--------------------------+---------------------------------+------------------+------------+-----------+-------------+-----------------+-----------------------------+\r
391 | Name                     | Description                     | Param Type       | Data type  | Max Len   | Req\92d       | Format          | Valid/EXample values        |\r
392 +==========================+=================================+==================+============+===========+=============+=================+=============================+\r
393 | Topicname                | topic name details              | Body             | String     | 20        | Y           |  Json           | com.abc.dmaap.mr.metrics    |\r
394 +--------------------------+---------------------------------+------------------+------------+-----------+-------------+-----------------+-----------------------------+\r
395 \r
396 \r
397 Response Parameters\r
398 ====================\r
399 \r
400 +------------------+------------------------+------------+----------+---------+--------------------------+\r
401 | Name             | Description            | ParamType  | datatype |Format   | Valid/Example Values     |\r
402 +==================+========================+============+==========+=========+==========================+\r
403 | topicname        |  topic name details    |      Body  |   String |   Json  | com.abc.dmaap.mr.metrics | \r
404 +------------------+------------------------+------------+----------+---------+--------------------------+\r
405 | description      |                        |            |   String |         |                          | \r
406 +------------------+------------------------+------------+----------+---------+--------------------------+\r
407 |owner             |user id who created the |            |          |         |                          |\r
408 |                  |         topic          |            |          |         |                          | \r
409 +------------------+------------------------+------------+----------+---------+--------------------------+\r
410 | txenabled        |     true or false      |            |   boolean|         |                          | \r
411 +------------------+------------------------+------------+----------+---------+--------------------------+\r
412 \r
413 +---------------------------+------------------------------------+\r
414 | Response statusCode       | Response statusMessage             |\r
415 +===========================+====================================+\r
416 | 200-299                   | Success                            |\r
417 +---------------------------+------------------------------------+\r
418 | 400-499                   | the client request has a problem   |\r
419 +---------------------------+------------------------------------+\r
420 | 500-599                   | the DMaaP service has a problem    |\r
421 +---------------------------+------------------------------------+\r
422 \r
423 \r
424 Sample Request:\r
425 ==============\r
426 \r
427 +-----------------------------------------------------------------------------------+\r
428 | GET   http://<hostname>:3904/topic/com.att.dmaap.mr.testtopic                     |\r
429 |       curl -u XXX@csp.abc.com:x$  -X                                              |\r
430 | GET  http://mrlocal00.dcae.proto.research.att.com:3904/topics                     |\r
431 |    {"topics": [                                                                   |\r
432 |    {                                                                              |\r
433 |       "txenabled": true,                                                          |\r
434 |        "description": "This is a TestTopic",                                      |\r
435 |      "owner": "XXXX@csp.abc.com",                                                 |\r
436 |        "topicName": "com.abc.ecomp_test.crm.Load9"                                |\r
437 |    },                                                                             |\r
438 |    {                                                                              |\r
439 |        "txenabled": false,                                                        |\r
440 |        "description": "",                                                         |\r
441 |        "owner": "",                                                               |\r
442 |        "topicName": "com.abc.ecomp_test.crm.Load1"                                |\r
443 |    },                                                                             |\r
444 +-----------------------------------------------------------------------------------+\r
445 \r
446 \r
447 Delete Topics\r
448 -------------\r
449 \r
450 Request URL:\r
451 ===========\r
452 \r
453 DELETE http(s)://{HOST:PORT}/topic/{topicname}\r
454 \r
455 Sample Request:\r
456 ==============\r
457 ex: http://<hostname>:3904/dmaap/v1/topics/com.att.dmaap.mr.testopic\r
458 \r
459 +---------------------------+------------------------------------+\r
460 | Response statusCode       | Response statusMessage             |\r
461 +===========================+====================================+\r
462 | 200-299                   | Success                            |\r
463 +---------------------------+------------------------------------+\r
464 | 400-499                   | the client request has a problem   |\r
465 +---------------------------+------------------------------------+\r
466 | 500-599                   | the DMaaP service has a problem    |\r
467 +---------------------------+------------------------------------+\r
468 \r
469 +-------------------------+---------------------------------------------+----------------------+\r
470 | Error code              |    Description                              |HTTP code             |\r
471 +=========================+=============================================+======================+\r
472 |  DMaaP\_MR\_ERR\_5004   |  Failed to delete topic:<topicName>         |   500                |   \r
473 +-------------------------+---------------------------------------------+----------------------+\r
474 \r
475 API Inventory\r
476 ------------- \r
477 \r
478 +-----------+-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
479 |           |   API Name        |   API Method                            |   REST API Path                       |                | Comments                         |\r
480 +===========+===================+=========================================+=======================================+================+==================================+\r
481 | Topics    | GetAll Topics List|  getTopics()                            | /topics                               | GET            |                                  |\r
482 |           +-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
483 |           | Get All Topics    |                                         |                                       |                |                                  |\r
484 |           |List with details  | getAllTopics()                          | /topics/listAll                       | GET            |                                  |\r
485 |           +-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
486 |           | Get individual    |                                         |                                       |                |                                  |\r
487 |           | Topic Details     | getTopic(String topicName)              | /topics/{topicName}                   | GET            |                                  |\r
488 |           +-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
489 |           | Create Topic      | createTopic(TopicBean topicBean)        | /topics/create                        | POST           |                                  |\r
490 |           +-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
491 |           | Delete Topic      | deleteTopicString topicName)            | /topics/{topicName}                   | DELETE         |  Not used in current MR version  |\r
492 |           +-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
493 |           | Get Publishers for| getPublishersByTopicName                |                                       |                |                                  |\r
494 |           | a Topic           | (String topicName)                      | /topics/{topicName}/producers         | GET            |  UEB Backward Compatibility      |\r
495 |           +-------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
496 |           | Add a Publisher to|permitPublisherForTopic(String topicName,| /topics/{topicName}/producers/        |                |                                  |\r
497 |           |write ACLon a Topic|     String producerId)                  |    {producerId}                       | PUT            |                                  |\r
498 |           +-------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
499 |           | Remove a Publisher|denyPublisherForTopic(String   topicName,|/topics/{topicName}/producers/         |                |                                  | \r
500 |           |from write   ACL on|String producerId)                       |{producerId}                           |   DELETE       |                                  |\r
501 |           | a Topic           |                                         |                                       |                |                                  |\r
502 |           +-------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
503 |           |Get Consumers for a| getConsumersByTopicName                 |  /topics/{topicName}/consumers        |       GET      |                                  |\r
504 |           |  Topic            | (String topicName)                      |                                       |                |                                  |\r
505 |           +-------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
506 |           | Add a Consumer to | permitConsumerForTopic(String topicName,|   /topics/{topicName}/consumers/      |      PUT       |                                  |\r
507 |           |read ACL on a Topic|      String consumerId)                 |       {consumerId}                    |                |                                  |    \r
508 |           +-------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
509 |           | Remove a consumer |denyPublisherForTopic(String   topicName,|/topics/{topicName}/consumers/         |                |                                  | \r
510 |           |from write   ACL on|String consumerId)                       |{consumerId}                           |                |                                  |\r
511 |           | a Topic           |                                         |                                       |    DELETE      |                                  |\r
512 +-----------+-------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r