is it possible search by metadata in box api and return file and metadata together? - box-api

I'm using a metadata search in box api:
https://api.box.com/2.0/search?mdfilters=
The search is ok, but I'm passing metadata for search, but after return I receive only file information, not any metadata from files. Is it possible search by metadata in box api and return file and metadata together?

This does not appear possible. Your best option is to request all file metadata using the file ID returned in the search result. If you get multiple search results consider sending the metadata requests in parallel (up to ~10 requests/user/sec) to speed things up.

Related

Unable to search on specific boolean fields on files' properties in Google Drive API v3

I'm trying to use the Google Drive API to list certain files and am using the q parameter on files().list() method. I'm able to get the fields by specifying fields=nextPageToken, files(id...,shared) but when using q="shared" or q="shared = true", I get the following error Invalid Value:
googleapiclient.errors.HttpError: <HttpError 400 when requesting https://www.googleapis.com/drive/v3/files?pageSize=1000&fields=nextPageToken%2C+files%28id%2C+name%2C+parents%2C+modifiedTime%2C+kind%2C+mimeType%2C+size%2C+trashed%2C+ownedByMe%2C+shared%29&q=shared+%3D+true&alt=json returned "Invalid Value">
Is the above even allowed ? Because the fields I'm trying to compare against aren't present in the File Query Terms table at https://developers.google.com/drive/api/v3/ref-search-terms
Are the query terms provided on the API reference exhaustive and I can only perform searches on those terms ?
Unfortunately, in the current stage, shared is not included in the fields for the search query. Ref I think that the reason of your error is due to this.
Although there is sharedWithMe in the fields, this retrieves the file list of shared: true and ownedByMe: false. I thought that this might not be the result you expect. So when you want to retrieve the files with shared: true and ownedByMe: true, it is required to retrieve them after the file list was retrieved.
So, for example, how about reporting it as the future request to the Google issue tracker? Ref By this, Google side might consider to add new fields in the search query. Unfortunately, when I searched the same report, unfortunately, I couldn't find it.
Reference:
Search for Files

Caching API response from simple ruby script

I'm working on a simple ruby script with cli that will allow me to browse certain statistics inside the terminal.
I'm using API from the following website: https://worldcup.sfg.io/matches
require 'httparty'
url = "https://worldcup.sfg.io/matches"
response = HTTParty.get(url)
I have to goals in mind. First is to somehow save the JSON response (I'm not using a database) so I can avoid unnecessary requests. Second is to check if the new data is available, and if it is, to override the previously saved response.
What's the best way to go about this?
... with cli ...
So caching in memory is likely not available to you. In this case you can save the response to a file on disk.
Second is to check if the new data is available, and if it is, to override the previously saved response.
The thing is, how can you check if new data is available without doing a request for the data? Not possible (given the information you provided). So you can simply keep fetching data every 5 minutes or so and updating your local file.

Filters for Gooddata "Export a large report" API

I would like to know if I could filter a report before download it's data inside the csv file, I'm using this url:
https://secure.gooddata.com/gdc/app/projects/project_id/execute/raw/
I couldn't found any information at gooddata api about this, the body of the post request accept this json:
{'report_req': {'reportDefinition': '/gdc/md/{project_id}/obj/{obj_id}'} }
There are other parameters for filtering the data?
If don't, there is another way to download filtered data?
If there is another way, can I change from .csv to .json? Or maybe get the json data inside the response body?
Definition of filters is a part of "reportDefinition". The solution is to use or create report definition which contains required filters and perform the mentioned "execute/raw" call. Result of "execute/raw" call is always in csv format.

weird file listing response differences between v2 and v3

I am using the google-drive-sdk with our company-made device. We upload pictures made by our device to google drive. After that I try to list the files with a GET request to https://www.googleapis.com/drive/v2/files to get thumbnailLink and webContentLink. Everything is working fine except that when I switch to v3 I don't get the response I should. The documentation says I should get a metadata response like https://developers.google.com/drive/v3/reference/files
but I only get: id, kind, name and mimeType. What am I doing wrong?
As stated in Migrate to Google Drive API v3 documentation, there are changes on how fields were returned.
Full resources are no longer returned by default. You need to use the fields query parameter to request specific fields to be returned. If left unspecified only a subset of commonly used fields are returned.
You can see examples on Github. This SO question might also help.
In v3 they made all the queries parametric. So you can query passing some parameter like
var request = gapi.client.drive.files.list({
'pageSize': 10,
'fields': 'files,kind,nextPageToken'
});
This block of code will return you all the information of every file just like v2.
If you are sending a get request then for fetching all the information you can try GET https://www.googleapis.com/drive/v3/files?fields=files%2Ckind%2CnextPageToken&key={YOUR_API_KEY}
Suppose you need ownsers and permissions only then set
var request = gapi.client.drive.files.list({
'pageSize': 10,
'fields':'files(owners,permissions),kind,nextPageToken'
});
For GET request use GET https://www.googleapis.com/drive/v3/files?fields=files(owners%2Cpermissions)%2Ckind%2CnextPageToken&key={YOUR_API_KEY}
for reference you can use Google Developers Documentation for fetching File list

Retrieve URL JSON data in MS Access

There is a web service that allows me to go to a URL, with my API-key, and request a page of data. The data is returned as JSON. The JSON is well-formed, I ran it through JSONLint and confirmed its OK.
What I would like to do is retrieve the JSON data from within MS Access (2003 or 2007), if possible, and build a table from that data (first time thru), then append/update the table on subsequent calls to that URL. I would settle for "pre-step" where I retrieve this information via another means. Since I have an API key in the URL, I do not want to do this server-side. I would like to keep it all within Access, run it on my PC at home (its for personal use anyway).
If I have to use another step before the database load then Javascript? But I dont know that very well. I dont even really know what JSON is other than what I have read in Wikipedia. The URL looks similar to:
http://www.SomeWebService.com/MyAPIKey?p=1&s=50
where: p = page number
s = records per page
Access DB is a JavaScript Lib for MS Access, quick page search says they play nicely with JSON, and you can input/output with. boo-ya.
http://www.accessdb.org/
EDIT:
dead url; wayback machine ftw:
http://web.archive.org/web/20131007143335/http://www.accessdb.org/
also sourceforge
http://sourceforge.net/projects/accessdb/