Hi Experts.

Im trying to consume an API, when i test it using the Outsystem it return no error, but when im trying to embed it using the outsystems app it return an error code of a 500 internal server error, and upon debugging all the data are being populated correctly.


Can anyone have this kind of experience. 


Hi Ja,

Try setting the LogLevel of the API to Full in order to be able to download the HTTP Trace after the error occurs. 

Maybe you can find out what's going on from that detailed log.

Regards,

Nordin

I have had experience where the Test works and the implementation doesn't. It usually takes a lot of careful digging through the logged REST calls, and a little digging through the API's documentation.

So first of all go into Service Center and set your call's logging level to Full, so you can read the requests going out.


Many times the culprit was the Default values not being sent, where the API was expecting them, for example, let's say you have a field called NumberOfRepeats which if set to 0 it means Infinite, and the API is expecting this field as mandatory, but if you send this by default on Outsystems it will see the 0, assume it's a NULL value, and remove it from the JSON altogether. On this particular example you can go to the Request's Structure and click the field and set Send Default Value to Yes: 


But that's just one example of many things that can go wrong. 

Hi Nordin and Madriano,


I have check your advice, apparently the same error occur. it said that he "connection :close" . all my data are in text data type.

Below the portion of the said error, i don't know if this error must be fixed by the team that exposed the said API.

appreciate your input.


It's a good start and a clue. Is there any chance you can get into a conversation with that team and show them your findings? 

Ja wrote:

Hi Nordin and Madriano,


I have check your advice, apparently the same error occur. it said that he "connection :close" . all my data are in text data type.

Below the portion of the said error, i don't know if this error must be fixed by the team that exposed the said API.

appreciate your input.


 Hi Ja,

 500 Internal Server Error is due to something is failing in the API may be you are not passing right input to it. You can check the rest API via Post Man and if it work than it should work from your outsystems app

 Connection: Close  has no relationship with the error . The Connection general header controls whether or not the network connection stays open after the current transaction finishes.  

 Are you saying that Rest API is working from web app and not working from mobile app??


Best Regards

Devendra Baghel



Devendra Baghel wrote:

Ja wrote:

Hi Nordin and Madriano,


I have check your advice, apparently the same error occur. it said that he "connection :close" . all my data are in text data type.

Below the portion of the said error, i don't know if this error must be fixed by the team that exposed the said API.

appreciate your input.


 Hi Ja,

 500 Internal Server Error is due to something is failing in the API may be you are not passing right input to it.

 Connection: Close  has no relationship with the error . The Connection general header controls whether or not the network connection stays open after the current transaction finishes.  

 Are you saying that Rest API is working from web app and not working from mobile app??


Best Regards

Devendra Baghel



 Hi,

Thanks for the input.

It was only being used on the Web App.


Best regards,

JA

 

HI JA,

You can check the rest API via Post Man and if it work then it should work from your outsystems web app.

Best Regards

Devendra

 


Mariano Picco wrote:

It's a good start and a clue. Is there any chance you can get into a conversation with that team and show them your findings? 

 Hi,


That was other last option to check with them.


Best Regards,

JA

 

Devendra Baghel wrote:

HI JA,

You can check the rest API via Post Man and if it work then it should work from your outsystems web app.

Best Regards

Devendra

 


 Hi,

Yes it was working correctly on the Postman and on the outsystems, as i mentioned when i used/embed it on the app it will throw an error code of 500.

 

Hi Ja,

Can you please let me know more details. As you are saying its working through postman and outysystems then what does this means "used/embed it on the app "

Best Regards

Devendra



Devendra Baghel wrote:

Hi Ja,

Can you please let me know more details. As you are saying its working through postman and outysystems then what does this means "used/embed it on the app "

Best Regards

Devendra



 Hi,

It means that when i tested the said URL in postman it was working as expected and also when i test it using the outsystems."used/embed: means when i used the actual API in my application.

sample using outsystems as postman.

 

You need to look at the full log of the request, compare it to Postman, see what's missing. Sometimes it's something silly like a missing header like "content-type:application/json;charset=UTF-8". 

Yeah I agree with Mariano, you need to check full log in service center Monitoring >> Integration.  First check the inputs of the API and then you need to match the HTTP request with the Post Man success request. 

And its for sure if you are getting success response from postman then issue is not in API.

Best Regards

Devendra

Solution

Hi Mariano and Devendra,


Will do as you suggest and will a feedback as soon i have an solution.


Thanks for your input.

Solution