Solved

Query the '/v1/customers?email=' with email that contains '+' sign

  • 25 October 2023
  • 2 replies
  • 36 views

Hi Team,

I integrated the backend with Customer.io and it’s working fine except for some corner cases.

We have some customers with non-standard emails - their emails contain a ‘+’ sign.
The API, which I’m using in the backend, https://api.customer.io/v1/customers?email= doesn’t retrieve existing customers.
I’ve tried to apply encoding to the URI, and even partially encoding applied only to the ‘+’ sign, but the result was not successful.
Examples: 

test+test@test.com
test%2Btest%40test.com 
test%2Btest@test.com

The interface the customer accessible via https://fly.customer.io/workspaces/<workspace_id>/journeys/people?email=test%2Btest%40test.com

and the email is fully encoded.

I hope we soon find a solution,
Thank you

icon

Best answer by Byron 25 October 2023, 17:09

View original

2 replies

Userlevel 2

Hi Alexey,

 

This is Byron from the technical support team. Great question! I did a little testing using cURL and Postman and was able to retrieve results from both by encoding the `+` symbol in the request with `%2B`. I see you mentioned that you tried that without success, so we may need a little more information about the full request you sent.

 

cURL:

curl --request GET \   --url 'https://api.customer.io/v1/customers?email=byron%2Btest@customer.io' \   --header 'Authorization: Bearer <myToken>'

 

Returns:

{"results":[{"email":"byron+test@customer.io","id":"testid","cio_id":"f8e50600fee501ffe501"}]

 

 

Postman:

GET https://api.customer.io/v1/customers?email=byron%2Btest@customer.io

 

Returns:

{   "results": [     {       "email": "byron+test@customer.io",       "id": "testid",       "cio_id": "f8e50643443201ffe501"     }   ] }

 

I also tested encoding `@` to `%40` and that also worked for both cURL and Postman.

Hi Byron,

Wow, the `curl` works fine with encoding the `+`,
Let me figure out what’s wrong with Spring RestTemplate (Java)

Thank you so much for your quick response!

Reply