PUT request for Filter responds as if it was a GET

Hi, i’m trying to update a filter with google app script

here is my request:
{headers={Accept=application/json}, method=put, payload={“glue”:“and”,“conditions”:[{“glue”:“and”,“conditions”:[{“object”:“deal”,“field_id”:“12448”,“operator”:"!=",“value”:“deleted”,“extra_value”:null},{“object”:“deal”,“field_id”:“12445”,“operator”:"=",“value”:“3”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“11”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“12”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“13”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“37”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“14”,“extra_value”:null}]},{“glue”:“or”,“conditions”:[{“object”:“deal”,“field_id”:“12454”,“operator”:">",“value”:“2018-01-01”,“extra_value”:null},{“object”:“deal”,“field_id”:“12448”,“operator”:"=",“value”:“open”,“extra_value”:null}]}]}, followRedirects=true, validateHttpsCertificates=true, useIntranet=false, contentType=application/x-www-form-urlencoded, url=https://api.pipedrive.com/v1/filters/205?api_token=sometoken}

here is the response from pdApi
[18-01-30 20:50:35:060 EAT] RESPONSE CODE: 200
[18-01-30 20:50:35:061 EAT] RESPONSE HEADERS:
[18-01-30 20:50:35:062 EAT] {Transfer-Encoding=chunked, Server=no-name-at-all, Access-Control-Allow-Origin=*, x-ratelimit-limit=100, X-Content-Type-Options=nosniff, Connection=keep-alive, x-correlation-id=14fd3fab-57de-45dd-87f0-c0af45d47aec, badi=Routing: chi=>chi;, x-ratelimit-reset=10, x-ratelimit-remaining=98, Date=Tue, 30 Jan 2018 17:50:35 GMT, X-Frame-Options=SAMEORIGIN, Access-Control-Expose-Headers=X-RateLimit-Remaining, X-RateLimit-Limit, X-RateLimit-Reset, Strict-Transport-Security=[max-age=15768000, max-age=15768000], Content-Encoding=gzip, x-newrelic-app-data=PxQOVVFaCwoTUlhaBAgBUFETGhE1AwE2QgNWEVlbQFtcC2VOchRAFgtba04QUmQcVg0NFlJDRDpLWEJWDzkTF0RAFFIWCAQCA1UVUR9RB1VRBBtMV08aCwQHAlMPBgNSBwUPBVReVEAcBFkOS11p, Vary=Accept-Encoding, Set-Cookie=pipe-last-active=1517334634992;path=/;domain=.pipedrive.com;expires=0, X-XSS-Protection=1; mode=block, Content-Type=application/json}
[18-01-30 20:50:35:062 EAT] RESPONSE CONTENT TEXT: {“success”:true,“data”:{“id”:205,“name”:"\u0410\u043b\u043e\u043a\u0430\u0446\u0438\u044f \u0412\u044b\u0433\u0440\u0443\u0437\u043a\u0430",“active_flag”:true,“type”:“deals”,“temporary_flag”:null,“user_id”:426728,“add_time”:“2018-01-30 09:46:20”,“update_time”:“2018-01-30 17:50:35”,“visible_to”:“1”,“custom_view_id”:393,“conditions”:{“glue”:“and”,“conditions”:[{“glue”:“and”,“conditions”:[{“object”:“deal”,“field_id”:“12448”,“operator”:"!=",“value”:“deleted”,“extra_value”:null},{“object”:“deal”,“field_id”:“12445”,“operator”:"=",“value”:“3”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“11”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“12”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“13”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“37”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“14”,“extra_value”:null}]},{“glue”:“or”,“conditions”:[{“object”:“deal”,“field_id”:“12454”,“operator”:">",“value”:“2019-01-01”,“extra_value”:null},{“object”:“deal”,“field_id”:“12448”,“operator”:"=",“value”:“open”,“extra_value”:null}]}]}}}
[18-01-30 20:50:35:063 EAT] {“success”:true,“data”:{“id”:205,“name”:"\u0410\u043b\u043e\u043a\u0430\u0446\u0438\u044f \u0412\u044b\u0433\u0440\u0443\u0437\u043a\u0430",“active_flag”:true,“type”:“deals”,“temporary_flag”:null,“user_id”:426728,“add_time”:“2018-01-30 09:46:20”,“update_time”:“2018-01-30 17:50:35”,“visible_to”:“1”,“custom_view_id”:393,“conditions”:{“glue”:“and”,“conditions”:[{“glue”:“and”,“conditions”:[{“object”:“deal”,“field_id”:“12448”,“operator”:"!=",“value”:“deleted”,“extra_value”:null},{“object”:“deal”,“field_id”:“12445”,“operator”:"=",“value”:“3”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“11”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“12”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“13”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“37”,“extra_value”:null},{“object”:“deal”,“field_id”:“12447”,“operator”:"!=",“value”:“14”,“extra_value”:null}]},{“glue”:“or”,“conditions”:[{“object”:“deal”,“field_id”:“12454”,“operator”:">",“value”:“2019-01-01”,“extra_value”:null},{“object”:“deal”,“field_id”:“12448”,“operator”:"=",“value”:“open”,“extra_value”:null}]}]}}}

as you can see, i’m trying to chage date value in the field 12454
but it is not changing.

i’ve tried the same payload/body with your api test tool.
it works with test tool

could you please help me, i can’t understand what is going wrong
plz, help

Hi @Lexrost, in order to better investigate this, could you share with me the email address linked to the api token you are using please?

1 Like

@diego.mendez
ok, my email Adress is lexrost@cultserv.ru

Hi @Lexrost, it seems our endpoint is having problems supporting multi form data right now, would you be able to try with raw JSON please?

@diego.mendez ty for quick answer
what do you meen by raw JSON ?

i do that already

here is my code

var pdApiRequest = pdApiUrl+‘filters/’+pdFilterId+’?’+‘api_token=’+token;

var pdResponse = UrlFetchApp.fetch(pdApiRequest);
var pdResponseJson = JSON.parse(pdResponse);

var newDate = ‘2018-01-01’;
pdResponseJson.data.conditions.conditions[1].conditions[0].value = newDate;
var myRequest = pdResponseJson.data.conditions

var newFilter = JSON.stringify(myRequest);

var options = {
//“muteHttpExceptions”: true,
“method” : “PUT”,
//“Content-Type”: “application/json”,
“headers”: {
“Accept”: “application/json”
},
“payload”: newFilter
}

try {
var resp = UrlFetchApp.fetch(pdApiRequest, options);
} catch (e) {
Logger.log(e);
}

Hey @Lexrost I meant if you could try it in something like Postman using the raw Json option. We recently found that our filters endpoint is having an issue with multi-form format, but another user was able to work around it this way.

@diego.mendez
Hmmm, ok i’ll try to figure smthing out.
do you have any prognosis on solving the issue ?

Hi,

Is this still an issue? Because I am not able to make this work. After loooong time, I managed to get a success response but the conditions do not update.

Here is my “raw” data :
"conditions": "{"glue":"and","conditions":[{"glue":"and","conditions":[{"object":"person","field_id":"9049","operator":">","value":"2020-02-18","extra_value":null}]},{"glue":"or","conditions":[]}]}"

her is my response :
{
“success”: true,
“data”: {
“id”: 18,
“name”: “test”,
“active_flag”: true,
“type”: “people”,
“temporary_flag”: null,
“user_id”: xxxxx,
“add_time”: “2020-02-23 11:36:43”,
“update_time”: “2020-02-23 12:52:51”,
“visible_to”: “1”,
“custom_view_id”: null,
“conditions”: {
“glue”: “and”,
“conditions”: [
{
“glue”: “and”,
“conditions”: [
{
“object”: “person”,
“field_id”: “9049”,
“operator”: “>”,
“value”: “2020-02-20”,
“extra_value”: null
}
]
},
{
“glue”: “or”,
“conditions”: []
}
]
}
}
}

as you can see, the value does not change, despite the success response. This is driving me crazy. please advise.

Thank you,

K

Hey Konrad

Did you find an answer to this? I’m having the same problem… any help much appreciated!