cancel
Showing results for 
Search instead for 
Did you mean: 

Issue In Passing ampersand '&' in URL when sending requests to web service

AakashN24
Participant
0 Kudos
827

Hi,

In SAP IRPA automation

I'm sending a get request to my CAP service in one of my automation using 'CALL web service with destination'

in the first step I'm giving the parameters for the web service call

return { 'url': '/mrorequestdolphin/MaintenanceRequests?$filter=to_requestStatus_rStatusDesc eq \'Revision & Event Created\'', 'method': 'GET', headers: { 'Accept' : 'application/json', 'Content-Type': 'application/json' }, 'responseType':'json', // parse the body of the result as a JSON object 'resolveBodyOnly':true // get only the body of the response};

Here in the url when we give '&' directly we are getting an error 'Bad Request'

So I have tried giving URI encoding of & '%26'

although there is no error the query is not working as the response is blank.

Similarly I have tried using the method encodeURIComponent() but the result is same as before no response

Note: I have tried with other values in the URL without ampersand and the automation works fine and gives the desired result the problem arises when I tried using & in the URL

Please help me in resolving this issue

Regards,

Accepted Solutions (0)

Answers (3)

Answers (3)

RobertoAnselmi
Explorer
0 Kudos

Hi all,

i am having the same problem.

Even i am sending S%26A for S&A when building the URI through the SAP Web IDE, the value it is not converted when arriving to the backend.

My URI is

https://hidden.com:9999/sap/opu/odata/sap/Z_SRV/TestEntSet ?$filter=field1 eq 'AA' and field2 eq 'B' and field3 eq 'S%26P_TYPE'

My expectation is to see in the backend

https://hidden.com:9999/sap/opu/odata/sap/Z_SRV/TestEntSet ?$filter=field1 eq 'AA' and field2 eq 'B' and field3 eq 'S&P_TYPE'

but what i am still receiving in the backed S%26P_TYPE without the conversion.

Regards

Rob

MariamIdman
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Akash,

I'm facing exact issue trying to encode ":" in the URl I need to use encodeURIComponent() but I couldn't find it in the iRPA core I only find the function encodeURI which doesn't encode characters like ":" . can you please tell me how did you used encodeURIComponent() in iRPA ?


thanks

Jana_dK
SAP Mentor
SAP Mentor
0 Kudos

Did you try to encode only the & character or the whole url?
I've had similar issues with trying to add an url as attachment to an invoice. I never managed to get past this encoding problem.