Page 1 of 2

How to retrieving "File names" for all files (from dabase service API) from specific owner?

Posted: Fri Aug 16, 2013 3:17 pm
by Helsen

Hello Appery.io Team!

my app already can Upload and Retrieving files from DB (File API),
but I can't find a solution how to Retrieving ALL fileNames for specifc user(owner) in DB (Files Built-in collection).

Can you help me?

Regards


How to retrieving "File names" for all files (from dabase service API) from specific owner?

Posted: Fri Aug 16, 2013 4:18 pm
by Kateryna Grynko

Hi,

I'll look for a solution.


How to retrieving "File names" for all files (from dabase service API) from specific owner?

Posted: Fri Aug 16, 2013 5:33 pm
by Kateryna Grynko

Take a look at $in in where clause please.
You can send request to DB and set in "where" something like this:
code{"user_id": {"$in": ["fileName"]}}/code


How to retrieving "File names" for all files (from dabase service API) from specific owner?

Posted: Sat Aug 17, 2013 12:06 am
by Helsen

Thank you for reply, but I can't access files stored in database in this way (this is my fault?), in appery.io docs (Database - File Api) tell me to retrieve file with file name only.

----doc-----
Retrieving Files

curl -X GET
-H "Content-Type: [set_to_file_type]"
-H "X-Appery-Database-Id: 498ad4r0e4b9348a121cf6ea"
-H "X-Appery-Session-Token: 900ad7b0e4b9808a456cf5ba"
]https://api.appery.io/rest/1/db/files...

----end doc-----

In my case, I need retrieve a list of files, I don't know the name, I want retrieve all files.

Can I use all OBJECT API to access Files stored in Database? Any sample?

Thanks again


How to retrieving "File names" for all files (from dabase service API) from specific owner?

Posted: Sat Aug 17, 2013 2:11 am
by Helsen

I've tried,and give up.
I cant query https://api.appery.io/rest/1/db/files
Without file name, but when I don't know name Files, what can I do?


How to retrieving "File names" for all files (from dabase service API) from specific owner?

Posted: Sat Aug 17, 2013 2:16 am
by Alena Prykhodko

Helo Helsen! Sorry for late respond. We'll check and let you know.


How to retrieving "File names" for all files (from dabase service API) from specific owner?

Posted: Sat Aug 17, 2013 2:20 am
by Alena Prykhodko

How to retrieving "File names" for all files (from dabase service API) from specific owner?

Posted: Sat Aug 17, 2013 2:33 am
by Helsen

As I said, I use Files (built-in collection - like users built-in collection) it's not customized collection.

Result:

Code: Select all

codeDBSQ203/code 
Collection 'files' absent in database with id 'xxxxxxxxxxxxxxxx'.

How to retrieving "File names" for all files (from dabase service API) from specific owner?

Posted: Sat Aug 17, 2013 3:55 am
by Helsen

I need to create a workaround because not have solution for my question.

1- create a collection files_custom (for add to default File Built-in collection)
2- create column file_url
3- create column file_name
4- upload file with File API (database) http://docs.appery.io/documentation/b...
5- get result file url and file name to local storage
6- insert data in collection files_custom
7- now I can make query to get all files urls and filenames

but is very poor method to do simple thing....


How to retrieving "File names" for all files (from dabase service API) from specific owner?

Posted: Sat Aug 17, 2013 2:11 pm
by Alena Prykhodko

Helsen, we'll test it and inform you asap.