Remove an object from the list via firebase rest api

Currently, I cannot find a way to remove an object from the firebase list via the REST api. For example, I'm trying to remove this from the list: https://mrdapper.firebaseio.com/v0/users/41/favs.json?orderBy=%22id%22&equalTo=107657061

Posting a DELETE request does not work with the request parameter.

+4
source share
1 answer

You cannot delete the request (although that would be great). But you can use the results to send a DELETE request.

Make a GET:

GET https://mrdapper.firebaseio.com/v0/users/41/favs.json?orderBy=%22id%22&equalTo=107657061

This will return an object, and you can send a DELETE request for each returned item.

DELETE https://mrdapper.firebaseio.com/v0/users/41/favs/<returned-id>.json

. .

, :

/users/$user_id
/userFavs/$user_id/$fav_id

favs . user, favs.

userFavs, userid favid, .

{
  "userFavs": {
    "41": {
      "107657061": {
        "note_count": 43633
      }
    }
  }
}

, . id, . .

DELETE https://mrdapper.firebaseio.com/v0/userFavs/41/107657061.json
+5

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


All Articles