Erro to query where string condition

Hello,

I have an error in my parse query.

I have a “numberPhone” column of type string but the query does not return the value.

https://mylocalserver.com/parse/classes/numberVerified?where={"numberPhone":"+1-541-754-3010 "}

errorparse

What do you get as response? You should probably pass application id as request header. And there is an empty space after phone number. Can you remove that space and try again?

I think you have an extra space at the end your number

@uzaysan The query is answered, parse returns me an empty list.

@dplewis There is no empty space, as I certify at the time of inclusion of the record.

parse erro2

Empty space is not in the parse object. İts in the query.

Look closer:
here={"numberPhone":"+1-541-754-3010 "}

there is an empty space between 0 and ". see: 4-3010 "}

@uzaysan Oops, I didn’t notice this space, but I corrected it according to the image below and the error persists.

Sorry @dplewis I didn’t understand it the first time. I thought you referred to the record recorded in Parse.

I did some tests removing the special characters and leaving only numbers and it works.

But this way I lose the display format, I did not want to have to make the duplicate record, only numeric and the other with the formatted one.

I think you should convert json to string first. Can you try this:
https://mylocalserver.com/parse/classes/numberVerified?where={\"numberPhone\":\"+1-541-754-3010\"}

Error

Hello!!

I kept that thought in mind and couldn’t understand it.

I believe this is an error in the query, I did a test, removed the “+” character and it worked successfully.

Can you please test this scenario in your environment? To try to discover this error?

@dplewis and @uzaysan

Since you are passing your where clause in the query string, you need to url encode your data. Seeing your query, + needs to be url encoded, and that’s why it works when you remove it. Replace + to %2B and it should work.

Same error, no results

Would you mind to share your current curl command which is causing the error?

Yes @davimacedo , sure:

curl -X GET \
  -H "X-Parse-Application-Id: SECRET_TOKEN" \
  -H "X-Parse-Client-Key: SECRET_TOKEN" \
  -H "X-Parse-Session-Token: SECRET_TOKEN" \
  -G \
  --data-urlencode 'where={"number": "%2B1-541-754-3010"}' \
  https://parseapi.back4app.com/classes/numberVerified

In the case of this curl command, --data-urlenconde option already encodes the “+” sign for you so you don’t need to encode yourself. I’ve just tested here, and the following command successfully worked for me:

curl -X GET \
  -H "X-Parse-Application-Id: SECRET_TOKEN" \
  -H "X-Parse-Client-Key: SECRET_TOKEN" \
  -G \
  --data-urlencode 'where={"number": "+1-541-754-3010"}' \
  https://parseapi.back4app.com/classes/numberVerified

@davimacedo resolved, sorry for the delay in response. Because I was analyzing what was going on. The SDK I use does not do UrlEncode (), I will request a PR for the next version.