API Docs: How to use UpdateRecord()


#1

This is the most basic of basic questions i believe. I have a service that connects to an Azure Table. I can retrieve records and things just fine. I am struggling with how to update a record that exists in the table. I’m using the API Docs in Dreamfactory to test everything. I get what should go in the table_name, and i think i have the ID field set correctly since i was able to get records using it. I just don’t uderstand what i need to put in the body section to be able to update a record. It states that i need to put in Data containing name-value pairs of the fields to update but i’m afraid its just not enough information for me to figure out what the exact syntax would be. My test table in Azure is very simple. I have the PartitionKey, Rowkey and 3 other fields. I’m trying to change the value in the field named “RecValue”. I sure could use a sample or two on how to update the record. I think its just a JSON syntax i don’t understand. Can someone pass on a few tips? Once i have it working in API Docs i can take it from there.


#2

Ok i worked this initial problem out by using this syntax {“RecValue”:“111”} .

What i planned to do from there was to copy the URL that was generated in API Docs, add ?app_name to the end of it and see if it would update the record that way. However this doesn’t seem to be possible since the values or data to be sent isn’t in the generated URL. So now what? Anyone have any tips on passing new values via the URL?

Thanks.


#3

Hi Gary, I just noticed that this post went unanswered.

Generally, passing data in the URL is not supported.

Your change data should go in a data payload (post data), passed by your application or REST client.

For example I have a mysql table that I want to update a record on. I can do this via CURL (as one example.)

curl -i -k -3 -X PATCH http://mydreamfactoryhostname/rest/mysql/mytable?app_name=myapp -d ‘{“record”: {“id”: 1, “mytext”: “update text”}}’

in curl the -d switch allows you to add your payload data in json form to the call.