35
Views
14
Comments
Solved
Facing issue consuming API in Outsystems
Question

Hii,

I am trying to comsume an API from ManageEngine (specifically this one) and the issue I am facing is that even though I am passing the correct data it is giving me an error message but at the same time the same data is working in call made through Postman.

Outsystems Call and Result:-

Postman Call and Result:-

Postman Headers:- 

Response Sent in both:-

{ "PatchIDs":[1****6], "ResourceIDs":[1***************013],"ConfigName":"testing Outsystems", "ConfigDescription":"API test", "actionToPerform":"Deploy", "DeploymentPolicyTemplateID":13************7 }  

I can provide the HTTP trace from Outsystems log but even in that the input body looks like this:

{"ConfigName":"testing Screen 2","ConfigDescription":"API test","actionToPerform":"Deploy","DeploymentPolicyTemplateID":***************}.

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.


2022-12-30 07-28-09
Navneet Garg
Solution
2022-02-03 15-55-20
Diogo Pereira

Hi,


It seems that you are only getting a validation error on the API you are trying to use.

From what the error tells me it might be with the Text you are sending in the ConfigName field.

Try to send a simple text without spaces for example.

UserImage.jpg
Naman Gadia

It still gives me this same error unfortunately no matter what name I put the CongName field. 

2022-02-03 15-55-20
Diogo Pereira

Have you tried to remove the Accept Header Parameter?

UserImage.jpg
Naman Gadia

Yeah, I initially was not using the Accept at all just used to see if it fixes the issue. Currently it's not working either way.


2022-02-03 15-55-20
Diogo Pereira

Can you copy here the Json request that you are sending? To validate if is there an error?

Because if you are able to use Postman in Outsystems it should be the same.

2022-02-03 15-55-20
Diogo Pereira

If you try to replicate the same call in Postman it works without any error? No matter the times you try it?

I'm asking this because the error seems to be on the API side, because the response is in the format of the errors that the API of Manage Engine should return, and that it's saying that you are being able to call the API from Outsystems, but something on their side is breaking.

2022-02-03 15-55-20
Diogo Pereira

I think you might having an issue with encoding. The Encoding that Outsystems uses in REST API Calls might be different from the encode that Manage Engine is using. Outsystems uses always UTF-8. Try to change that in the header value or try in the OnBeforeRequest do the encode yourself with the TextToBinaryData.

Will Share with you some resources of people with a similar issue when calling REST APi through Outsystems:

https://www.outsystems.com/forums/discussion/16634/rest-encoding-problem/

https://www.outsystems.com/forums/discussion/71480/consume-rest-api-encoding-problem-deepl-rest-api/

https://www.outsystems.com/forums/discussion/95090/rest-api-encoding-problem/

https://www.outsystems.com/forums/discussion/89224/url-encoded-values-in-rest-calls/

2022-12-30 07-28-09
Navneet Garg

problem in the brackets used in PatchIDs  and ResourceIDs try to use it in quotes

"PatchIDs":[1****6], "ResourceIDs":[1***************013] 

UserImage.jpg
Naman Gadia

That's the format required to send in the data for the API to properly function. Have a look here.

2022-12-30 07-28-09
Navneet Garg

Yes I understand that but I am not sure that OutSystems support the array type I already faced same issue with the JSON array something like below. Can you just try once "PatchIDs":"[1****6]", "ResourceIDs":"[1***************013]" like this 

{

  "streams": [

    {

      "stream": {

        "label": "value"

      },

      "values": [

         1,2,3

      ]

    }

  ]

}


UserImage.jpg
Naman Gadia


Considering that I only have to replace the "streams" with PatchIDs/ResourceIDs I tried this but it still didn't work

 "PatchIDs":[    

   {        "PatchID": {            

                       "label":"value"        

},         

"values":[ 1******6 ]}], 

"ResourceIDs":[    

{        "ResourceID": {

            "label":"value"        

},         

"values":[ 13****************013]}],

2022-12-30 07-28-09
Navneet Garg

Yes I tried this as well even blank JSON giving the same error. In all cases OutSytems giving same error.

I also tried only and it is working in postman but in Outsystems given same error.

{    "ResourceIDs": "[601]" }

2022-12-30 07-28-09
Navneet Garg
Solution
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.