How do you process the data received from API in ND-JSON format?

My blocks:

Here is the response I get in the app:

Here is the response I receive in the terminal:

Just set the responseContent to your label, no processing

Is your token correct? Or you use xxxxxx as token in your blocks just for security?

You most probably got an eror message in html format... therefore

Also do not initialize a global variable with some text from a textbox

Use Textbox1.Text directly in the url instead of that global variable

Taifun

Your terminal response is just JSON.
No \n

1 Like

If you want a chess board from buttons.

It is just for security

Are you going to show your raw responseContent, which will contain the error message ?

Now there is not response at all:

is there a space after Bearer?
in case both the token and game id are correct, these blocks should work...
Taifun

There is a space between Bearer and the token. The token is correct.
I must to remark that I can receive correct response (JSON response) for another requests from the API. The problem is with ND-JSON response (streaming data)

The response is definitely ND-JSON format. In the uploaded picture of the terminal I show only begining of the streaming response.

try logcat to find out what is going on

Taifun


ndjson test

I received a list of JSON objects, joined by \n separators.

Splitting at \n gave me a list of JSON objects that look ready for the web block that decodes JSON as dictionaries.

2 Likes

I received a list of JSON objects, joined by \n separators.

Splitting at \n gave me a list of JSON objects that look ready for the web block that decodes JSON as dictionaries.
[/quote]

I replicated it but no response at all

And if you specify user neio?

I logged on to lichess.org and set up an account for myself, then did two puzzles.

I generated a personal token that only has permission to see the puzzles that I did, and
pasted the token into a block.

It worked the first time:

So I am guessing you need to add a token or have overstayed your welcome at lichess.org

Thank you very much for the effort ABG. I already have a Token and user name but I think that the problem is with the smartphone. I tested the app in an emulator and it works. What could be the problem with my device? I tested in another device without success.

For me it works with companion. Check documentation for response type, for example users public data is in json format

I found the solution in order to make it work in my smartphone after app installation.
I added the following block:

Now it works.