Http PUT to a JSON store
What is the LiveCode equivalent of the following JavaScript code snippet?
var req = new XMLHttpRequest();
req.open("PUT", theURLoftheNoSQLstore, false);
req.setRequestHeader('Content-Type', mimeType);
req.send(theJSONobjString);
The parameters have been defined as
theJSONobj = {};
theJSONobj["aKey"] = "aValue";
theJSONobj["anotherKey"] = 123;
theJSONobj["note"] = "some note about the issue";
theJSONobjString = JSON.stringify(theJSONobj);
theURLoftheNoSQLstore ="http://localhost:5984/thedb/thekey"
mimeType="application/json";
Note
Setting the mimeType has been added for completeness. However for posting
to the JSON store it is not necessary as that is the default in this case
(couchDB).
No comments:
Post a Comment