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