I see there is a post from 2020 about that Person summary - total value of won deals. But! I really want to filter it by person not by user!
How can I do this?
I do not want to load ALL the deals and to loop over them for calculate the total amounts so I hope there is an endpoint that can give me what I want in a light and efficient way.
You can include filter_id in the Get Deals Summary request, so just set up a filter for deals connected with that person.
Ok but …I have to do a filter for every person?
Because the person connected to my application will not be the same each time …^^
So it would mean create a filter each time a person is created in my database … it will pollute filters and this must be scripted …
I doubt that it is the good solution for my case
You can update a single filter dynamically using a script Pipedrive API v1 Reference
Not sure your use-case, maybe that’s not ideal. Our company purposes only uses the endpoint in scripts, hence the suggestion.
Even if it’s not the optimal solution, your solution would prevent me from looping on all the data to just get some numbers so I will investigate this and will come back to post the final word or… another questions if something went wrong. Thanks.
I am not sure how to use this endpoint.
I have used :
$conditions = [
'glue' => 'and',
'conditions' => [
[
[
'object' => 'person',
'field_id' => PERSON_FIELD_ID_EMAIL,
'operator' => '=',
'value' => $email,
'extra_value' => ''
]
]
]
];
It seems that my curl request does not return any error but…My filter is still the same.
I use the method PUT
…I do not know what I’m missing
Hmm, my code return a wrong thing so I used Postman and it said that my structure was not correct (conditions
is not seen as an array). I am investigating that now.
Yeah, the structure for updating filters is a bit tricky. Sometimes it’s easier to do a get of an existing filter set up the way you want it, and can use that as a suggestion for your structure - Pipedrive API v1 Reference
I’ve done so with a test filter, here it is in JSON format:
"conditions": {
"glue": "and",
"conditions": [
{
"glue": "and",
"conditions": [
{
"object": "person",
"field_id": "9029",
"operator": "=",
"value": "email@email.email",
"extra_value": null
}
]
},
{
"glue": "or",
"conditions": [
]
}
]
}
When I use the curl command to get the filters, I see my filter with a particular id. When I do the PUT request (in fact, it “pseudo” worked in my code but not in Postman for a reason that I do not understand), it shows another id …
I do not know if it is me that is tired or what but …
Possible you’re adding a new filter instead of updating existing? Otherwise not sure.
I cannot work on it at the end of the previous week for some reasons, but this morning I still do not succeed to make that PUT request work. I change the structure numerous times, even tried to put the name
optional parameter …
I do not know what to try next
Ok so I am very dumb those times.
The problem in PostMan was to send raw parameters and not via x-www-form-urlencoded
or form-data
.
But! On PHP side, I just did not use CURLOPT_POSTFIELDS
and was still using GET parameters for my PUT request and I had to remove urlencode
as well.
Now that I can update my filter, I will see if it solves my initial problem.
Glad to hear it lionel!
Thanks for the awesome answers @paulieweb and for sharing the details @lionel I found it helpful