On Wed, Jun 10, 2020 at 9:05 PM Thilini Shanika <thili...@wso2.com> wrote:

> Hi Hisan,
>
> Please find my inline comments.
>
> On Wed, Jun 10, 2020 at 2:22 PM Hisan Hunais <hi...@wso2.com> wrote:
>
>> Hi all,
>>
>> I’m currently implementing an Admin API resource to get all bot detection
>> data.
>>
>> Related Issue: https://github.com/wso2/product-apim/issues/8119
>>
>>
>>    - Please find the OAS definition below.
>>
>>   /bot-data:
>>
>>   #-----------------------------------------------------
>>
>>   # Get all bot detection data
>>
>>   #-----------------------------------------------------
>>
>>     get:
>>
>>       security:
>>
>>         - OAuth2Security:
>>
>>             - apim:admin
>>
>>             - apim:bot_data
>>
>>       produces:
>>
>>         - application/json
>>
>>       summary: |
>>
>>         Get all bot detected data
>>
>>       description: |
>>
>>         Get all bot detected data
>>
>>       responses:
>>
>>         200:
>>
>>           description: |
>>
>>             OK.
>>
>>             Bot detected data returned.
>>
>>           headers:
>>
>>             Content-Type:
>>
>>               description: |
>>
>>                 The content type of the body.
>>
>>               type: string
>>
>>           schema:
>>
>>             $ref: '#/definitions/BotDetectionDataList'
>>
>>         500:
>>
>>           description: |
>>
>>             Internal Server Error.
>>
>>             Analytics not enabled.
>>
>>           schema:
>>
>>             $ref: '#/definitions/Error'
>>
>>
>>    - The relevant schemas are shown below.
>>
>>   #-----------------------------------------------------
>>
>>   # The Bot Detection Data List resource
>>
>>   #-----------------------------------------------------
>>
>>   BotDetectionDataList:
>>
>>     title: Bot Detection Data List
>>
>>     properties:
>>
>>       count:
>>
>>         type: integer
>>
>>         description: |
>>
>>           Number of Bot Detection Data returned.
>>
>>         example: 1
>>
>>       list:
>>
>>         type: array
>>
>>         items:
>>
>>           $ref: '#/definitions/BotDetectionData'
>>
>>   #-----------------------------------------------------
>>
>>   # The Bot Detection Data resource
>>
>>   #-----------------------------------------------------
>>
>>   BotDetectionData:
>>
>>     title: Bot Detection Data
>>
>>     properties:
>>
>>       currentTime:
>>
>>         type: integer
>>
>>         description: The time of detection
>>
>>         example: 1591734138413
>>
>>       messageID:
>>
>>         type: string
>>
>>         description: The message ID
>>
>>         example: urn:uuid:1ed6d2de-29df-4fed-a96a-46d2329dce65
>>
>>       apiMethod:
>>
>>         type: string
>>
>>         description: The api method
>>
>>         example: GET
>>
>>       headerSet:
>>
>>         type: string
>>
>>         description: The header set
>>
>>         example: [Accept=*/*, Host=localhost:8243,
>> User-Agent=curl/7.58.0]
>>
>>       messageBody:
>>
>>         type: string
>>
>>         description: The content of the message body
>>
>>         example: <soapenv:Body xmlns:soapenv=\"
>> http://www.w3.org/2003/05/soap-envelope\"/>
>>
>>       clientIp:
>>
>>         type: string
>>
>>         description: The IP of the client
>>
>>         example: 127.0.0.1
>>
>>
>>    - The Admin API has the following resources which manages emails
>>    related to bot data.
>>
>>
>> *Purpose*
>>
>> *Resource*
>>
>> *Operation*
>>
>> *Parameters*
>>
>> *Parameter type*
>>
>> Get configured email list
>>
>> /botData/getEmailList
>>
>> GET
>>
>> tenantDomain
>>
>> query
>>
>> Add email
>>
>> /botData/addEmail
>>
>> POST
>>
>> Email schema containing email address
>>
>> body
>>
>> Delete email
>>
>> /botData/deleteEmail
>>
>> DELETE
>>
>> Uuid
>>
>> query
>>
>> AFAIK, the tenant domain(in /botData/getEmailList resource) should be
> obtained from the logged-in user and we do don't have to explicitly provide
> a tenant domain. @Bhathiya Jayasekara <bhath...@wso2.com> Is there a use
> case of retrieving the email list of other tenants as well?
>

No.


> Unless we can remove the tenant domain query parameter.
>

+1.

Thanks,
Bhathiya

>
>>    - In my opinion, these resources should be revamped as follows.
>>
>> Description
>>
>> Resource
>>
>> Revamped Resource
>>
>> Operation
>>
>> Get configured email list
>>
>> /botData/getEmailList
>>
>> /bot-data/emails
>>
>> GET
>>
>> Add email
>>
>> /botData/addEmail
>>
>> /bot-data/emails
>>
>> POST
>>
>> Delete email
>>
>> /botData/deleteEmail
>>
>> /bot-data/emails/{uuid}
>>
>> DELETE
>>
>> Further, the above three APIs are to subscribe/unsubscribe user for email
> notifications and to retrieve all the email subscriptions. Hence, isn't it
> better to imply this via the resource naming as well?
> ie:
> POST GET /bot-data/alert-subscriptions
> DELETE /bot-data/alert-subscriptions/{uuid}
>
>
>
>> Your feedback regarding this is highly appreciated.
>>
>> Thank you!
>> --
>>
>> *Hisan Hunais* | Software Engineer | WSO2 Inc.
>> (m) +94768526186 | (e) hi...@wso2.com
>>
>> [image: https://wso2.com/signature] <https://wso2.com/signature>
>>
>
>
> --
> Thilini Shanika
> Technical Lead
> WSO2, Inc.; http://wso2.com
> 20, Palmgrove Avenue, Colombo 3
> Mobile: +94710892258
>
>
>

-- 
*Bhathiya Jayasekara* | Senior Technical Lead | WSO2 Inc.
(m) +94 71 547 8185  | (e) bhathiya-@t-wso2-d0t-com
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to