1
$\begingroup$

This question already has an answer here:

I am researching on building a backend for website using Wolfram. APIFunction is great to use, but I can't figure out how should I store data like using dataset in a local notebook when using APIFunction. There are 3 of that, databin, clouddeploy[dataset], dataexpression, didn't figure out which way should be THE way to go? And can support multithread at the minimum and some volume when multiple users are calling the API the same time.

Here is simple code showing what I am trying to do.

data1 = Dataset[<|"a"->"testa","b"->"testb"|>];

CloudDeploy[APIFunction[{"c"->String}, Block[{dataA,datab},
                    dataA,datab = somehowGotFrom[c];
                    AppendTo[data1,<|"a"->dataA,"b"->dataB|>];]

I got the APIFunction working all well, the data reached the cloud deployed API, but the data1 is not in the cloud and didn't collect the data through API.

My question is how should I store data collected through APIFunction. Confused from the docs.

$\endgroup$

marked as duplicate by Kuba Jan 18 at 23:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Can you show what have you tried and where are you stuck? Try to keep examples minimal. API can be called by multiple users at the same time but you need to make it public and keep track of your cloud credits. $\endgroup$ – Kuba Jan 14 at 21:18
  • $\begingroup$ @Kuba, added some simplified code in trying to illustrate. $\endgroup$ – user1470393 Jan 14 at 21:29
  • $\begingroup$ I am kinda confused by your question, but we should start by keeping things simple. Use a simple List instead instead of a Dataset and use a CloudExpression. The code you're looking for is CloudExpression["myList"] = {}; and AppendTo[CloudExpression["myList"], something] $\endgroup$ – Searke Jan 14 at 23:24
  • $\begingroup$ Alternatively you could use a Databin. See the Databin documentation for examples of how to use them. $\endgroup$ – Searke Jan 14 at 23:25
  • 1
    $\begingroup$ Does CloudExpression fit your needs? Is this essentially the same question: mathematica.stackexchange.com/q/153114/5478? $\endgroup$ – Kuba Jan 15 at 23:01