Gathering opportunities that belong to a specific owner

34 views
Skip to first unread message

Bryan O'Neil

unread,
Nov 12, 2018, 10:45:05 AM11/12/18
to Capsule API
Hi all,

I was wondering if anyone can point me in the right direction here. I'm trying to build a fairly simple script that imports opportunities from Capsule.

However, I'd like the API result to only include opportunities that have one specific owner and was wondering if this can somehow be done?

I realise it's possible to grab all opportunities and do the filtering on my side but this would be a huge resource drain, plus it doesn't help that the API only returns 100 results per page as the maximum.

Thanks in advance!
Bryan

Ben Dale

unread,
Nov 12, 2018, 11:08:10 AM11/12/18
to Capsule API
Hi Bryan,

Thanks for getting in touch! We have a new filtering API which sounds like it would be suitable for your needs. This part of the API isn't documented yet, but I can share some details with you directly for now.

curl -i \
-H 'Authorization: Bearer [TOKEN]' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
  "filter": {
    "conditions": [
      {
        "field": "owner",
        "operator": "is",
        "value": "[USERNAME]"
      }
    ]
  }
}' \


The above request will return the first 50 opportunities owned by a particular user, where [USERNAME] is the username of the user. Hopefully this is all you need to get going. Let me know how you get on.

Thanks!

Ben

Bryan O'Neil

unread,
Nov 13, 2018, 4:36:03 AM11/13/18
to ben....@zestia.com, capsu...@googlegroups.com
Ben,

Actually - just another quick question if you don't mind.

Does this filtering also work on fields that are nester deeper and if so, what would the syntax be?

For example, let's say that I'd like to filter out opportunities where mileston -> name = X

Thanks again!

On Tue, Nov 13, 2018 at 2:12 AM Bryan O'Neil <br...@bryanoneil.com> wrote:
Thanks Ben! This is exactly what I was looking for.

--
You received this message because you are subscribed to a topic in the Google Groups "Capsule API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/capsule_api/4A_z5uqF1k8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to capsule_api...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Kind Regards,
Bryan O'Neil

http://BryanONeil.com/ - Industry insights and uncensored information about brokers, marketplaces and due diligence.


--
Kind Regards,
Bryan O'Neil

http://BryanONeil.com/ - Industry insights and uncensored information about brokers, marketplaces and due diligence.

Ben Dale

unread,
Nov 13, 2018, 4:57:24 AM11/13/18
to Capsule API
Hi Bryan,

Great question. You can add another condition object the array of existing conditions, for example:

curl -i \
-H 'Authorization: Bearer [TOKEN]' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
  "filter": {
    "conditions": [
      {
        "field": "owner",
        "operator": "is",
        "value": "[USERNAME]"
      },
      {
        "field": "milestone",
        "operator": "is",
        "value": [MILESTONE_ID]
      }
    ]
  }
}' \

The above request will filter opportunities where the owner is [USERNAME] and the milestone is [MILESTONE_ID]. Let me know if you have any more questions!

Thanks,

Ben
To unsubscribe from this group and all its topics, send an email to capsule_api+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--
Kind Regards,
Bryan O'Neil

http://BryanONeil.com/ - Industry insights and uncensored information about brokers, marketplaces and due diligence.
Reply all
Reply to author
Forward
0 new messages