Backendless Support
 
Answered

How to change a property of a particular object using codeless

I am making a api using codeless to change property of a particular object. For that i am using set property in from codeless blocks in object. I am passing emailid and value of the parameter i want to change. But nothing is happening in database. I am trying to achieve this from many days. Please help me out to do put operations using codeless.

Leave a Comment

Comments (12)

photo
1

You have a problem in your codeless logic. You use a block which returns a list. Then you try to get an item from that list for which you want to modify the property, but you do not specify which item you want to get:

fc2b70cd6812e41d4c2d22c5f6e03274

photo
1

and how i can get that. I mean they are showing first last random

photo
photo
1

If your query is supposed to return only one object, then get the first one. It is equivalent to #0

photo
1

still not working no change in database

photo
1

Does the logic you have now make a call to save the object back in the database?

photo
1

no i was trying to do so but unable to get it

photo
1

The logic should be like this:

  1. Get the object you need from the database
  2. Update object property
  3. Save the object back in the database.

Give it your best shot and share the logic here if it doesn't work.

photo
1

what will be the logic in codeless to save the object. Which blocks should i use.

photo
1

Use search to find a block:

4adc238384175ed360e3b2fb59e9b20c

Or look for one in a section which corresponds to each Backendless API:

4a43915c168e36605448cb122580d398

photo
1

Thankyou. Now i can see results in backend. I have one more query. How i can check it in postman or from my app as a rest api.

My test drive data is -

curl -X "PUT" "https://api.backendless.com/6FD3F8B1-09D2-B306-FF5A-B648998E3600/50B9B2D8-1A5A-74E9-FF66-E1F9217F7800/services/reduceImageCredits/imageCreditDeduction"; \

-H 'Content-Type: application/json' \

-H 'Accept: application/json' \

-d $'"preet.singh@zedinteractive.in"'

Here preet.singh@zedinteractive.in is parameter as email id. What is -d here for

photo
1

The "-d" parameter in the curl command is for the body of the request.

photo
1

Ok It worked. thankyou very much for your help.

photo