Rest API multiple filters

Hi,

This is a very basic question regarding the REST API.

How do I use multiple filters to retreive record from the ems API?

For example, I have the following GET request:

https://[host]/rest/[tenant-id]/ems/ServiceDefinition?layout=Id,DisplayLabel,Category.DisplayLabel&filter=DisplayLabel='Business Support'&filter=Category.DisplayLabel='Credit'

I want to retreive all the Service Definitions where the DisplayLabel is 'Business Support' and the DisplayLabel of the Category is 'Credit'.

I have searched through the documentation and have not found an example of this, it is always one filter. The previous request only considers the first filter.

 

Best regards,

Tomas Azevedo

  • Verified Answer

    Tomas,

    You can only have one filter attribute. The combined filter needs to be inside the attribute.

    The query below should work for you

    https://[host]/rest/[tenant-id]/ems/ServiceDefinition?layout=Id,DisplayLabel,Category.DisplayLabel&filter=DisplayLabel='Business Support' and Category.DisplayLabel='Credit'

     

    A slightly different syntax is to use "startwith", rather than using the equal operator, this will perform the filter on the beginning of the string.

     

    https://[host]/rest/[tenant-id]/ems/ServiceDefinition?layout=Id,DisplayLabel,Category.DisplayLabel&filter=DisplayLabel startswith ('Business Support') and Category.DisplayLabel startswith ('Credit')

     

    Best regards,

    Brindusa