Problem with DATA from JSON database using the API REST tool

Good afternoon!
Tell me if I pulled up the JSON database using the API REST tool.

Here’s the link:

https://380919.selcdn.ru/ARTS/data.json

On command GET (ALL), I get normal processing of the entire database and the database schema.

On command GET (ONE) geting an error:

Error: The server responded with an array for a single data record. The response must be an object.status: -1
Resource settings for Get record (GET)-------------------
Resource URL: https://380919.selcdn.ru/ARTS/data.json
Relative path:

At the same time, when using base variables in the application, I can pull up the desired variable from DATA VARIABLES, but when view from APPGYVER APPS on my iPhone reflected in it is not shown.

What is the reason? what am I doing wrong?

Nowhere can I find a coherent explanation or instructions for this seemingly simple task to get the value of a variable from the JSON database

Hi there!

The methods in the data panel refer to possible REST API methods.
The url you have (https://380919.selcdn.ru/ARTS/data.json) is not a REST API but a JSON file.
The file contains a list of objects: [] with objects {} contained with it. The GET RECORD method would expect to get just an object {}.

In the case of a JSON file like this, it makes best sense to use the GET COLLECTION method and the collection type data variable.

For why the variable is not showing up in your app there could be many reasons, could you provide screenshots of the component bindings in the editor?

Sent all screenshots of components in the editor

Akseli! Can you help me with my problems?

Dear Akseli!
I really hope for your help in this matter. If it is unprofitable to provide more information, please specify.
thanks

Akseli, hello!
My question is so hard for you? Why you ignoramus’s of my question?

Hi again

I could not understand from your screenshots what is not working exactly?

Hi, Akseli!
I glad to get your comment.

If I try to watch of my program code on my iPhone from AppGyver App, I can’t view text from my Data Base, as like as Title 1 - Author and name of picture on Button

Hello, Akseli!
When you can help me with my problem?
Can you understand what work is not correctly?

Hi!

I recommend you put a paragraph on the page with a formula:
ENCODE_JSON(dataVars.ARTS1)
to see what data is actually there.

The preview you see in editor is cached from the schema received during testing the data resource, and thus can be out of sync with the real data.

Hello! Thanks a lot, but it’s not work.

  1. If i put on the page formula: ENCODE_JSON(dataVars.ARTS1)
    I have a next error:

Снимок экрана 2020-11-27 в 18.33.35

On my iPhone I can’t view nothing

  1. If I add on the page is next formula:
    I have next info:

And next view on editor:

But on my iPhone I have only " "

Perhaps you can access my computer remotely through the program TeamViewer?

How I can to communicate with you directly? maybe Viber or WhatsApp or etc.

Thanks a lot!

I see from your screenshots that you’ve configured the GET COLLECTION -method, but your data variable is using “single”.
Have you configured the GET RECORD method? If you have not, then using “single” with the data variable won’t work.

Good afternoon!
I tried to configure GET RECORD, but as I wrote in the beginning, it gives an error. How can I set it up correctly in my case when using the JSON file https://380919.selcdn.ru/ARTS/data.json

As I mentioned earlier you won’t be able to use GET RECORD with a plain JSON file. You should make a “collection” type variable and then access the individual objects with formulas using for example the PICK_ITEM flow function.

For example:

PICK_ITEM(data.ARTS1,0) will get you the first item from the list, provided the data variable is of the collection type.

Hello, Akseli!
Thanks a lot for your help for me. I very appreciate it.

I create all as you write, but it’s not work.

Send all screens copy again.

Where and how I must create “collection” type variable?!?

Where is my mistake?



YL6uEDFSa8xsxpvEqGCLcQgdo.png)

Hi, Akseli!
We can help me?

Hi

So the previous formula accesses the first object from:

[
        {
            "name": "«Натюрморт»",
            "author": "Bohm Pal",
            "size": "34х53 см.",
            "price": "15000",
            "materials": "масло и холст",
            "style": "академизм, натюрморт",
            "time": "II половина XIX века",
            "place": "Венгрия",
            "pic1": "https://static.tildacdn.com/tild6139-6266-4738-a637-303437323961/__2020-04-25__212820.png",
            "pic2": "https://static.tildacdn.com/tild6430-6535-4862-b261-343331306233/DSC00082web.jpg",
            "pic3": "https://static.tildacdn.com/tild6535-3331-4633-b865-323734616336/DSC00083web.jpg",
            "id": "id0001"
        },
        {
            "name": "«Тихая мелодия»",
            "author": "William Stephen Coleman ",
            "size": "64,5х42 см.",
            "price": "10000",
            "materials": "масло и холст",
            "style": "академизм, пейзаж",
            "time": "вторая половина XIX века",
            "place": "Англия",
            "pic1": "https://static.tildacdn.com/tild6163-3233-4633-b333-633763303461/__2020-04-25__221349.png",
            "pic2": "https://static.tildacdn.com/tild6263-3434-4763-b339-616436383336/DSC00079.jpg",
            "pic3": "https://static.tildacdn.com/tild3962-3136-4666-a465-326233643864/DSC00080.jpg",
            "id": "id0002"
        }
    ]

Which means then you have:

{
                "name": "«Натюрморт»",
                "author": "Bohm Pal",
                "size": "34х53 см.",
                "price": "15000",
                "materials": "масло и холст",
                "style": "академизм, натюрморт",
                "time": "II половина XIX века",
                "place": "Венгрия",
                "pic1": "https://static.tildacdn.com/tild6139-6266-4738-a637-303437323961/__2020-04-25__212820.png",
                "pic2": "https://static.tildacdn.com/tild6430-6535-4862-b261-343331306233/DSC00082web.jpg",
                "pic3": "https://static.tildacdn.com/tild6535-3331-4633-b865-323734616336/DSC00083web.jpg",
                "id": "id0001"
            },

To access for example the name you should do:

PICK_ITEM(data.ARTS1,0).name

and so on!

Akseli! It’s GREAT!!! All work!

Well done!

Thank you VERY MUCH

1 Like