Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get all topics list of Firebase through API?

I want to retrieve all the topics created so far via API request, similar to the list that firebase console display. See the image attached.

enter image description here

like image 338
Hisham Muneer Avatar asked Jun 17 '16 06:06

Hisham Muneer


People also ask

How do I get data from Firebase REST API?

Streaming from the REST API To get started with streaming, we will need to do the following: Set the client's Accept header to text/event-stream. Respect HTTP Redirects, in particular HTTP status code 307. Include the auth query parameter if the Firebase database location requires permission to read.

How do I access Firebase API?

From your client side using email and password creds to login to firebase. Note if you are using REST for login then your login url is of the form (googleapis.com/identitytoolkit/v3/relyingparty/…). May be its better to create a separate question so that others can leverage as well!

How many topics can be created in Firebase?

One app instance can be subscribed to no more than 2000 topics. If you are using batch import to subscribe app instances, each request is limited to 1000 app instances. The frequency of new subscriptions is rate-limited per project.


3 Answers

I just copy Answer from same question here becuase this page is first result in google: Get all subscribed topics from firebase cloud messaging

you can do it through a GET request

HTTP GET Request

https://iid.googleapis.com/iid/info/<TOKEN>?details=true
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA

TOKEN in url : FirebaseInstanceId.getInstance().getToken();

key : can be found in [firebase console][1]: Your project -> settings -> Project settings -> Cloud messaging -> Server Key

like image 82
Ali Avatar answered Oct 17 '22 12:10

Ali


There is no public API to get the list of topics for Firebase Cloud Messaging

like image 33
Frank van Puffelen Avatar answered Oct 17 '22 12:10

Frank van Puffelen


The way I got around this was using the firebase database, first create a topics folder inside the database, then add entries into this folder when a user creates a new topic.

You then create a function within the app to retrieve all entries in this folder within the database.

Now you can allow the user to select a pre existing topic from the results of the database and then use that to call your subscribe function.

Not a solid solution for all but worked for me.

like image 2
C.K Munn Avatar answered Oct 17 '22 12:10

C.K Munn