This API method is correct since it's a different function i.e. search. So,
tenants/search/{tenantDomain} is fine.

I think the one I suggested in the other thread is also wrong for
retrieveTenants.

if it is all tenants(retrieveTenants); GET /tenants/
if it is 1 tenant; GET /tenants/{tenantDomain}



On Thu, Nov 20, 2014 at 7:25 AM, Udara Liyanage <[email protected]> wrote:

> Hi Nirmal,
>
> We already have getTenants() which should be  /tenants/{tenantDomain}
>
>
> @GET
>     @Path("tenant/search/{tenantDomain}")
>     @Consumes("application/json")
>     @Produces("application/json")
>     @AuthorizationAction("/permission/protected/manage/monitor/tenants")
>     @SuperTenantService(true)
>     public TenantInfoBean[]
> retrievePartialSearchTenants(@PathParam("tenantDomain") String
> tenantDomain) throws RestAPIException {
>         List<TenantInfoBean> tenantList = null;
>         try {
>             tenantList = searchPartialTenantsDomains(tenantDomain);
>         } catch (Exception e) {
>             String msg = "Error in getting information for tenant " +
> tenantDomain;
>             log.error(msg, e);
>             throw new RestAPIException(msg);
>         }
>         return tenantList.toArray(new TenantInfoBean[tenantList.size()]);
>     }
>
>
> On Thu, Nov 20, 2014 at 11:45 AM, Nirmal Fernando <[email protected]>
> wrote:
>
>> +1 for GET /tenants/{tenantDomain}
>>
>> On Thu, Nov 20, 2014 at 5:44 AM, Udara Liyanage <[email protected]> wrote:
>>
>>>
>>> Hi,
>>>
>>> We have the following REST API method which IMO should be
>>> removed/deprecated. IMO it is not the RESTfull way of doing. Client should
>>> determine the availability of domain by sending a GET /tenants/{domains}
>>> and determine the availability by looking at the response of it.
>>> Further this should be GET, not POST
>>>
>>> @POST
>>> @Path("tenant/availability/{tenantDomain}")
>>> @Consumes("application/json")
>>> @AuthorizationAction("/permission/protected/manage/modify/tenants")
>>> @SuperTenantService(true)
>>> public Response isDomainAvailable(@PathParam("tenantDomain") String
>>> tenantDomain) throws RestAPIException {
>>>     boolean available;
>>>     try {
>>>         available = CommonUtil.isDomainNameAvailable(tenantDomain);
>>>     } catch (Exception e) {
>>>         String msg = "Error in checking domain " + tenantDomain + " is
>>> available";
>>>         log.error(msg, e);
>>>         throw new RestAPIException(msg);
>>>     }
>>>     // return a boolean
>>>     return Response.ok(available).build();
>>> }
>>>
>>>
>>> WDYT?
>>> --
>>>
>>> Udara Liyanage
>>> Software Engineer
>>> WSO2, Inc.: http://wso2.com
>>> lean. enterprise. middleware
>>>
>>> web: http://udaraliyanage.wordpress.com
>>> phone: +94 71 443 6897
>>>
>>
>>
>>
>> --
>> Best Regards,
>> Nirmal
>>
>> Nirmal Fernando.
>> PPMC Member & Committer of Apache Stratos,
>> Senior Software Engineer, WSO2 Inc.
>>
>> Blog: http://nirmalfdo.blogspot.com/
>>
>
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>



-- 
Best Regards,
Nirmal

Nirmal Fernando.
PPMC Member & Committer of Apache Stratos,
Senior Software Engineer, WSO2 Inc.

Blog: http://nirmalfdo.blogspot.com/

Reply via email to