Inserting Child Records For mainting Relations using REST API

34 views
Skip to first unread message

Zaid Mirza

unread,
Apr 28, 2016, 7:51:01 PM4/28/16
to Firebase Google Group
Scenario is,
I want insert record like below sample, I can add users and groups invidually using REST API In C#, but im facing problem to insert key/value pair in users like this "group1":true to make relations, actually i want to make relations using REST API, im new to FireBase
{
  "users":{
    "user1":{
        "username":"john",
        "full_name":"John Vincent",
        "created_at":"9th Feb 2015",
        "groups":{
            "group1":true,
            "group3":true
        }
        "last_logins":...
    },
    "user2": ...,
    "user3": ...
  }
  "groups": {
     "group1"{
        "group_name":"Administrators",
        "group_description":"Users who can do anything!",
        "no_of_users":2,
        "members":{
            "user1":true,
            "user3":true
        }
      },
     "group2"{
        "group_name":"Moderators",
        "group_description":"Users who can only moderate!",
        "no_of_users":1,
        "members":{
            "user2":true
        }
      }
   }
 }

Kato Richardson

unread,
Apr 29, 2016, 2:15:05 PM4/29/16
to Firebase Google Group
Hello Zaid,

You can write to multiple paths using our SDKs, but not via REST. Sorry. You'll need to use a supported API to get this functionality, or write them separately.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/adc02f71-a234-4f89-a3eb-b958a8a70608%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Frank van Puffelen

unread,
Apr 30, 2016, 12:09:52 AM4/30/16
to Firebase Google Group
While we didn't document it in our blog post or documentation, it is actually possible to Firebase multi-location updates via the REST API.


Should mention this works via the REST API's PATCH command too:
PATCH https://yourFirebase.firebasei...
{
"deep/path/update": true,
"yeah/its/awesome": true
}

One of the best things about our community is when they find things that we didn't realize ourselves yet. :-)

Zaid Mirza

unread,
May 1, 2016, 11:17:21 AM5/1/16
to Firebase Google Group
hmm Thanx for the help. I got my goal by using FireSharp SDK for C# :)....
Reply all
Reply to author
Forward
0 new messages