Anybody has any success using the API

dgogoasa

Member
Jul 26, 2018
32
6
8
I am trying to upload a file.. First of all whole process is unnecessarily convoluted.
? Use TWO keys to get ANOTHER two key BEFORE running anything... Say good buy to unit tests.
To upload a file one needs to go trough the above mentioned process which in my case always ends in:

Could not validate access_token and account_id, please reauthenticate or try again.

I did both but the result is always the same.
To shed some light I went into the admin area and used the API test tool to get folder info. Also unsuccessful. This time I have a complain that I didn't supply the key of the folder to upload the file to???? BUT THERE IS NO WAY in the API to get that...
But there is hope. The documentation mentions that if you don't supply the folder id the root will be automatically considered... so I try that.... No, no success:

"status": "error",
"response": "Please provide the folder_id param."


So my question is
HAS ANYBODY USED THIS API WITH ANY SUCCESS??
If you did, please share your knowledge. I just want to upload a file and than at a later time in another place with another tool to download the same file... One would expect this to be the core of this "SHARE FILES" API and the simplest to implement...
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
Use TWO keys to get ANOTHER two key BEFORE running anything...
You use your 2 API keys to get 1 access token, it doesn't respond with 2. This is the web standard, first authenticate the user then process their actual request. If you look at OAuth (which Facebook, Twitter etc uses) it's very similar, if not more lengthy. Once you have the access token it can be reused on further requests.

Say good buy to unit tests.
Why? Unit tests will work just fine.

To upload a file one needs to go trough the above mentioned process which in my case always ends in: Could not validate access_token and account_id, please reauthenticate or try again.
I don't see this on our dev or demo site, it works fine.

This time I have a complain that I didn't supply the key of the folder to upload the file to???? BUT THERE IS NO WAY in the API to get that...
/folder/listing endpoint. It'll give you the folder id.

But there is hope. The documentation mentions that if you don't supply the folder id the root will be automatically considered... so I try that.... No, no success: "status": "error", "response": "Please provide the folder_id param."
This also works fine in our dev and demo instances, I've just test it.

Overall I'm not seeing any issues. If you want me to look at your install directly please submit a ticket with /admin access initially, I'll run some tests.

Adam.
 

dgogoasa

Member
Jul 26, 2018
32
6
8
"Overall I'm not seeing any issues"
REALLY ?? I posted the answer from the test in the admin area not mine. I have tools to test the API and they give me the same answer. But OVERALL you don't see ANY ISSUES. What about the "DOESN'T WORK ISSUE?

... so frustrating hitting the wall again and again.

You use two key to get two identifiers? Do you know your API? TWO IDENTIFIERS NOT ONE. HERE THEY ARE

"access_token":
"account_id":

AND You use those two to get folder listing:
http://www.1droid.com.au/api/v2/folder/listing
Parameters
  • access_token The access token created previously by /authorize.
  • account_id The account id returned by /authorize.
  • parent_folder_id The folder parent id. Optional
And after I follow YOUR DOCS. I get:
{
"status": "error",
"response": "Could not validate access_token and account_id, please reauthenticate or try again.",
"_datetime": "2018-08-02 10:50:36"
}

AND "Overall I'm not seeing any issues" LOOK AGAIN....OR EVEN BETTER LET SOMEONE ELSE LOOK as it seems that anything I asked sofar has the same answer - "IT'S FOR SECURITY REASONS" ,and "THAT'S HOW OTHERS DO IT"

For security reasons i can not access my own files???? THAT HAS TO BE REALLY SECURE . . . BUT ALSO USELESS.


Do you see any issues now????

DOC STATES
HTTP Method

All methods are done using POST unless otherwise stated. IS THAT TRUE????
 
Last edited:

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
No, I'm still not seeing issues.

Have you sent me access to your install so I can confirm it's working as expected?
 

dgogoasa

Member
Jul 26, 2018
32
6
8
1. Did you read my post? = Still not seeing any issues? What about POST or GET?
2. What do you need to access the Admin?
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
Did you read my post? = Still not seeing any issues? What about POST or GET?
Yes, that's why I've asked for access to your admin. How can I diagnose something if I'm not seeing the same issues? As far as I'm concerned the API is working as expected in the release code. You added the final question on an edit to your post, so no I didn't read that first time. It's as the docs say.

What do you need to access the Admin?
An admin login.
 

dgogoasa

Member
Jul 26, 2018
32
6
8
NO need to diagnose anymore - -SOME OF THE REQUEST METHODS ARE GET not PUT. I discovered that by mistake.. What about fixing the document?

And please for once answer a question -
HOW DO I DOWNLOAD A FILE -
I know I start wit two keys,
I get TWO identifiers that I use after....


Where to from here?
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
None are PUT. All are POST as documented unless you can show me otherwise. Are you sure you're making requests into the API correctly?
 

dgogoasa

Member
Jul 26, 2018
32
6
8
Yes, that's why I've asked for access to your admin. How can I diagnose something if I'm not seeing the same issues? As far as I'm concerned the API is working as expected in the release code. You added the final question on an edit to your post, so no I didn't read that first time. It's as the docs say.


An admin login.
The docs say:
HTTP Method
All methods are done using POST unless otherwise stated.

I discovered so far that Folder listing and Folder info use GET - Still don't see anything?
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
The docs say:
HTTP Method
All methods are done using POST unless otherwise stated.

I discovered so far that Folder listing and Folder info use GET - Still don't see anything?
Have you used the test API framework in the admin. It only uses POST apart from the API endpoint. It *may* also work with GET but POST is the standard you should be using, as per the documentation.
 

dgogoasa

Member
Jul 26, 2018
32
6
8
I am using Postman to test. It is a tool that I trust as I always use it GET gives me results for Folder info and Folder List. POST ends with

Could not validate access_token and account_id, please reauthenticate or try again.
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
Start with the tool in the script admin area. There's a form you can use to POST to the API. Does that work for you?
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
So it must be either your third party tool or however you've configured it. The tool in the script admin area is a simple form POST into the API endpoint. As I said above, I am not seeing any issues with the API.
 

dgogoasa

Member
Jul 26, 2018
32
6
8
OK. I got them working also with POST.

NOW please for once answer this question -
HOW DO I DOWNLOAD A FILE -
I know I start with two keys,
I get TWO identifiers that I use after....

I can get weather "folder info" OR "folder list".... but neither gives me the list of files or file ids or SOMETHING . . .
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
As per the documentation:

/folder/listing
Returns a list of folders and files within the passed parent_folder_id. If this value is blank the root folder/file listing is returned.

/file/download
Generates a unique download url for a file.

You can see example responses in the documentation which clearly shows the file ids.
 

dgogoasa

Member
Jul 26, 2018
32
6
8
Parameters
  • access_token The access token created previously by /authorize.
  • account_id The account id returned by /authorize.
  • file_id The file id to generate the download url for.
Where do I get the file_id from?

folder_listing tells me that I have one folder in root with 6 files - correct but not useful
{
"data": {
"folders": [
{
"id": "3",
"parentId": null,
"folderName": "Designs",
"totalSize": "37195783",
"isPublic": "1",
"date_added": "2018-07-26 19:43:24",
"date_updated": "2018-07-28 07:24:29",
"url_folder": "http://www.1droid.com.au/folder/3/Designs",
"total_downloads": 0,
"child_folder_count": 0,
"file_count": 6
}
],
"files": []
},
"_status": "success",
"_datetime": "2018-08-03 00:29:03"
}

folder_info tells me that I have 6 files in this folder - again correct but not useful
{
"data": {
"id": "3",
"parentId": null,
"folderName": "Designs",
"totalSize": "37195783",
"isPublic": "1",
"accessPassword": null,
"date_added": "2018-07-26 19:43:24",
"date_updated": "2018-07-28 07:24:29",
"url_folder": "http://www.1droid.com.au/folder/3/Designs",
"total_downloads": 0,
"child_folder_count": 0,
"file_count": 6
},
"_status": "success",
"_datetime": "2018-08-03 00:30:33"
}
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
Look, enough of the sarcasm and ranting on your posts. I've been extremely patient with you so far but if you continue you'll loose access to these forums.

In the documentation the /folder/listing endpoint is described as:

"Returns a list of folders and files within the passed parent_folder_id. If this value is blank the root folder/file listing is returned."

In your example above, you've 1 folder in the root (called "Designs") with 6 files within it. They're not listed on this request as they are within that folder. You will need to make a request to the /folder/listing endpoint with the parent_folder_id set to that folder id, as detailed above.

You will find the file id in the returned data.
 

dgogoasa

Member
Jul 26, 2018
32
6
8
OK...sure! It is frustrating when it is all so unexpectedly ....unfriendly designed.

There is no information about modification nor creation date of the files.... Is it? Is there anyway that I can get that info
I need to know if the files have been modified so I re-download.

"data": {
"folders": [],
"files": [
{
"id": "711",
"filename": "cruiseship disability_Language.genx.zip",
"shortUrl": "rB",
"fileType": "application/zip",
"extension": "zip",
"fileSize": "9595748",
"status": "active",
"downloads": "0",
"folderId": "3",
"keywords": "cruiseship,disability,language,genx,zip",
"url_file": "http://www.1droid.com.au/rB"
},
{