Community
Showing results for 
Search instead for 
Do you mean 
Reply

GET api/opportunities - what is supported for Filter?

New Member
Posts: 4
Country: United Kingdom

GET api/opportunities - what is supported for Filter?

I can successfully retrieve all of the opportunities, but ideally I would like to be able to filter them

ie. ?$filter=(companies/id eq '27bb306a9d-942a-4e0d-a13b-3e96d7b200de') would be ideal, but it doesn't appear to work properly.

 

What filter options have been implemented?

 

This post implies there is no way to filter opportunities by contacts but since it's a year old, I'm hoping that has changed.

https://community.act.com/t5/Act-Premium-Web-API/Find-all-opportunities-for-a-contact/m-p/327142/hig...

 

Regards,

 

Graeme

New Member
Posts: 4
Country: United Kingdom

Re: GET api/opportunities - what is supported for Filter?

Anybody?

 

Can anyone provide any examples of how the filters work (or don't work) with regards to opportunities?  Because at the moment - it appears to ignore all filters.

 

Graeme

Administrator
Posts: 4,024
Country: United_Kingdom

Re: GET api/opportunities - what is supported for Filter?

[ Edited ]

Hi Graeme,

 

When it comes to filtering Opportunities, not all the filters have been implemented yet.

 

Here are some examples of the basic filtering capabilities currently supported: 

/api/opportunities?$filter=(name eq ‘New Opportunity’)
/api/opportunities?$filter=( actualCloseDate eq 9999-12-31T00:00:00Z)
/api/opportunities?$filter=( estimatedCloseDate eq 2017-05-16T00:00:00Z)
/api/opportunities?$filter=( daysOpen eq 0)
/api/opportunities?$filter=( grossMargin eq 0)
/api/opportunities?$filter=( isPrivate eq false)
/api/opportunities?$filter=( reason eq 'Budget')
/api/opportunities?$filter=( stage/name eq 'Initial Communication')
/api/opportunities?$filter=( openDate eq 2017-05-16T00:00:00Z)
/api/opportunities?$filter=( weightedTotal ge 0)
/api/opportunities?$filter=( recordOwner eq 'admin')

You can also filter in custom fields:

/api/opportunities?$filter=( customFields/opportunity_field_1 eq 'Test')
/api/opportunities?$filter=startswith( customFields/opportunity_field_1, 'T')
/api/opportunities?$filter=endswith( customFields/opportunity_field_1, 't')

The following also work, however work differently to other date fields.  These require the -offset on the date to work:

/api/opportunities?$filter=( created eq 2017-05-16T06:36:09-07:00)
/api/opportunities?$filter=( edited eq 2017-05-16T06:36:09-07:00)

All of the above can be search with basic functions (filter, startswith, and endswith), and filtered using all the odata operators.

 

 

Unfortunately, filtering on contacts has not yet been implemented. Additionally, It's currently not possible to filter on the following columns:

  • creator
  • manger
  • probability
  • productTotal
  • totalPerCompany
  • totalPerContact
  • totalPerGroup
  • editedBy

The following functions are also not yet supported:

 

All Filtering:

i.e. Get all opportunities that belong to a company:

/api/opportunities?$filter=all(companies, id eq 'a2cbf2a7-cefb-47f5-8ac8-90896a53795e' )
/api/opportunities?$filter=all(companies, name eq 'CVS Health' )

Filtering on opportunity status:

/api/opportunities?$filter=( status eq Act.Framework.Opportunities.OpportunityStatus'0')  --NO RESULTS

These queries currently throw errors:

/api/opportunities?$filter=( status eq 0)   -- ERROR
/api/opportunities?$filter=( relatedEntitiesResolver eq True)

 

Further development on the API is ongoing, and these currently unsupported features are on the roadmap for future implementation.

 

Hopefully, this info helps towards your development efforts.

New Member
Posts: 4
Country: United Kingdom

Re: GET api/opportunities - what is supported for Filter?

A belated thank you (sorry I've been away)!  That was exactly what I was looking for.

 

Unfortunately I was looking to get all the opportunities that belong to a company, but at least I know that now.  If I put a vote down to add that functionality as soon as possible.

 

Graeme