Skip to Content
Jun 18, 2019 at 01:50 AM

Error calling Blockchain Proof of State service from a web app


Hi guys,

Can you please help me to call an instance of the Proof of State service from my application?

I've been following this guide to build the service. It's up and running and I don't have any problems calling it from the SAP API Hub. Here is the 201 response after I saved a primitive example payload with id "3" below:

{"test": "value"}

Now if I try to generate a JavaScript code snippet and use it in my own application to call the service directly, I receive a 500 error. Here is the code I use:

writeData: function () {
			var data = JSON.stringify({
				"test": "value"
			var xhr = new XMLHttpRequest();
			xhr.withCredentials = false;"POST", "");
			xhr.setRequestHeader("Content-Type", "application/json");
			xhr.setRequestHeader("Accept", "application/json");
			xhr.setRequestHeader("Access-Control-Allow-Credentials", "true");
			xhr.setRequestHeader("Access-Control-Allow-Origin", "https://<myRouter>");
			xhr.setRequestHeader("Access-Control-Allow-Headers", "access-control-allow-origin,authorization,content-type");
            xhr.setRequestHeader("Access-Control-Allow-Methods", "GET,HEAD,PUT,PATCH,POST,DELETE");
			xhr.setRequestHeader("Authorization", "Bearer <myToken>");
			xhr.onload = function () {
				if (xhr.status === 200) {
					alert("Sucessfully called the API!");
				} else {
					alert("Calling the API failed");
Here is the 500 response from the service:

{"error":{"code":500,"message":"{\"statusCode\":500} - Please see our documentation at"}}

Mind you, it's not a 403 or a CORS error. I already resolved those. The call does reach the service and I can see it in the dashboard as below:

I don't understand why is it 500? The worst thing that the service doesn't provide explanation and the error is not traceable anywhere. I suspect my payload is not correct, but the documentation doesn't give any examples of a proper payload for a post operation.

So I'd be really grateful if you could suggest anything or give an example of how the service should be called.

Thank you!


I already looked at the following examples, but couldn't find an answer: