Hi, 

I'm trying to consume SAP C4C Rest API from my module but the URL I use for testing is different from the one I get on the logs

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codata/AccountCollection?$format=json&$select=AccountID,Email,AccountName&$filter=AccountID%20eq%20'{CustomerID}'

Which returns 200 OK, but when I publish this is the URL I see on the log

https://myXXXXXX.crm.ondemand.com/sap/c4c/odata/v1/c4codata/AccountCollection?%24format=json&%24select=AccountID%2cEmail%2cAccountName&%24filter=271104

271104 is the value I have on variable CustomerID

Any clue?

Thanks!

Hi Amelia,

Actually both urls are same, only difference is that when you create a URL it replace the symbols with equivalent URL encoding symbols. From this link you can verify the code for $ is %24 etc.

https://www.w3schools.com/tags/ref_urlencode.ASP

Are you facing any issue except this change in URL?

Thanks.

vikas sharma wrote:

Hi Amelia,

Actually both urls are same, only difference is that when you create a URL it replace the symbols with equivalent URL encoding symbols. From this link you can verify the code for $ is %24 etc.

https://www.w3schools.com/tags/ref_urlencode.ASP

Are you facing any issue except this change in URL?

Thanks.

Hi, both are not the same, look at the end.

Original URL - filter=AccountID%20eq%20'{CustomerID}'

Logs URL - filter=271104

Issue is that API only understands AccountID eq '271104' no just 271104

Regards


Amelia Salgado wrote:

vikas sharma wrote:

Hi Amelia,

Actually both urls are same, only difference is that when you create a URL it replace the symbols with equivalent URL encoding symbols. From this link you can verify the code for $ is %24 etc.

https://www.w3schools.com/tags/ref_urlencode.ASP

Are you facing any issue except this change in URL?

Thanks.

Hi, both are not the same, look at the end.

Original URL - filter=AccountID%20eq%20'{CustomerID}'

Logs URL - filter=271104

Issue is that API only understands AccountID eq '271104' no just 271104

Regards



Hi,

So for ', can you try with its equivalent url encoding. For ' it will %27, can verify from above url. so for customerId you can pass one string like %27271104%27. Here 271104 is customer id as mentioned by you.



vikas sharma wrote:

Amelia Salgado wrote:

vikas sharma wrote:

Hi Amelia,

Actually both urls are same, only difference is that when you create a URL it replace the symbols with equivalent URL encoding symbols. From this link you can verify the code for $ is %24 etc.

https://www.w3schools.com/tags/ref_urlencode.ASP

Are you facing any issue except this change in URL?

Thanks.

Hi, both are not the same, look at the end.

Original URL - filter=AccountID%20eq%20'{CustomerID}'

Logs URL - filter=271104

Issue is that API only understands AccountID eq '271104' no just 271104

Regards



Hi,

So for ', can you try with its equivalent url encoding. For ' it will %27, can verify from above url. so for customerId you can pass one string like %27271104%27. Here 271104 is customer id as mentioned by you.



Hi, I think I didn't explain myself correctly. Issue is not with CustomerID but with the text between filter and the customer id. 

It should be filter=Account id eq '271104' not filter=271104

Where is the rest of the text?

Thanks


Hi Amelia,

What is the URL you use in Service Studio?