cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Odata Query Filter for MobileNumber

bhaskar_idp
Explorer
0 Kudos
1,010

Hi,

I am trying to filter contact using mobile number.

MobileNumber = '+911199334455'.

When i query odata with $filter=MobileNumber eq '+911199334455' it doesnt gave any result but response is 200.

Any idea on this?

Regards,
Bhaskar

Accepted Solutions (1)

Accepted Solutions (1)

former_member226
Employee
Employee

Hi,

It is due to the URL encoding behavior of the HTTP request and to resolve this issue you can simply replace '+' with '%2B' in your request url.

For e.g.: https://<Host:Port>/sap/opu/odata/sap/API_MKT_CONTACT_SRV;v=4/Contacts?$top=1&$filter=PhoneNumber eq '%2B491234432111'

This request will give you the first contact that matches phone number +491234432111.

Hope this helps!

Thanks
Saurabh

Answers (3)

Answers (3)

SCHNEIDERT
Active Contributor

Hi Bhaskar,

one question: Why don't you use API_MKT_CONTACT_SRV instead of your Custom View? Or do you need the contact details specifically in combination with your campaign?

I tried using that one but have the same problem using the Phone Number starting with '+'. So that seems to be the problem.

But as a workaround you could also use the phone number without the '+' if you change the $filter parameter a little bit and use "endswith". So, using the API_MKT_CONTACT_SRV the request has to look like that:

https://myxxxxxx-api.s4hana.ondemand.com/sap/opu/odata/sap/API_MKT_CONTACT_SRV/Contacts?$top=1&;$filter=endswith(PhoneNumber,'919999099999')

Maybe you can also try that for your Custom CDS View.

Kind Regards

Tobias

KunalBansal
SAP Champion
SAP Champion
0 Kudos

Hello bhaskar.idp,

Additional to Saravana's answer, I see you've created a custom CDS View and using the filter criteria CampaignId and InteractionContactId, It should work if the data which you're looking for really does exist in system.

Please check back once or share more screenshots to help you.

Thank you.

Best Regards,

Kunal Bansal, SAP Marketing Consultant

former_member599277
Contributor
0 Kudos

Hi Bhaskar,

As per my understanding , getting a 200 response has nothing to do with getting a result, because not returning any entry is still a valid result , so can you check if you can find any entries actually available for this filter criteria in the system .

Regards,
Saravana.