I have stored a json in Myjson.com and I am using it in my android app. now I want to upgrade stored data but I am unable to do that. I've read the example given in http://myjson.com/api to update Json example is this :
$.ajax({
url:"https://api.myjson.com/bins/:id",
type:"PUT",
data:'{"key_updated":"value_updated"}',
contentType:"application/json; charset=utf-8",
dataType:"json",
success: function(data, textStatus, jqXHR){
}
}); `
but cant figure it out. my json data is as below:
[{"id":"priceup","value":"0"},{"id":"appup","value":"0"},{"id":"nezam","value":"16000"},... ]
anybody knows how can I update above data any help will be appreciated.
When you create a new JSON the PUT method returns in the data the url of the newly created resource. Hence, you need to use this url and not the generic https://api.myjson.com/bins/:id.
An example (jsfiddle here):