REST API: Server Error 500

I’m trying to access the API of edudip using RESTy from the communication-examples.

As in the documentation of the API described, I set the headers before fetching:

RSocket.RequestHeader("Accept") = "application/json" RSocket.RequestHeader("Authorization") = "Bearer myverysecretapikey"

To test I use the given URL with GET (POST doesn’t work as well) to fetch all webinars (as described in the documentation).

As result I get

{ "message": "Server Error" }

with the status 500.

Obviously a communication is started, the credentials seem to be ok, because if I change the API-key, I get the message {“message”:“Unauthenticated.”}

I read that https should not be the cause of the problem, because Xojo.Net.HTTPSocket would handle that accordingly.

In debug mode the Xojo.Net.HTTPSocket shows the property “ValidateCertificates” as false. If I set it to true before starting the fetch, the same message “Server Error” appears.

As the error 500 comes from the called webserver I think this is a server configuration issue.

Or am I doing something wrong?

A 500 response code is typically only issued by the called server. Meaning the server is having a problem “usually” not related to the client or the call itself.

The above assumes of course that your call passed all prerequisites that did not trigger a 400-series error code.

But, with that said, whom ever developed the server could very well have a bug where one or more required input/argument(s) where not properly validated and flagged - causing the server-side error. In other words, there could be an input you’re supposed to pass, but the documented API says it’s optional (but it’s not).

In other words, not likely.

I hope that helps.

The 500 error could also be a generic response to a malformed REST call, where the server side does not give you back a helpful response with why it did not like it.

What I would suggest is temporarily removing Xojo from the equation an get the REST call to work via something like Paw (if macOS) or Postman first. See if that also gives you a 500 error, or more hints on what it does not like.

Once it works in an API testing tool like above, go back to your Xojo code and make sure you send the same headers and payload.

This was good advice. With the documented PHP-Skript I get the same error. So it is definitively a webserver issue and a job for the support of the host.

It was definitly an error of the hosted service. All is running smooth now.