Backendless Transactions

Hi,

Has anyone had any success at using the Backendless Transaction API? I’m really struggling to work out how to build the body data which (for my transaction) needs to contain 3 page variables.

Any help greatly appreciated.

Can you give more details?

Hi Oli – I’m not familiar with the Transaction API in particular, but you can use a formula to construct the object that you’re sending to Backendless. You can use the page variables in the formula, example: {field1: pageVars.var1, field2: pageVars.var1, field3: ["one", "two", pageVars.var3]}

Hi Mari, thanks for that. The issue is that the transaction api relies on body data. With the Appgyver data variable rest query builder I don’t see how to send body data, and secondly I don’t know how to assemble the complex body data required for a Backendless transaction.

What more details do you need? I’m trying to create a transaction that creates an object in one table, then creates relations in that object and another object in a different table.

I’ve tested out the body data in Postman and it works, what I don’t know how to do is to use that body data in Appgyver.

Hi Oli, just checking is this what you are trying to do?

Exactly. When I get back from walking the dog I can show you the body I’m trying to use…

Alright. In that case you’ll want to make a POST request within Composer with the Create Record flow function on the Logic canvas. The “Record properties” of the node will be bound to a formula that includes the whole request body. When this node executes, the request will be sent to Backendless.

The response object from Backendless will be available as an output of that node, and you can use it in subsequent nodes to update the values of your variables.

Also make sure that you have the Create Record (POST) functionality enabled and correctly configured for your data resource in the Data Configurator.

Parts 3 and beyond of this video series might be useful. :slight_smile:

Thanks for that - the issue that I have is that this is the data I need to send to Backendless:

{
“operations”: [
{
“operationType”: “CREATE”,
“table”: “EuroCountryThumbs”,
“opResultId”: “score”,
“payload”: {
"thumbUp”: 0
}
},
{
“operationType”: “SET_RELATION”,
“table”: “EuroCountryThumbs”,
“opResultId”: “scoreONE”,
“payload”: {
“parentObject”: {
“___ref”: true,
“opResultId”: “score”,
“propName”: “objectId”
},
“relationColumn”: “songDeets”,
“unconditional”: [“xxxx-xxxx-xxxx-xxxx-xxxx”]
}
},
{
“operationType”: “ADD_RELATION”,
“table”: “EuroSongs”,
“payload”: {
“parentObject”: ““xxxx-xxxx-xxxx-xxxx-xxxx””,
“relationColumn”: “thumbs”,
“unconditional”: [{
“___ref”: true,
“opResultId”: “score”,
“propName”: “objectId”

    }]
  }
}

]
}’

The things in Bold are the variables from my app.

I don’t know how to do this - The only way I can think is to build it as a string using " " and using + to add the variables at the appropriate time, but then what happens to the " that are within the data i want to send, they interact with the “” to make it a string so the whole thing becomes a mess.

Hi, you can build it as an object like in the example I gave in my first response.
{"operations": [{ ..., "payload": { "thumbUp": pageVars.thumbUp }}, ...]} and so on. :slight_smile:

I’m being really stupid - when I try and do that - if I don’t use " at the beginning and end of the fomula then the AppGyver formula builder rejects it because it interprets loads of the things as variables that are undefined, but when I try and build it using " to create strings that are then punctuated with the actual AppGyver variables I want to use, the formula builder cant distinguish between the " I’m using to tell AppGyver it’s a string and the " that Backendless requires to make the transaction work.

Hi, can you post a screenshot of the error(s) that you’re getting? Most likely you’re getting warnings because this is an unorthodox way of handling API requests and Composer cannot identify some of your fields because they don’t exist in the schema in Data Configurator, but it should work nevertheless.

Ok - so I’ve managed it in the Data Configurator - let’s see if I can do it in the app!

Thanks for the help

Hi Oli… Can you explain how you could manage the Backendless Transaction. I have a similar problem. I can’t create a custom scheme because the item’s structure in the array are not equals…

Hi Lenny, I’ve actually moved on from Backendless as I realised how much it was going to cost after the free trial. However I did get it to work.

I just wrote out the JSON that I needed to make the transaction work in the formula editor as a string, adding in the variables I needed in the appropriate places… (using + to append the variable to a string). It was a pita because of the crappy formula editing interface but it did work.

I remember that “Postman” was my friend in constructing the transaction JSON in the first place.

Good luck!

Thanks… Oli.
I will do that. In Postman all work. Thanks.