Push to Firebase via REST API with Priority

前端 未结 1 1071
轻奢々
轻奢々 2021-01-05 16:20

Is it possible to use the REST API to push an event to a list (via an HTTP POST) and also specify the priority of the item that is being pushed? Perhaps as a field in the JS

1条回答
  •  爱一瞬间的悲伤
    2021-01-05 17:02

    Yes! To post data with a 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 (e.g. "hello") with a priority, use:

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

    0 讨论(0)
提交回复
热议问题