b58e258c91e63c73ed694753c1d0dc77ed832641
[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 +--------------------+------------------------------+------------------+------------+-----------+-------------+--------------------------------+-----------------------------+\r
102 | Username           | userid                       | Header           | String     |           | N           | Basic Authentication Header    |                             |\r
103 +--------------------+------------------------------+------------------+------------+-----------+-------------+--------------------------------+-----------------------------+\r
104 | Password           |                              | Header           | String     |           | N           | Basic Authentication Header    |                             |\r
105 +--------------------+------------------------------+------------------+------------+-----------+-------------+--------------------------------+-----------------------------+\r
106 | partitionKey       |                              | QueryParam       | String     |           | N           | String value                   | ?Partitionkey=123           |\r
107 +--------------------+------------------------------+------------------+------------+-----------+-------------+--------------------------------+-----------------------------+\r
108 \r
109 **NOTE**: Publishers/user should have access on the topics. The user (id) and\r
110 permissions details needs to be in AAF.\r
111 \r
112 Response Parameters\r
113 ===================\r
114 \r
115 +------------------+------------------------+------------+--------------+------------------------------+\r
116 | Name             | Description            | Type       | Format       | Valid/Example Values         |\r
117 +==================+========================+============+==============+==============================+\r
118 | httpStatusCode   |                        |            |              | 200, 201 etc.                |\r
119 +------------------+------------------------+------------+--------------+------------------------------+\r
120 | mrErrorCode      | Numeric error code     |            |              | 200, 201 etc.                |\r
121 +------------------+------------------------+------------+--------------+------------------------------+\r
122 | errorMessage     |                        |            |              | SUCCESS, or error message.   |\r
123 +------------------+------------------------+------------+--------------+------------------------------+\r
124 | helpURL          | helpurl                |            |              |                              |\r
125 +------------------+------------------------+------------+--------------+------------------------------+\r
126 | transactionid    | transaction-id value   |            |              |                              |\r
127 +------------------+------------------------+------------+--------------+------------------------------+\r
128 \r
129  \r
130 \r
131 Response /Error Codes\r
132 =====================\r
133 \r
134 +---------------------------+------------------------------------+\r
135 | Response statusCode       |  Response statusMessage            |\r
136 +===========================+====================================+\r
137 | 200-299                   | Success                            |\r
138 +---------------------------+------------------------------------+\r
139 | 400-499                   | the client request has a problem   |\r
140 +---------------------------+------------------------------------+\r
141 | 500-599                   | the DMaaP service has a problem    |\r
142 +---------------------------+------------------------------------+\r
143 \r
144 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
145 | Error code             |  HTTPCode     |  Description                    | Issue Reason                                                                                            |\r
146 +========================+===============+=================================+=========================================================================================================+\r
147 | DMaaP\_MR\_ERR\_3001   | 413           | Request Entity too large        | Message size exceeds the batch limit <limit>.Reduce the batch size and try again                        |\r
148 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
149 | DMaaP\_MR\_ERR\_3002   | 500           | Internal Server Error           | Unable to publish messages. Please contact administrator                                                |\r
150 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
151 | DMaaP\_MR\_ERR\_3003   | 400           | Bad Request                     | Incorrect Batching format. Please correct the batching format and try again                             |\r
152 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
153 | 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
154 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
155 | DMaaP\_MR\_ERR\_3005   | 400           | Bad Request                     | Incorrect JSON object. Please correct the JSON format and try again                                     |\r
156 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
157 | DMaaP\_MR\_ERR\_3006   | 504           | Network Connect Timeout Error   | Connection to the DMaaP MR was timed out.Please try again                                               |\r
158 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
159 | DMaaP\_MR\_ERR\_3007   | 500           | Internal Server Error           | Failed to publish  messages to topic <topicName>. Successfully published <count > number of messages.   |\r
160 +------------------------+---------------+---------------------------------+---------------------------------------------------------------------------------------------------------+\r
161 \r
162 Sample Request:\r
163 ===============\r
164 \r
165 +-----------------------------------------------------------------------------------+\r
166 | POST                                                                              |\r
167 |                                                                                   |\r
168 | *Payload-* *{"message":"message description"}* *Content-Type: application/json*   |\r
169 |                                                                                   |\r
170 | Example:                                                                          |\r
171 |                                                                                   |\r
172 | curl -u XXXX@abc.com:X -H 'Content-Type:text/plain' -X POST -d @sampleMsg.txt     |\r
173 |                                                                                   |\r
174 | {    "count": 1,                                                                  |\r
175 |                                                                                   |\r
176 |     "serverTimeMs": 19"                                                           |\r
177 |                                                                                   |\r
178 | }                                                                                 |\r
179 +-----------------------------------------------------------------------------------+\r
180 \r
181 Sample Response:\r
182 ================\r
183 \r
184 +---------------------------------------------------------------------+\r
185 | HTTP/1.1 200 OK                                                     |\r
186 |                                                                     |\r
187 |     Server: Apache-Coyote/1.1                                       |\r
188 |                                                                     |\r
189 |     transactionId: 28-12-2015::08:18:50:682::<IP>::28122015552391   |\r
190 |                                                                     |\r
191 |     Content-Type: application/json                                  |\r
192 |                                                                     |\r
193 |     Content-Length: 42                                              |\r
194 |                                                                     |\r
195 |     Date: Mon, 28 Dec 2015 13:18:50 GMT                             |\r
196 +---------------------------------------------------------------------+\r
197 \r
198  \r
199 \r
200 Subscribers\r
201 -----------\r
202 **Description**:To subscribe to a MessageRouter topic, a subscriber issues a GET to the RESTful HTTP endpoint for events.\r
203 \r
204 Request URL:\r
205 ============\r
206 \r
207 GET http(s)://{HOST:PORT}}/events/{topicname}/{consumegroup}/{consumerid}/{timeout=x}\r
208 \r
209 Request Parameters:\r
210 ===================\r
211 \r
212 +--------------+---------------------------------+------------------+------------+--------------+-------------+-------------+--------------------------+\r
213 | Name         | Description                     |  Param Type      |  data type |   MaxLen     |  Required   |  Format     |  Valid/Example Values    |\r
214 +==============+=================================+==================+============+==============+=============+=============+==========================+\r
215 | Topicname    | topic name to be posted         |     Path         |   String   |    40        |     Y       | namespace.  |                                              |\r
216 |                          |                                                         |                              |            |              |             | String      |                          |\r
217 +--------------+---------------------------------+------------------+------------+--------------+-------------+-------------+--------------------------+\r
218 | Consumer     | A name that uniquely identifies |     Path         |   String   |              |     Y       |             | CG1                      |\r
219 | group            | your subscribers                |                  |            |              |             |             |                          |\r
220 +------------- +---------------------------------+------------------+------------+--------------+-------------+-------------+--------------------------+\r
221 | consumerId   | Within your subscribers group,  |     Path         |   String   |              |     Y       |             | C1                       |\r
222 |                          | a name that uniquely identifies |                  |            |              |             |             |                          |\r
223 |                          | your subscribers  process       |                  |            |              |             |             |                          | +--------------+---------------------------------+------------------+------------+--------------+-------------+-------------+--------------------------+\r
224 | content-type | To specify type of message      |     Header       |   String   |     20       |     N       |             | aplication/json          |\r
225 |                          | content(json,text or cambria)   |                  |            |              |             |             |                          |\r
226 +--------------+---------------------------------+------------------+------------+--------------+-------------+-------------+--------------------------+\r
227 | Username     | userid                          |     Header       |   String   |     1        |     N       |             |                          |\r
228 +--------------+---------------------------------+------------------+------------+--------------+-------------+-------------+--------------------------+\r
229 | Password     |                                 |     Header       |   String   |     1        |     N       |             |                          |\r
230 +--------------+---------------------------------+------------------+------------+--------------+-------------+-------------+--------------------------+ \r
231 \r
232 **NOTE1**:Subscribers /user should have access on the topics. The user () and\r
233 permissions details needs to be in AAF.\r
234 \r
235 Response Parameters:\r
236 ====================\r
237 \r
238 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
239 | Name             | Description                    |  Type      | Format       | Valid/Example Values                                      |\r
240 +==================+================================+============+==============+===========================================================+\r
241 | httpStatusCode   |                                |            |              | 200, 201 etc.                                             |\r
242 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
243 | mrErrorCode      | Numeric error code             |            |              | 200, 201 etc.                                             |\r
244 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
245 | errorMessage     |                                |            |              | SUCCESS, or error message.                                |\r
246 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
247 | helpURL          | helpurl                        |            |              |                                                           |\r
248 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
249 | tranactionid     | transaction-id value           |            |              | 28-12-2015::08:18:50:682::135.25.227.66::28122015552391   |\r
250 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
251 | ResponseBody     | Messages consumed from topic   | Json       | Json         |                                                           |\r
252 +------------------+--------------------------------+------------+--------------+-----------------------------------------------------------+\r
253 \r
254 +---------------------------+------------------------------------+\r
255 | Response statusCode       | Response statusMessage             |\r
256 +===========================+====================================+\r
257 | 200-299                   | Success                            |\r
258 +---------------------------+------------------------------------+\r
259 | 400-499                   | the client request has a problem   |\r
260 +---------------------------+------------------------------------+\r
261 | 500-599                   | the DMaaP service has a problem    |\r
262 +---------------------------+------------------------------------+\r
263 \r
264 +-------------------------+-----------------+----------------------------+---------------------------------------------------------------------------------------------+\r
265 | Error code              |  HTTP Code      |  Description               | Issue reason                                                                                |\r
266 +=========================+=================+============================+=============================================================================================+\r
267 | DMaaP\_MR\_ERR\_3008    | 413             | Request Entity too large   | Message size exceeds the batch limit <limit>.Reduce the batch size and try again            |\r
268 +-------------------------+-----------------+----------------------------+---------------------------------------------------------------------------------------------+\r
269 | DMaaP\_MR\_ERR\_3009    | 500             | Internal Server Error      | Unable to publish messages. Please contact administartor                                    | +-------------------------+-----------------+----------------------------+---------------------------------------------------------------------------------------------+\r
270 | DMaaP\_MR\_ERR\_3010    | 400             | Bad Request                | Incorrect Batching format. Please correct the batching format and try again                 | +-------------------------+-----------------+----------------------------+---------------------------------------------------------------------------------------------+\r
271 | 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
272 | DMaaP\_MR\_ERR\_5012    | 429             | Too many requests          | This client is making too many requests. Please use a long poll setting to decrease the     | \r
273 |                         |                 |                            | number of requests that result in empty responses.                                          |\r
274 +-------------------------+-----------------+----------------------------+---------------------------------------------------------------------------------------------+\r
275 |                         | 503             | Service Unavailable        | Service Unavailable.                                                                        | +-------------------------+-----------------+----------------------------+---------------------------------------------------------------------------------------------+\r
276 \r
277 Sample Request:\r
278 ===============\r
279 \r
280 +----------------------------------------------------------------------------------------------------+\r
281 | GET  http://<hostname>:3904/events/com.att.dmaap.mr.sprint/mygroup/mycus                           |\r
282 |                                                                                                    |\r
283 | Content-Type: application/json                                                                     |\r
284 |                                                                                                    |\r
285 | Example:                                                                                           |\r
286 |                                                                                                    |\r
287 |curl -u XXX@csp.abc.com:MRDmap2016$ -X GET -d 'MyfirstMessage'                                      |\r
288 |                                                                                                    | \r
289 |http://mrlocal00.dcae.proto.research.att.com:3904/events/com.att.ecomp_test.crm.preDeo/myG/C1       |\r
290 |                                                                                                    |\r
291 |[I am r sending first msg,I am R sending first msg]                                                 |\r
292 +----------------------------------------------------------------------------------------------------+\r
293 \r
294 Provisioning\r
295 ------------\r
296 **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
297 \r
298 Create Topic\r
299 ============\r
300 Request URL:\r
301 ============\r
302 \r
303 POST http(s)://{HOST:PORT}/topics/create\r
304 \r
305 Request Parameters:\r
306 ===================\r
307 \r
308 +-------------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+\r
309 | Name              | Description                     |  Param Type      |  datatype  |   MaxLen     |  Required   |  Format     |  Valid/Example Values             |\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   |     1        |    N        |             | true                              |\r
320 | Enabled           | each message transaction        |                  |            |              |             |             |                                   |\r
321 +-------------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+ \r
322 | Content-Type      | application/json                |     Header       |   String   |              |             |             | application/json                  |\r
323 +-------------------+---------------------------------+------------------+------------+--------------+-------------+-------------+-----------------------------------+\r
324 \r
325 +---------------------------+------------------------------------+\r
326 | Response statusCode       | Response statusMessage             |\r
327 +===========================+====================================+\r
328 | 200-299                   | Success                            |\r
329 +---------------------------+------------------------------------+\r
330 | 400-499                   | the client request has a problem   |\r
331 +---------------------------+------------------------------------+\r
332 | 500-599                   | the DMaaP service has a problem    |\r
333 +---------------------------+------------------------------------+\r
334 \r
335 +-------------------------+-----------------+--------------------------------------------------+\r
336 | Error code              |  HTTP Code      |  Description                                     |\r
337 +=========================+=================+==================================================+\r
338 | DMaaP\_MR\_ERR\_5001    | 500             | Failed to retrieve list of all topics            | +-------------------------+-----------------+--------------------------------------------------+\r
339 | DMaaP\_MR\_ERR\_5002    | 500             | Failed to retrieve details of topic:<topicName>  |     +-------------------------+-----------------+--------------------------------------------------+\r
340 | DMaaP\_MR\_ERR\_5003    | 500             | Failed to create topic:<topicName>               | +-------------------------+-----------------+--------------------------------------------------+\r
341 | DMaaP\_MR\_ERR\_5004    | 500             | Failed to delete topic:<topicName>               | +-------------------------+-----------------+--------------------------------------------------+\r
342 \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     .. code:: bash\r
367         \r
368             POST   http://<hostname>:3904/topic/create \r
369                 Request Body  \r
370                 {"topicName":"com.abc.dmaap.mr.topicname","description":"This is a SAPTopic ",\r
371                 "partitionCount":"1","replicationCount":"3","transactionEnabled":"true"}  \r
372                 Content-Type: application/json \r
373                 Example:\r
374                 curl -u XXXc@csp.abc.com:xxxxx$  -H 'Content-Type:application/json' -X POST -d \r
375                 @topicname.txt  http://mrlocal00.dcae.proto.research.abc.com:3904/topics/create\r
376                 {  \r
377                 "writerAcl": {   \r
378                 "enabled": false, \r
379                 "users": []  \r
380                 }, \r
381                 "description": "This is a TestTopic", \r
382                 "name": "com.abc.ecomp_test.crm.Load9",   \r
383                 "readerAcl": {  \r
384                 "enabled": false,  \r
385                 "users": [] \r
386 \r
387 \r
388 GetTopic Details\r
389 ----------------\r
390 \r
391 Request URL\r
392 ===========\r
393 \r
394 GET http(s)://{HOST:PORT}/topics    : To list the details of all the topics in Message Router.\r
395 \r
396 GET http(s)://{HOST:PORT}/topics/{topicname} : To list the details of specified topic .\r
397 \r
398 Request Parameters\r
399 ==================\r
400 \r
401 +--------------------------+-------------------------+------------------+------------+-----------+-------------+-----------------+-----------------------------+\r
402 | Name                     | Description             | Param Type       | Data type  | Max Len   | Required    | Format          | Valid/EXample values        |\r
403 +==========================+=========================+==================+============+===========+=============+=================+=============================+\r
404 | Topicname                | topic name details      | Body             | String     | 20        | Y           |  Json           | com.abc.dmaap.mr.metrics    |\r
405 +--------------------------+-------------------------+------------------+------------+-----------+-------------+-----------------+-----------------------------+\r
406 \r
407 \r
408 Response Parameters\r
409 ====================\r
410 \r
411 +------------------+------------------------+------------+----------+---------+--------------------------+\r
412 | Name             | Description            | ParamType  | datatype |Format   | Valid/Example Values     |\r
413 +==================+========================+============+==========+=========+==========================+\r
414 | topicname        |  topic name details    |      Body  |   String |   Json  | com.abc.dmaap.mr.metrics | \r
415 +------------------+------------------------+------------+----------+---------+--------------------------+\r
416 | description      |                        |            |   String |         |                          | \r
417 +------------------+------------------------+------------+----------+---------+--------------------------+\r
418 | owner            |user id who created the |            |          |         |                          |\r
419 |                  |         topic          |            |          |         |                          | \r
420 +------------------+------------------------+------------+----------+---------+--------------------------+\r
421 | txenabled        |     true or false      |            |  boolean |         |                          | \r
422 +------------------+------------------------+------------+----------+---------+--------------------------+\r
423 \r
424 +---------------------------+------------------------------------+\r
425 | Response statusCode       | Response statusMessage             |\r
426 +===========================+====================================+\r
427 | 200-299                   | Success                            |\r
428 +---------------------------+------------------------------------+\r
429 | 400-499                   | the client request has a problem   |\r
430 +---------------------------+------------------------------------+\r
431 | 500-599                   | the DMaaP service has a problem    |\r
432 +---------------------------+------------------------------------+\r
433 \r
434 \r
435 Sample Request:\r
436 ===============\r
437 \r
438 +-----------------------------------------------------------------------------------+\r
439 | GET   http://<hostname>:3904/topic/com.att.dmaap.mr.testtopic                     |\r
440 |       curl -u XXX@csp.abc.com:x$  -X                                              |\r
441 | GET  http://mrlocal00.dcae.proto.research.att.com:3904/topics                     |\r
442 |    {"topics": [                                                                   |\r
443 |    {                                                                              |\r
444 |       "txenabled": true,                                                          |\r
445 |        "description": "This is a TestTopic",                                      |\r
446 |      "owner": "XXXX@csp.abc.com",                                                 |\r
447 |        "topicName": "com.abc.ecomp_test.crm.Load9"                                |\r
448 |    },                                                                             |\r
449 |    {                                                                              |\r
450 |        "txenabled": false,                                                        |\r
451 |        "description": "",                                                         |\r
452 |        "owner": "",                                                               |\r
453 |        "topicName": "com.abc.ecomp_test.crm.Load1"                                |\r
454 |    },                                                                             |\r
455 +-----------------------------------------------------------------------------------+\r
456 \r
457 \r
458 Delete Topics\r
459 -------------\r
460 \r
461 Request URL:\r
462 ============\r
463 \r
464 DELETE http(s)://{HOST:PORT}/topic/{topicname}\r
465 \r
466 Sample Request:\r
467 ===============\r
468 ex: http://<hostname>:3904/dmaap/v1/topics/com.att.dmaap.mr.testopic\r
469 \r
470 +---------------------------+------------------------------------+\r
471 | Response statusCode       | Response statusMessage             |\r
472 +===========================+====================================+\r
473 | 200-299                   | Success                            |\r
474 +---------------------------+------------------------------------+\r
475 | 400-499                   | the client request has a problem   |\r
476 +---------------------------+------------------------------------+\r
477 | 500-599                   | the DMaaP service has a problem    |\r
478 +---------------------------+------------------------------------+\r
479 \r
480 +-------------------------+---------------------------------------------+----------------------+\r
481 | Error code              |    Description                              |HTTP code             |\r
482 +=========================+=============================================+======================+\r
483 |  DMaaP\_MR\_ERR\_5004   |  Failed to delete topic:<topicName>         |   500                |   \r
484 +-------------------------+---------------------------------------------+----------------------+\r
485 \r
486 API Inventory\r
487 ------------- \r
488 \r
489 +-----------+--------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
490 |           |   API Name         |   API Method                            |   REST API Path                       |                | Comments                         |\r
491 +===========+====================+=========================================+=======================================+================+==================================+\r
492 | Topics    | GetAll Topics      | getTopics()                             | /topics                               | GET            |                                  |\r
493 |           | List               |                                         |                                       |                |                                  |\r
494 |           +--------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
495 |           | Get All Topics     |                                         |                                       |                |                                  |\r
496 |           | List with details  | getAllTopics()                          | /topics/listAll                       | GET            |                                  |\r
497 |           +--------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
498 |           | Get individual     |                                         |                                       |                |                                  |\r
499 |           | Topic Details      | getTopic(String topicName)              | /topics/{topicName}                   | GET            |                                  |\r
500 |           +--------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
501 |           | Create Topic       | createTopic(TopicBean topicBean)        | /topics/create                        | POST           |                                  |\r
502 |           +--------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
503 |           | Delete Topic       | deleteTopicString topicName)            | /topics/{topicName}                   | DELETE         |  Not used in current MR version  |\r
504 |           +--------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r
505 |           | Get Publishers     | getPublishersByTopicName                |                                       |                |                                  |\r
506 |           | for a Topic        | String topicName)                       | /topics/{topicName}/producers         | GET            |  UEB Backward Compatibility      |\r
507 |           +--------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
508 |           | Add a Publisher    | permitPublisherForTopic                 | /topics/{topicName}/producers/        | PUT            |                                  |\r
509 |           | to write ACLon     | (String topicName, String producerId)   | {producerId}                          |                |                                  |\r
510 |           | a Topic            |                                         |                                       |                |                                  |\r
511 |           +--------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
512 |           | Remove a Publisher | denyPublisherForTopic(String topicName, | /topics/{topicName}/producers/        | DELETE         |                                  | \r
513 |           | from write ACL on  | String producerId)                      | {producerId}                          |                |                                  |\r
514 |           | a Topic            |                                         |                                       |                |                                  |\r
515 |           +--------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
516 |           | Get Consumers for  | getConsumersByTopicName                 | /topics/{topicName}/consumers         |  GET           |                                  |\r
517 |           | a Topic            | (String topicName)                      |                                       |                |                                  |\r
518 |           +--------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
519 |           | Add a Consumer     | permitConsumerForTopic(String           | /topics/{topicName}/consumers/        |  PUT           |                                  |\r
520 |           | to read ACL        | topicName,String consumerId)            | {consumerId}                          |                |                                  |\r
521 |           | on a Topic         |                                         |                                       |                |                                  |    \r
522 |           +--------------------+-----------------------------------------+---------------------------------------+----------------+                                  |\r
523 |           | Remove a consumer  | denyPublisherForTopic(String topicName, | /topics/{topicName}/consumers/        | DELETE         |                                  | \r
524 |           | from write         | String consumerId)                      | {consumerId}                          |                |                                  |\r
525 |           | ACL on a Topic     |                                         |                                       |                |                                  |\r
526 +-----------+--------------------+-----------------------------------------+---------------------------------------+----------------+----------------------------------+\r