Send json via WebAPI PUT


#1

Dear Thunkables,

I’m pretty new to this forum and tried to find an answer to the following problem, but did not find any. So if this was discussed in another post, please let me know.

I successfully managed to build a WebAPI connection to the Online Database QuintaDB.com. In fact I can access a table via GET, a record within this table and read the single fields of the record to display them in my Thunkable app.

My problem is to write back (=update) data in this record. The QuintaDB doc tells me to send a json like this:

{“rest_api_key”:“API_KEY”, “values” => {“aNW4nkW5bdUjldO8oKuSku” : 3, “aMW4HKWR9bnOoGWQbpWQS4” : “b”, “cMW6pcTSjbWOFdTCkBtmkN” : “c”}}

As I cannot send a body using PUT, the only way is to transport the values via the URL. So I build a block as seen here:

(I have to adress the field not via its name but via ‘bCBSov…’)
This does not work right. The ‘?values=’ seems ok because the record is updated. But in the field ‘bCBSov…’ is not ‘Erwin’ as I would like to have but ‘bCBSov…’ as well?! So the name of the field is also written in(!) the field value. I have also tried:

?“values”=>{“bCBSovW6LdNOkaW7iTiCof” : “Erwin”}
?values=>{“bCBSovW6LdNOkaW7iTiCof” : “Erwin”}
?values={“bCBSovW6LdNOkaW7iTiCof” : “Erwin”}
?values=>{“bCBSovW6LdNOkaW7iTiCof”=“Erwin”}

The result is always the same.
I guess I have to find the correct syntax to transmit this json structure. Or is there another way to deal with the ‘generate json from object’? Each suggestion is welcome …


Thunkable and QuintaDB - Howto connect an online database via Web API
#2

Hi @RobertKubin, thanks for your question! :+1:

I’m not familiar with the QuintaDB platform, but what you have there looks pretty interesting.

Oner thing that caught my eye was the empty socket at the end of your join block, I’m not sure if that’s the cause but it’s probably worth taking it out, just in case.

The other thing I’d ask is that you post a link to the QuintaDB docs where the specify how to upload data via JSON like this so that other members of the community will be able to help you out.

Thanks.


#3

Hi Domhall,

Thank you very much for your immediate Reply.

I took the empty socket out with no different effect.

And here is the link to the QuintaDB doc, jumping right to the Update Record section …

Thanx for you help …

Robert


#4

Dear all,

PROBLEM SOLVED! I contacted QuintaDB as well and they found a bug in the API json call.
So if you’re interested, I can provide my successfull connection to QuintaDB so far, that could be of interest for anybody who tries to connect to a Online Database with Web API. Let me know …

Robert


#5

Be great if you could share! :smiley: