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.
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:
http://support.backendless.com/public/attachments/fc2b70cd6812e41d4c2d22c5f6e03274.jpg</img>
and how i can get that. I mean they are showing first last random
If your query is supposed to return only one object, then get the first one. It is equivalent to #0
still not working no change in database
Does the logic you have now make a call to save the object back in the database?
no i was trying to do so but unable to get it
The logic should be like this:
- Get the object you need from the database
Update object property
Save the object back in the database.
what will be the logic in codeless to save the object. Which blocks should i use.
Use search to find a block:
http://support.backendless.com/public/attachments/4adc238384175ed360e3b2fb59e9b20c.jpg</img>
Or look for one in a section which corresponds to each Backendless API:
http://support.backendless.com/public/attachments/4a43915c168e36605448cb122580d398.jpg</img>
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
The “-d” parameter in the curl command is for the body of the request.
Ok It worked. thankyou very much for your help.
Does saving an object replace the object?
Hello @Chad_Wyatt ,
No, saving an object does not overwrite an existing object. A new one will be created.
If you pass “objectId” in the request body, then you must use the path to update the object. In this case, if the object exists, it will be updated
Regards, Nazar