Hii,
I am trying to comsume an API from ManageEngine (specifically this one) and the issue I am facing is when I try to test in the Outsystem's API view it's working fine but as soon as I put the same data through a screen, it gives me an error.
Outsystems Call and Result:-
Request Body :-
{ "PatchIDs":[341483,339984,339915,111861], "ResourceIDs":[8779000000814165], "ConfigName":"TestDeployment", "ConfigDescription":"API test Outsystems", "actionToPerform":"Deploy", "DeploymentPolicyTemplateID":8779000000192928 }
But when I try to consume this in a server action by giving the "PatchIDs" in LongInt List and other required parameters accordingly in the call I get this error :-{"error_description":"Configuration Name cannot contain any of the following characters \\ / : * ? \" < > & |","message_type":"installpatch","error_code":"3010","message_version":"1.3","status":"error"}
I have digged through the logs and when I try to put the same body which is shown in the log in Ousystem's API testing view it works as it should. Support team from ManageEngine can't do much as the issue seems to be in the way outsystems is handling this call. If you see or know anything that can help in this, please let me know.
Note:- I had a same issue previously here, but the solution suggested in that doesn't work in this scenario.
Your error says "Configuration Name cannot contain any of the following characters \\ / : * ? \" < > & |" .
Please enable the Logging Level to Full and inspect what is going from your end and if possible do share after masking sensitive data.
This is what I get in the log :- "POST https://endpointcentral.manageengine.in/api/1.3/patch/installpatch?customerid=8779****************** HTTP/1.1User-Agent: OutSystemsPlatformContent-Type: application/json; charset=UTF-8Authorization: [redacted]Host: endpointcentral.manageengine.inContent-Length: 220{"PatchIDs":[341483,339984,339915,111861],"ResourceIDs":[8779000000******],"ConfigName":"TestDeployment","ConfigDescription":"API test Outsystems","actionToPerform":"Deploy","DeploymentPolicyTemplateID":8779000000******}"
I have tried using this same request body in the Test UI of OutSystems and the call works without any errors.
You mentioned that from Service Studio when you test it works but when send from Code it does not work.
Let's take a different approach to troubleshoot this issue. Do change the Base URL of REST API to "https://echo.free.beeceptor.com" . This is an echo service and it will respond by echoing the content back to you. Now test your service in Service Studio and copy the result to a notepad for later comparison. In Service Studio change the output of the API to Text variable and Response format as "Text/plain" and LogMessage the response. Now test your REST API and compare the result logged in Service Center with the data you copied earlier. This will tell you exactly what is send out in both scenarios.
Response in service studio in https://echo.free.beeceptor.com :-
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Alt-Svc: h3=":443"; ma=2592000
Vary: Accept-Encoding
Transfer-Encoding: chunked
Content-Type: application/json
Date: Thu, 03 Oct 2024 08:40:23 GMT
{
"method": "POST",
"protocol": "https",
"host": "echo.free.beeceptor.com",
"path": "/",
"ip": "44.***********",
"headers": {
"Host": "echo.free.beeceptor.com",
"User-Agent": "OutSystemsPlatform",
"Content-Length": "255",
"Authorization": "***************",
"Content-Type": "application/json",
"Accept-Encoding": "gzip"
},
"parsedQueryParams": {},
"parsedBody": {
"PatchIDs": [
341483,
339984,
339915,
111861
],
"ResourceIDs": [
8779000000******
"ConfigName": "TestDeployment",
"ConfigDescription": "API test Outsystems",
"actionToPerform": "Deploy",
"DeploymentPolicyTemplateID": 8779000000******
}
Response in the Log when I store the result in LogMessage
{ "method": "POST", "protocol": "https", "host": "echo.free.beeceptor.com", "path": "/", "ip": "44.**********", "headers": { "Host": "echo.free.beeceptor.com", "User-Agent": "OutSystemsPlatform", "Content-Length": "206", "Authorization": "Zoho-oauthtoken ********", "Content-Type": "application/json; charset=UTF-8", "Accept-Encoding": "gzip" }, "parsedQueryParams": {}, "parsedBody": { "PatchIDs": [ 400009, 111861 ], "ResourceIDs": [ 8779000000***** ], "ConfigName": "TestOutsystems", "ConfigDescription": "API test Outsystems", "actionToPerform": "Deploy", "DeploymentPolicyTemplateID": 8779000000****** }}
I can't see any noticeable difference b/w either, I have tried both the parse body output in the actual manage engine call in Service center and both are giving me successful results but I still can't figure out why the call is not working in the App itself.
Since there is no difference in output in both scenarios ( except PatchIDs) you should reach out to ManageEngine Support team with this data. They should have a way to knowing what's coming in.
btw please try the patchIds and see if there is any difference.
You error "Configuration Name " it is a plan text it does not include the following characters \\ / : * ? \" < > &. Please check while assigning input to the server action.
I have checked it multiple times with simplified letter only names and it still gives me error.
I have the same problem.
Did you were able to solve it?
Yeah, the issue is Outsystems sends "application/json; charset=UTF-8" as the default "Content Type" header even if you specify it as "application/json" only.
To rectify the issue, you will need to use a forge component named REST Extender and use it's "SetContentType" function in the OnBeforeRequest action and change the content type to "application/json".
Thanks!