Re: [Dev] [APIM_REST_API] What are the properties to include in DTO

2017-03-24 Thread Sajith Kariyawasam
On Thu, Mar 23, 2017 at 11:33 AM, Anuruddha Liyanarachchi <
anurudd...@wso2.com> wrote:

> Hi,
>
> As per the current publisher REST API [1], there is a resource to get the
> subscription for a given API.
>
> This returns the following subscriptionDTO with subscription details and
> IDs of other objects associated with it (applicationId, apiId).
>
> @JsonProperty("subscriptionId")
> private String subscriptionId = null;
>
> @JsonProperty("applicationId")
> private String applicationId = null;
>
> @JsonProperty("apiId")
> private String apiId = null;
>
> @JsonProperty("subscriptionTier")
> private String subscriptionTier = null;
>
> @JsonProperty("subscriptionStatus")
> private SubscriptionStatusEnum subscriptionStatus = null;
>
> For the UI we need the application name and API name to be displayed along
> with the subscription status.
>
> In order to do get APP_NAME and API_NAME, we need to do two additional
> network calls with apiID and applicationID to two different resources.
>
> Therefore if we are to display 10 subscriptions in the UI we need to do 21
> network calls.
>
>  1. One network call to get list of subscriptions which return List with
> 10 subscription DTO objects (1 network call)
> *publisher/v1/subscriptions?api_id=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
>
>  2. For each subscriptionDTO, we need to do 2 network calls to get API
> name and Application Name. (2 * 10 = 20 network calls)
> *publisher/v1/apis?api_id=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
> *publisher/v1/applications?**application_id*
> *=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
>
> There are two ways to handle this.
>
> 1. Include the API_NAME and APPLICATION_NAME in the same DTO.
> @JsonProperty("applicationName")
> private String applicationName = null;
>
> @JsonProperty("apiName")
> private String apiName = null;
>
>
> 2. Include the *API* *object* and *Application* *object* in the
> subscription DAO with required fields populated.
> @JsonProperty("applicationObj")
> private Application applicationObj = null;
>
> @JsonProperty("apiObj")
> private API apiObj = null;
>
> IMO 2nd approach is more suitable. Please share your thoughts.
>

We already have *APIInfoDTO* and *ApplicationDTO*. +1 to use those as
attributes in SubscriptionDTO.
Then applicationId and apiIdentifier should be removed from SubscriptionDTO.


> [1] https://github.com/wso2/carbon-apimgt/blob/master/
> components/apimgt/org.wso2.carbon.apimgt.rest.api.
> publisher/src/main/resources/publisher-api.yaml
> 
> --
> Thanks and Regards,
> Anuruddha Lanka Liyanarachchi
> Software Engineer - WSO2
> Mobile : +94 (0) 712762611 <+94%2071%20276%202611>
> Tel  : +94 112 145 345 <+94%2011%202%20145345>
> anurudd...@wso2.com
>
> --
> *Thanks and Regards,*
> Anuruddha Lanka Liyanarachchi
> Software Engineer - WSO2
> Mobile : +94 (0) 712762611
> Tel  : +94 112 145 345
> a nurudd...@wso2.com
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Sajith Kariyawasam
*Associate Tech Lead*
*WSO2 Inc.; http://wso2.com *
*Committer and PMC member, Apache Stratos *
*AMIE (SL)*
*Mobile: 0772269575*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [APIM_REST_API] What are the properties to include in DTO

2017-03-23 Thread Rajith Roshan
Hi

On Thu, Mar 23, 2017 at 11:33 AM, Anuruddha Liyanarachchi <
anurudd...@wso2.com> wrote:

> Hi,
>
> As per the current publisher REST API [1], there is a resource to get the
> subscription for a given API.
>
> This returns the following subscriptionDTO with subscription details and
> IDs of other objects associated with it (applicationId, apiId).
>
> @JsonProperty("subscriptionId")
> private String subscriptionId = null;
>
> @JsonProperty("applicationId")
> private String applicationId = null;
>
> @JsonProperty("apiId")
> private String apiId = null;
>
> @JsonProperty("subscriptionTier")
> private String subscriptionTier = null;
>
> @JsonProperty("subscriptionStatus")
> private SubscriptionStatusEnum subscriptionStatus = null;
>
> For the UI we need the application name and API name to be displayed along
> with the subscription status.
>
> In order to do get APP_NAME and API_NAME, we need to do two additional
> network calls with apiID and applicationID to two different resources.
>
> Therefore if we are to display 10 subscriptions in the UI we need to do 21
> network calls.
>
>  1. One network call to get list of subscriptions which return List with
> 10 subscription DTO objects (1 network call)
> *publisher/v1/subscriptions?api_id=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
>
>  2. For each subscriptionDTO, we need to do 2 network calls to get API
> name and Application Name. (2 * 10 = 20 network calls)
> *publisher/v1/apis?api_id=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
> *publisher/v1/applications?**application_id*
> *=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
>
> There are two ways to handle this.
>
> 1. Include the API_NAME and APPLICATION_NAME in the same DTO.
> @JsonProperty("applicationName")
> private String applicationName = null;
>
> @JsonProperty("apiName")
> private String apiName = null;
>
>
> 2. Include the *API* *object* and *Application* *object* in the
> subscription DAO with required fields populated.
> @JsonProperty("applicationObj")
> private Application applicationObj = null;
>
> @JsonProperty("apiObj")
> private API apiObj = null;
>
> IMO 2nd approach is more suitable. Please share your thoughts.
>

Are we going to filter out API object from subscription dto if the
particular user only have "apim:subscription_view" scope .(not
apim:api_view scope)

>
> [1] https://github.com/wso2/carbon-apimgt/blob/master/
> components/apimgt/org.wso2.carbon.apimgt.rest.api.
> publisher/src/main/resources/publisher-api.yaml
> 
> --
> Thanks and Regards,
> Anuruddha Lanka Liyanarachchi
> Software Engineer - WSO2
> Mobile : +94 (0) 712762611 <+94%2071%20276%202611>
> Tel  : +94 112 145 345 <+94%2011%202%20145345>
> anurudd...@wso2.com
>
> --
> *Thanks and Regards,*
> Anuruddha Lanka Liyanarachchi
> Software Engineer - WSO2
> Mobile : +94 (0) 712762611
> Tel  : +94 112 145 345
> a nurudd...@wso2.com
>



-- 
Rajith Roshan
Software Engineer, WSO2 Inc.
Mobile: +94-72-642-8350 <%2B94-71-554-8430>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [APIM_REST_API] What are the properties to include in DTO

2017-03-23 Thread Harsha Kumara
Yes I too think we shouldn't return the full representation of the resource
in the list mode. Partial representation would be enough. Document in[1]
explain this.

[1]
http://51elliot.blogspot.com/2014/06/rest-api-best-practices-4-collections.html

On Fri, Mar 24, 2017 at 12:03 AM, Rajith Roshan  wrote:

>
>
> On Thu, Mar 23, 2017 at 11:50 PM, Malintha Amarasinghe  > wrote:
>
>> Hi Rajith,
>>
>> I think what we need to include here is not the full API object, but an
>> object that has minimal information of an API or an Application such as
>> name and version (E.g like the list of minimal API info objects we are
>> returning from GET /apis ). So I guess it will not do harm although we do
>> not filter that out since it does not contain any sensitive information.
>>
> +1
>
>>
>> IMO 2nd approach is cleaner than the first approach. May be we can rename
>> them as apiInfo and applicationInfo, just a thought.
>>
>> Thanks!
>>
>> On Thu, Mar 23, 2017 at 11:19 PM, Rajith Roshan  wrote:
>>
>>> Hi
>>>
>>> On Thu, Mar 23, 2017 at 11:33 AM, Anuruddha Liyanarachchi <
>>> anurudd...@wso2.com> wrote:
>>>
 Hi,

 As per the current publisher REST API [1], there is a resource to get
 the subscription for a given API.

 This returns the following subscriptionDTO with subscription details
 and IDs of other objects associated with it (applicationId, apiId).

 @JsonProperty("subscriptionId")
 private String subscriptionId = null;

 @JsonProperty("applicationId")
 private String applicationId = null;

 @JsonProperty("apiId")
 private String apiId = null;

 @JsonProperty("subscriptionTier")
 private String subscriptionTier = null;

 @JsonProperty("subscriptionStatus")
 private SubscriptionStatusEnum subscriptionStatus = null;

 For the UI we need the application name and API name to be displayed
 along with the subscription status.

 In order to do get APP_NAME and API_NAME, we need to do two additional
 network calls with apiID and applicationID to two different resources.

 Therefore if we are to display 10 subscriptions in the UI we need to do
 21 network calls.

  1. One network call to get list of subscriptions which return List
 with 10 subscription DTO objects (1 network call)
 *publisher/v1/subscriptions?api_id=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*

  2. For each subscriptionDTO, we need to do 2 network calls to get API
 name and Application Name. (2 * 10 = 20 network calls)
 *publisher/v1/apis?api_id=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
 *publisher/v1/applications?**application_id*
 *=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*

 There are two ways to handle this.

 1. Include the API_NAME and APPLICATION_NAME in the same DTO.
 @JsonProperty("applicationName")
 private String applicationName = null;

 @JsonProperty("apiName")
 private String apiName = null;


 2. Include the *API* *object* and *Application* *object* in the
 subscription DAO with required fields populated.
 @JsonProperty("applicationObj")
 private Application applicationObj = null;

 @JsonProperty("apiObj")
 private API apiObj = null;

 IMO 2nd approach is more suitable. Please share your thoughts.

>>>
>>> Are we going to filter out API object from subscription dto if the
>>> particular user only have "apim:subscription_view" scope .(not
>>> apim:api_view scope)
>>>

 [1] https://github.com/wso2/carbon-apimgt/blob/master/compon
 ents/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/ma
 in/resources/publisher-api.yaml
 
 --
 Thanks and Regards,
 Anuruddha Lanka Liyanarachchi
 Software Engineer - WSO2
 Mobile : +94 (0) 712762611 <+94%2071%20276%202611>
 Tel  : +94 112 145 345 <+94%2011%202%20145345>
 anurudd...@wso2.com

 --
 *Thanks and Regards,*
 Anuruddha Lanka Liyanarachchi
 Software Engineer - WSO2
 Mobile : +94 (0) 712762611
 Tel  : +94 112 145 345
 a nurudd...@wso2.com

>>>
>>>
>>>
>>> --
>>> Rajith Roshan
>>> Software Engineer, WSO2 Inc.
>>> Mobile: +94-72-642-8350 <%2B94-71-554-8430>
>>>
>>
>>
>>
>> --
>> Malintha Amarasinghe
>> Software Engineer
>> *WSO2, Inc. - lean | enterprise | middleware*
>> http://wso2.com/
>>
>> Mobile : +94 712383306 <+94%2071%20238%203306>
>>
>
>
>
> --
> Rajith Roshan
> Software Engineer, WSO2 Inc.
> Mobile: +94-72-642-8350 <%2B94-71-554-8430>
>



-- 
Harsha Kumara
Software Engineer, WSO2 Inc.
Mobile: +94775505618
Blog:harshcreationz.blogspot.com
___
Dev mailing list
Dev@wso2.org

Re: [Dev] [APIM_REST_API] What are the properties to include in DTO

2017-03-23 Thread Rajith Roshan
On Thu, Mar 23, 2017 at 11:50 PM, Malintha Amarasinghe 
wrote:

> Hi Rajith,
>
> I think what we need to include here is not the full API object, but an
> object that has minimal information of an API or an Application such as
> name and version (E.g like the list of minimal API info objects we are
> returning from GET /apis ). So I guess it will not do harm although we do
> not filter that out since it does not contain any sensitive information.
>
+1

>
> IMO 2nd approach is cleaner than the first approach. May be we can rename
> them as apiInfo and applicationInfo, just a thought.
>
> Thanks!
>
> On Thu, Mar 23, 2017 at 11:19 PM, Rajith Roshan  wrote:
>
>> Hi
>>
>> On Thu, Mar 23, 2017 at 11:33 AM, Anuruddha Liyanarachchi <
>> anurudd...@wso2.com> wrote:
>>
>>> Hi,
>>>
>>> As per the current publisher REST API [1], there is a resource to get
>>> the subscription for a given API.
>>>
>>> This returns the following subscriptionDTO with subscription details and
>>> IDs of other objects associated with it (applicationId, apiId).
>>>
>>> @JsonProperty("subscriptionId")
>>> private String subscriptionId = null;
>>>
>>> @JsonProperty("applicationId")
>>> private String applicationId = null;
>>>
>>> @JsonProperty("apiId")
>>> private String apiId = null;
>>>
>>> @JsonProperty("subscriptionTier")
>>> private String subscriptionTier = null;
>>>
>>> @JsonProperty("subscriptionStatus")
>>> private SubscriptionStatusEnum subscriptionStatus = null;
>>>
>>> For the UI we need the application name and API name to be displayed
>>> along with the subscription status.
>>>
>>> In order to do get APP_NAME and API_NAME, we need to do two additional
>>> network calls with apiID and applicationID to two different resources.
>>>
>>> Therefore if we are to display 10 subscriptions in the UI we need to do
>>> 21 network calls.
>>>
>>>  1. One network call to get list of subscriptions which return List with
>>> 10 subscription DTO objects (1 network call)
>>> *publisher/v1/subscriptions?api_id=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
>>>
>>>  2. For each subscriptionDTO, we need to do 2 network calls to get API
>>> name and Application Name. (2 * 10 = 20 network calls)
>>> *publisher/v1/apis?api_id=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
>>> *publisher/v1/applications?**application_id*
>>> *=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
>>>
>>> There are two ways to handle this.
>>>
>>> 1. Include the API_NAME and APPLICATION_NAME in the same DTO.
>>> @JsonProperty("applicationName")
>>> private String applicationName = null;
>>>
>>> @JsonProperty("apiName")
>>> private String apiName = null;
>>>
>>>
>>> 2. Include the *API* *object* and *Application* *object* in the
>>> subscription DAO with required fields populated.
>>> @JsonProperty("applicationObj")
>>> private Application applicationObj = null;
>>>
>>> @JsonProperty("apiObj")
>>> private API apiObj = null;
>>>
>>> IMO 2nd approach is more suitable. Please share your thoughts.
>>>
>>
>> Are we going to filter out API object from subscription dto if the
>> particular user only have "apim:subscription_view" scope .(not
>> apim:api_view scope)
>>
>>>
>>> [1] https://github.com/wso2/carbon-apimgt/blob/master/compon
>>> ents/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/ma
>>> in/resources/publisher-api.yaml
>>> 
>>> --
>>> Thanks and Regards,
>>> Anuruddha Lanka Liyanarachchi
>>> Software Engineer - WSO2
>>> Mobile : +94 (0) 712762611 <+94%2071%20276%202611>
>>> Tel  : +94 112 145 345 <+94%2011%202%20145345>
>>> anurudd...@wso2.com
>>>
>>> --
>>> *Thanks and Regards,*
>>> Anuruddha Lanka Liyanarachchi
>>> Software Engineer - WSO2
>>> Mobile : +94 (0) 712762611
>>> Tel  : +94 112 145 345
>>> a nurudd...@wso2.com
>>>
>>
>>
>>
>> --
>> Rajith Roshan
>> Software Engineer, WSO2 Inc.
>> Mobile: +94-72-642-8350 <%2B94-71-554-8430>
>>
>
>
>
> --
> Malintha Amarasinghe
> Software Engineer
> *WSO2, Inc. - lean | enterprise | middleware*
> http://wso2.com/
>
> Mobile : +94 712383306 <+94%2071%20238%203306>
>



-- 
Rajith Roshan
Software Engineer, WSO2 Inc.
Mobile: +94-72-642-8350 <%2B94-71-554-8430>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [APIM_REST_API] What are the properties to include in DTO

2017-03-23 Thread Malintha Amarasinghe
Hi Rajith,

I think what we need to include here is not the full API object, but an
object that has minimal information of an API or an Application such as
name and version (E.g like the list of minimal API info objects we are
returning from GET /apis ). So I guess it will not do harm although we do
not filter that out since it does not contain any sensitive information.

IMO 2nd approach is cleaner than the first approach. May be we can rename
them as apiInfo and applicationInfo, just a thought.

Thanks!

On Thu, Mar 23, 2017 at 11:19 PM, Rajith Roshan  wrote:

> Hi
>
> On Thu, Mar 23, 2017 at 11:33 AM, Anuruddha Liyanarachchi <
> anurudd...@wso2.com> wrote:
>
>> Hi,
>>
>> As per the current publisher REST API [1], there is a resource to get the
>> subscription for a given API.
>>
>> This returns the following subscriptionDTO with subscription details and
>> IDs of other objects associated with it (applicationId, apiId).
>>
>> @JsonProperty("subscriptionId")
>> private String subscriptionId = null;
>>
>> @JsonProperty("applicationId")
>> private String applicationId = null;
>>
>> @JsonProperty("apiId")
>> private String apiId = null;
>>
>> @JsonProperty("subscriptionTier")
>> private String subscriptionTier = null;
>>
>> @JsonProperty("subscriptionStatus")
>> private SubscriptionStatusEnum subscriptionStatus = null;
>>
>> For the UI we need the application name and API name to be displayed
>> along with the subscription status.
>>
>> In order to do get APP_NAME and API_NAME, we need to do two additional
>> network calls with apiID and applicationID to two different resources.
>>
>> Therefore if we are to display 10 subscriptions in the UI we need to do
>> 21 network calls.
>>
>>  1. One network call to get list of subscriptions which return List with
>> 10 subscription DTO objects (1 network call)
>> *publisher/v1/subscriptions?api_id=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
>>
>>  2. For each subscriptionDTO, we need to do 2 network calls to get API
>> name and Application Name. (2 * 10 = 20 network calls)
>> *publisher/v1/apis?api_id=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
>> *publisher/v1/applications?**application_id*
>> *=fe855359-b3fd-4bbf-8f5c-6fb3f020011e*
>>
>> There are two ways to handle this.
>>
>> 1. Include the API_NAME and APPLICATION_NAME in the same DTO.
>> @JsonProperty("applicationName")
>> private String applicationName = null;
>>
>> @JsonProperty("apiName")
>> private String apiName = null;
>>
>>
>> 2. Include the *API* *object* and *Application* *object* in the
>> subscription DAO with required fields populated.
>> @JsonProperty("applicationObj")
>> private Application applicationObj = null;
>>
>> @JsonProperty("apiObj")
>> private API apiObj = null;
>>
>> IMO 2nd approach is more suitable. Please share your thoughts.
>>
>
> Are we going to filter out API object from subscription dto if the
> particular user only have "apim:subscription_view" scope .(not
> apim:api_view scope)
>
>>
>> [1] https://github.com/wso2/carbon-apimgt/blob/master/compon
>> ents/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/
>> main/resources/publisher-api.yaml
>> 
>> --
>> Thanks and Regards,
>> Anuruddha Lanka Liyanarachchi
>> Software Engineer - WSO2
>> Mobile : +94 (0) 712762611 <+94%2071%20276%202611>
>> Tel  : +94 112 145 345 <+94%2011%202%20145345>
>> anurudd...@wso2.com
>>
>> --
>> *Thanks and Regards,*
>> Anuruddha Lanka Liyanarachchi
>> Software Engineer - WSO2
>> Mobile : +94 (0) 712762611
>> Tel  : +94 112 145 345
>> a nurudd...@wso2.com
>>
>
>
>
> --
> Rajith Roshan
> Software Engineer, WSO2 Inc.
> Mobile: +94-72-642-8350 <%2B94-71-554-8430>
>



-- 
Malintha Amarasinghe
Software Engineer
*WSO2, Inc. - lean | enterprise | middleware*
http://wso2.com/

Mobile : +94 712383306
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev