Push to Firebase via REST API with priority

Is it possible to use the REST API to move an event to a list (via HTTP POST) and also indicate the priority of the object that is clicked? Perhaps how do I post a field in JSON somehow?

Something like this (semi-pseudo-code):

var myObj = {name: 'My Name', address: 'My Address'}; myObj['priority'] = 123; $.post('http://demo.firebase.com/demo/testing.json', myObj); 

I can do this as follows with my own Javascript library, but this does not use the REST API:

 var fb = new Firebase('http://demo.firebase.com/demo/testing'); var foo = fb.push({name: 'My Name', address: 'My Address'}); foo.setPriority(1); 
+6
source share
1 answer

Yes! To send data with priority, you can use:

 var myObj = JSON.stringify({name: 'My Name', address: 'My Address', '.priority': 123}); $.post('http://demo.firebase.com/demo/testing.json', myObj); 

If you want to post a raw value (for example, "hello") with priority, use:

 var myObj = JSON.stringify({'.value': 'hello', '.priority': 123}); $.post('http://demo.firebase.com/demo/testing.json', myObj); 
+13
source

Source: https://habr.com/ru/post/917496/


All Articles