mohannad_haddad | 2023-09-05 19:47:22 UTC | #1
Dear Team I'm trying to send an Get HTTP request to the following URL:
https://eqlaasb.api.crm4.dynamics.com/api/data/v9.2/contacts?$select=contactid&$filter=(mobilephone eq '%2b966563405915')&$top=1
and its get failed however I have transmitted it to be as the below
https://eqlaasb.api.crm4.dynamics.com/api/data/v9.2/contacts${esc.url("${esc.dollar}select=contactid&${esc.dollar}filter=(mobilephone eq ${esc.singleQuote}+966563405915${esc.singleQuote})&${esc.dollar}top=1")}.replace('+','%20')
the request for this URL showcase the below
{ "message": "The requested resource was not found.", "code": "not.found", "status": 404, "messageParams": {}, "contextId": "bf728d1e-13a0-4b36-8da4-315e1dde8a3a", "details": [ { "errorCode": "ACTION.REMOTEENDPOINT" } ], "errors": [ { "message": "REST call for action execute failed. Message: Request to backend service failed. Response from web service: <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"/>\r\n<title>404 - File or directory not found.</title>\r\n<style type=\"text/css\">\r\n<!--\r\nbody{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}\r\nfieldset{padding:0 15px 10px 15px;} \r\nh1{font-size:2.4em;margin:0;color:#FFF;}\r\nh2{font-size:1.7em;margin:0;color:#CC0000;} \r\nh3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} \r\n#header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:\"trebuchet MS\", Verdana, sans-serif;color:#FFF;\r\nbackground-color:#555555;}\r\n#content{margin:0 0 0 2%;position:relative;}\r\n.content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;}\r\n-->\r\n</style>\r\n</head>\r\n<body>\r\n<div id=\"header\"><h1>Server Error</h1></div>\r\n<div id=\"content\">\r\n <div class=\"content-container\"><fieldset>\r\n <h2>404 - File or directory not found.</h2>\r\n <h3>The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.</h3>\r\n </fieldset></div>\r\n</div>\r\n</body>\r\n</html>\r\n [bf728d1e-13a0-4b36-8da4-315e1dde8a3a]", "code": "NOTFOUND", "status": 404, "messageParams": {}, "details": [], "errors": [] } ] }
I'm seeking your support
mohannad_haddad | 2023-09-05 19:22:10 UTC | #2
Dears I get a success result when I used the following URL
"https://eqlaasb.api.crm4.dynamics.com/api/data/v9.2/contacts?%24select=contactid&%24filter=(mobilephone%20eq%20%27%252b966563405915%27)&%24top=1"
however I'm not able to see the exact response as like as postman
Postman response:
{ "@odata.context": "https://eqlaasb.api.crm4.dynamics.com/api/data/v9.2/$metadata#contacts(contactid)", "value": [ { "@odata.etag": "W/\"12025488\"", "contactid": "442f3f34-e14b-ee11-be6e-0022489cecab" } ] }
Genesys Data Action response:
{ "@odata.context": "<REDACTED>/api/data/v9.2/$metadata#contacts(contactid)", "value": [] }
I would appreciate your support if anyone can give me a hand in this
Jason_Mathison | 2023-09-05 20:08:46 UTC | #3
I suggest that you look at exactly what postman sent by opening the postman console and running a test. You will see exactly how the URL was actually encoded and sent.
Then you can look at the results of the URL Template step in your data action test mode, to see how the data action encodes the URL, and see what is different.
I don't know if it matters, but in the examples that you included in your second post, the postman response had the entire URL in the @odata.context, but the data action only had the /api/data/... part in the odata.context.
--Jason
mohannad_haddad | 2023-09-05 21:09:00 UTC | #4
Thanks @Jason_Mathison for your reply
I have did what you have mentioned and I can see there's no difference between the two ways except the escaping char in Genesys
Postman:
GENESYS Data action:
{ "requestUrlTemplate": "https://eqlaasb.api.crm4.dynamics.com/api/data/v9.2/contacts?%24select=contactid&%24filter=(mobilephone%20eq%20%27%252b${input.mobilephone}%27)&%24top=1", "requestType": "GET", "headers": { "Authorization": "${authResponse.tokentype} ${authResponse.accesstoken}", "Content-Type": "application/x-www-form-urlencoded", "Prefer": "return=representation" }, "requestTemplate": "${input.rawRequest}" }
Response from Data action:
{ "@odata.context": "<REDACTED>/api/data/v9.2/$metadata#contacts(contactid)", "value": [] }
Jason_Mathison | 2023-09-06 13:45:57 UTC | #5
What you are seeing in the postman screen capture is not necessarily what it is actually sending. Look for a "console" button on the bottom of the postman window. If you run your test again you should see an entry in the console log which will show what it actually sent (since postman may be escaping characters for you).
mohannad_haddad | 2023-09-07 07:52:20 UTC | #6
Thanks @Jason_Mathison now its working fine
system | 2023-10-08 07:53:12 UTC | #7
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 21852