Reputation: 185
I am trying to fetch custom objects based on field value including '+' character. More specifically, I am fetching a Contact custom object which has an email address field.
It works fine with normal email addresses. However, I have also email addresses that include '+' character and the fetch fails.
How should I use the QBCustomObjects.getObjects API call with request builder? All hints & tips are appreciated! Thanks in advance!
Code:
QBCustomObjectRequestBuilder requestBuilder = new QBCustomObjectRequestBuilder();
requestBuilder.eq("emailAddress", “[email protected]"); // WORKS
// BUT: [email protected] DOES NOT WORK
QBCustomObjects.getObjects("Contact", requestBuilder, new QBCallbackImpl() {
@Override
public void onComplete(Result result) {
// do stuff here..
}
});
Upvotes: 0
Views: 287
Reputation: 185
I solved this issue by doing URL encoding in order to meet HTTP POST requirements with special characters. I thought this would have been done automatically by the QB library but it wasn't.. This could be improvement to add in next versions (like in iOS library)?
Solution:
String encodedEmail = URLEncoder.encode(email, "UTF-8");
Upvotes: 1