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 > <https://github.com/wso2/carbon-apimgt/blob/master/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/main/resources/publisher-api.yaml#L3400-L3429> > -- > 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 <thili...@wso2.com>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 <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