question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

rename the unique name at post request on firebase

See original GitHub issue

support I am doing a post request on the firebase.

result = fb.post('/orders/', {'id': 2})

in result I always get the unique name generated at the time of post request. Like {u'name': u'-KAdbw7DfCuuRhFWZH7j'}

But I need to give it name of my choice. {u'name': 'aaa'}

Is there any means to do that.

Cause the item created needs to be access and updated using the put request so I need to pass this unique id to make a put request. If I would give the name of my choice I can use that name without passing an extra argument in my request json.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

16reactions
nhatbuicommented, Apr 8, 2016

@sanke93 @NYamaguchi415

I’m still able to do it:

import firebase

url = 'https://myapp.firebaseio.com'
fb = firebase.FirebaseApplication(url, None)
result = fb.patch('/users/alanisawesome/', {'date_of_birth': 'someday', 'full_name': 'Alan Turing'})
screenshot 2016-04-07 20 29 00 What were your exact commands?
10reactions
nhatbuicommented, Feb 20, 2016

What you should do is specify the name when you create the Firebase reference. And thereafter, you should post to that url.

For example, suppose fb is your firebase reference. You should create it as such: my_url = 'my_app.firebase.io/aaa' fb = firebase.FirebaseApplication(my_url, None)

Now instead of posting, patch itresult = fb.patch(my_url + '/orders', {'id': 2})

Your data should be in 'aaa' as in… result = firebase.get(my_url + '/orders', 'id') print result['id'] == 2

Let me know if that doesn’t work for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Name generated when adding data in Firebase - Stack Overflow
Let's start by saving some user data to our Firebase database. We'll store each user by a unique username, and we'll also store...
Read more >
Saving Data | Firebase Realtime Database - Google
Let's start by saving some user data to our Firebase database. We'll store each user by a unique username, and we'll also store...
Read more >
Feat Request: Unique Value in Real Time Database
You can add a !data.exists() into the username index to prevent it from being overwritten by other users who might try to write...
Read more >
CRUD in Firebase RealtimeDB with REST API - Retool
Try not to nest data. When you fetch data, all child nodes are returned with the one you fetched. · Flatten your data...
Read more >
Rename your project - Firebase Help
Click next to the name for either Project name or Public-facing name. Enter a new name. Click Save.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found