How to get a list of all documents in a Firebase Cloud Firestore database using the API? - rest

I need to query my Cloud Firestore database periodically for maintenance. I'm new to REST and I've spent way too long trying to solve this myself, so I figured I could use some advice.
My Firestore is set up like so:
users > {uid} > uploaded-files > {file-hash}
{file-hash} is a document that contains several fields such as filename, source, and size
All I'm trying to do is get a list of every single filename from every single uploaded-file, including from multiple {uid}'s.
I've managed to send a successful request and get a single filename using the firestore.projects.databases.documents.get method using the API explorer, but I can't seem to get any other methods to work, namely firestore.projects.databases.documents.list
This is the successful request using firestore.projects.databases.documents.get:
GET https://firestore.googleapis.com/v1beta1/projects/{project-id}/databases/(default)/documents/users/7eGfdgGfaG0HSXdfmxMN2/uploaded-files/WGtcJBX9fdGdhdtjB?mask.fieldPaths=filename&key={YOUR_API_KEY}
Part of my issue is that I can't figure out how to get requests to work without hard-linking document names - in other words, I don't know how to to replace {uid}, or any other collection, with a wild-card so that the request returns documents from all uid's.
Really any help is greatly appreciated.

The Use the Cloud Firestore REST API documentation has instructions on getting started. The Firestore REST API documentation shows how to fetch documents.
In your case you would need to list the user-uid documents then go after the uploaded-files for each one, or iterate over the results of the list.

Related

Issue in MongoDB document search

I am new to MongoDB. And I have the following issue on currently developing web application.
We have an application where we use mongoDB to store data.
And we have an API where we search for the document via text search.
As an example: if the user type “New York” then the request should send the all the available data in the collection to the keyword “New York". (Here we call the API for each letter typed.) We have nearly 200000 data in the DB. Once the user searches for a document then it returns nearly 4000 data for some keywords. We tried with limiting the data to 5 – so it returns the top 5 data, and not the other available data. And we tried without limiting data now it returns hundreds and thousands of data as I mentioned. And it causes the request to slow down.
At Frontend we Bind search results to a dropdown. (NextJs)
My question:
Is there an optimizing way to search a document?
Are there any suggestions of a suitable way that I can implement this requirement using mongoDB and net5.0?
Or any other Implementation methods regarding this requirement?
Following code segment shows the query to retrieve the data to the incomming keyword.
var hotels = await _hotelsCollection
.Find(Builders<HotelDocument>.Filter.Text(keyword))
.Project<HotelDocument>(hotelFields)
.ToListAsync();
var terminals = await _terminalsCollection
.Find(Builders<TerminalDocument>.Filter.Text(keyword))
.Project<TerminalDocument>(terminalFeilds)
.ToListAsync();
var destinations = await _destinationsCollection
.Find(Builders<DestinationDocument>.Filter.Text(keyword))
.Project<DestinationDocument>(destinationFields)
.ToListAsync();
So this is a classic "autocomplete" feature, there are some known best practices you should follow:
On the client side you should use a debounce feature, this is a most. there is no reason to execute a request for each letter. This is most critical for an autocomplete feature.
On the backend things can get a bit more complicated, naturally you want to be using a db that is suited for this task, specifically MongoDB have a service called Atlas search that is a lucene based text search engine.
This will get you autocomplete support out of the box, however if you don't want to make big changes to your infra here are some suggestions:
Make sure the field your searching on is indexed.
I see your executing 3 separate requests, consider using something like Task.WhenAll to execute all of them at once instead of 1 by 1, I am not sure how the client side is built but if all 3 entities are shown in the same list then ideally you merge the labels into 1 collection so you could paginate the search properly.
As mentioned in #2 you must add server side pagination, no search engine can exist without one. I can't give specifics on how you should implement it as you have 3 separate entities and this could potentially make pagination implementation harder, i'd consider wether or not you need all 3 of these in the same API route.

Jama API - GET item with tag at the same time

I need to fetch items from JAMA API, and I do not get the Tag value with the data.
I tried to call GET/{item}/{id} API and then I also need to execute GET/{tags}/{id}/{item} to discover item tag, which takes too much time for multiple items.
Is there any more efficient way to get all data in one API call?
There is the /items/{id}/tags endpoint: https://rest.jamasoftware.com/#operation_getTagsOnItem

Using Zapier to get FireStore sub-collection ID's

I'm using Zapier to look up user information in FireStore based on the user's email address. I have a Top Collection called "groups" which contain users. If I use the attached query in Zapier and hard code the {GROUP_ID}, so that the path is "groups/{GROUP_ID}/users", then the query works.
Successful Zapier Structured Firestore Query
However, I won't know the GROUP_ID at the time of the query. I'm thinking I'll need to loop through all groups (since google's collection groups don't appear to be supported in Zapier). But in order to loop through the groups, I first need to get a list of all the GROUP_ID's.
Because the GROUP_ID's are the top level sub-collection, I can't seem to figure out how to get Zapier to return a list of all of them. Zapier requires that I specify a collection group (groups) and a field path, and cannot leave either blank.
Any help is much appreciated! Thanks!

Clio API v4; Endpoint for getting list of documents within one folder

Problem: Getting a list of documents that exist in a specific folder
Tried solution:
endpoint /api/v4/folders/list.json seems to be working exactly the same as /api/v4/folders.json
Something similar to this - similar endpoint doesn't seem to exist
Filtering documents by parent_id, however this functionality doesn't exist
Is there some kind of example of the endpoint to perform such operation?
Reading the documentation, it appears as though /api/v4/folders/list.json returns the contents of a folder. If you are trying to get a list of all the documents within the folder 1425540709 (using your example above) then your GET would add a parameter "parent_id = 1425540709". According to the documentation, if you don't send a "parent_id" it defaults to the root folder for the account.
Your request url should look like this I believe:
https://app.goclio.com/api/v4/folders/list.json?parent_id=1425540709&limit=25
The response will be a json array of the items within that folder.
Make sure you send it a parameter for what fields you want back too because otherwise the api defaults to just id and etag.

SharePoint SOAP service GetListItem with respect to updated date?

Right now I am working on a project to fetch data from a SharePoint list using SOAP API. I tried and successfully fetches the complete list, but now I want to fetch some specific data that is updated after a specific date.
Is this possible to fetch such data using SOAP query. I can see last update filed when I view single item at the bottom. Is this some how possible to use that filed?
Yes you can use the Web Services to do lot of things just like filtering a list result. I don't know which language you use, but with JavaScript you can look at these two frameworks that should help you:
http://aymkdn.github.io/SharepointPlus/ : easy way to create your queries (I created it)
http://spservices.codeplex.com/ : the most popular framework but less easy to use (it's my point of view)
You can also look at the documentation on MSDN (the param to use is query): http://msdn.microsoft.com/en-us/library/lists.lists.getlistitems.aspx
At last found the answer,
The last update date and time can be retrieved from the list column "Modified".
The soap response will have the value in the attribute "ows_Modified".
Muhammad Usman