I need to search leads via API by mail.
I use call /rest/v1/leads.json?filterType=email&filterValuesemail@example.com
it returns nothing.
It looks like the problem with "+" sign in email.
It returns leads with emails without "+" and does not return leads with emails with "+"...
Are there any ways to escape +?
Does not work as well:
Thanks in advance - any help/suggestions appreciated!
Solved! Go to Solution.
We had a similar problem with Server Side From Post to Marketo where the plus character was converted to a blank character. I think we replaced the '+' character with its HTML equivalent (%43) and that solved the problem. We may have had to convert all the fields' characters to their HTML equivalent.
I would need to test it, but I suspect the "+" is a reserved character in the database query. If you try URL encoding it as a %43 as Elliot suggests, does that work?
Thanks, %2B works fine
Intersting, that rest/v1/leads.json with
works fine and updates lead with email with +.
That's because the + there is contained in the body of a POST, rather than in a URL parameter of a GET. The body of a POST doesn't need to be URL encoded in the same way.
You're POSTing in the JSON format, which doesn't need the + to be encoded in a special way because + isn't part of the JSON delimiting structure itself. If, however, you needed to put a " (double quotation mark) character in your JSON post, you'd need to escape it as \" because quotes are used in a special way in JSON.
If your POST were sent in the x-www-form-urlencoded format, then it would be subject to exactly the same rules as a GET request, and you would have to use %2B.
Almost every data format has at least one character that needs to be treated specially in order to not interfere with parsing that format. An exception is fixed-size formats, where a long string is always split up at preset points (characters 1-8, characters 9-25, and characters 26-50, for example) so it doesn't matter what characters are used in each section of the string.