API CALL : 500 Internal Server Error

API CALL : 500 Internal Server Error

  

Hi there,

I'm consuming an API through "Consume REST API" and I'm able to successfuly test it in Service Studio.

It has one parameter, I fill values in the Test screen and get the resulting xml or json with the results.

But after publishing it , I get a "500 Internal Server Error" in runtime.



Hi Nelson,


Can you give us more information on the error?
How? In Service Center Monitoring > Errors

If you have the complete error just post it here (removing any personal data).

If not, activate the logs for that REST API and perform the request again.
Then in Monitoring > Integrations you will have the complete request in order to try to understand what's wrong.


I'll wait for your feedback in order to help you.

Best regards

I have same error, and was hoping this was answered :(

Anyway, I am new to Outsystems. I am using location plugin in my app to get the geolocation. This works fine. However, when I use the latitude and longitude as parameters in the URL for the API call, it gives me an error on publishing.

I have tested the API and it works fine with the location parameters in the test that is done when defining the REST method. 

I checked the log, and got this as error:

500 Internal Server Error
   at ssWeatherMate.CcDataserviceAccuweather.ActionGetSearchByGeoposition(HeContext heContext, ICcDataserviceAccuweatherCallbacks _callbacks, String inParamapikey, String inParamlatitude, String inParamlongitude, STCityStructure& outParamResponse)

Any help is appreciated.

@Nelson,

Can you please try a test oml with same parameters ..what exactly you are doing there. I will try that at my end and will try to solve your issue.



Regards

-PJ-

Hi Shamli,

Note that any exception triggered inside a REST service will be reported back as a 500 Internal Server Error. If the REST service is an OutSystem exposed REST service, you can simply debug it to see what's going on. If it's not, set the REST consume's debugging level to Full (in Service Center) and look at the exact output etc.

Kilian Hekhuis wrote:

Hi Shamli,

Note that any exception triggered inside a REST service will be reported back as a 500 Internal Server Error. If the REST service is an OutSystem exposed REST service, you can simply debug it to see what's going on. If it's not, set the REST consume's debugging level to Full (in Service Center) and look at the exact output etc.

Thanks, but like I said I'm new to this platform so couldn't find how to do that. Meanwhile, I removed the logic which uses geelocation for searching information. Instead I am now using city name. It worked fine for getting city key, state and country name. Then I added a new server action to fetch current weather parameters. Addition of this logic is now giving me 401: Unauthorized error, whereas API call only needs the API key and URL parameters.

Here's the error:

401 Unauthorized
   at ssWeatherDemo.CcDataserviceAccuweather.ActionGetSearchByName(HeContext heContext, ICcDataserviceAccuweatherCallbacks _callbacks, String inParamcityname, String inParamapikey, RLCityList& outParamResponse)

Any help is appreciated!


EDIT: I checked again and there was a missing API key at one place, which was silly on my part!

Now after publishing when I run my app though, no response occurs. It just stays there blank!

Hi Shamli,

I just wrote a short guide on how to increase the Logging Level of a REST API and checking the result. You can find it here. I'd advise you to try to see from the output what you're missing or otherwise is wrong.

(I unfortunately can't help you more, as a 401 just means you did not specify the right credentials or otherwise don't have access, and it depends very much on the specific REST service you're trying to consume what triggered it.)

Kilian Hekhuis wrote:

Hi Shamli,

I just wrote a short guide on how to increase the Logging Level of a REST API and checking the result. You can find it here. I'd advise you to try to see from the output what you're missing or otherwise is wrong.

(I unfortunately can't help you more, as a 401 just means you did not specify the right credentials or otherwise don't have access, and it depends very much on the specific REST service you're trying to consume what triggered it.)

Thanks, the guide was very helpful! Apparently there seems to be some problem on the API server's end as even my colleagues faced the same problem. One colleague tried using another API service, and it works fine for him. Agreed that it is a very naive move, but seems to work.

Thanks for all the prompt help and support!

Hi Shamli,

You're most welcome! Personally, when I try to set up a REST API consume, I always first use a tool like Postmaster, before I try to implement it with OutSystems, as it's much faster in changing headers, parameters etc.