Can I set a lock on files with google api? - google-docs-api

when I look at Gdrive, there is also a fuse client to mount Gdrive. I wonder, when modifying a file on Gdrive through this client, is the file "locked" or in any other way set to "in use" to prevent others to modify the "original" on the internet? I haven't found anything about this. Isn't there a locking method with Google docs api?
Stef Bon

There is no such feature, but you can use the ETag of the file's entry to ensure that no one else has changed the file since it was fetched. This is not exactly the same thing, but it can achieve the same effect of ensuring that changes from one place are not overwritten by changes from another place.

Pretty sure they don't have that. You should consider suggesting it in the Google Docs feature request forums.

Related

Android 11 Storage Access Framework - How to use files?

Hey there fellow devs,
I have come across a problem while migrating our app to the new API 30 standards with the storage access framework (SAF).
I have successfully migrated the file structure and am now using the internal (FilesDir) paths.
Getting images with the MediaStore-Api is also working quite nicely.
But there is one big issue I just can't seem to fix.
In our app, we are using the API "Mapsforge" for Offline-Maps.
This API is using a Java.IO.File-Object we get from a path to a ".map" file which is almost 2GB large.
This file does not come from us, it is a file managed by the customer and put onto the device for us to use, since all the ".Map"-Files are custom.
Since the SAF is returning an Android.Net.Uri, I can't seem to convert it to a Java.IO.File without copying the contents of the file and therefore using even more storage on the device.
Is there any way to use the SAF to get a Java.IO.File-Object I can use in code?
If not, then Android 11 is making it very hard for my Customer to manage his storage.
This API is using a Java.IO.File-Object we get from a path to a ".map" file which is almost 2GB large.
With luck, Mapsforge will offer more flexible APIs in the future. You may wish to contact them about their recommendations.
Is there any way to use the SAF to get a Java.IO.File-Object I can use in code?
No. After all, the user might choose something on Google Drive or another cloud storage provider, rather than a local file. Or, they might choose a file that is inaccessible to your app. Or, they might choose content that is stored in an encrypted file, which needs to be decrypted by the document provider. And so on.

How do I make OneDrive put fail, when the item already exists?

Using the Microsoft Graph Explorer, I can use http PUT to create a OneDrive item.
For example, the uri below creates a testfile.txt at my root:
https://graph.microsoft.com/v1.0/me/drive/root:/testfile.txt:/content
Now, I would like the PUT to fail, if the file already exists, and the general documentation on OneDrive items, https://dev.onedrive.com/items/upload_put.htm#optional-query-string-parameters, states how to specify conflict behavior - if I read it correctly, like:
https://graph.microsoft.com/v1.0/me/drive/root:/testfile.txt:/content?#microsoft.graph.conflictBehavior=fail
However, the PUT still successfully overwrites the existing 'testfile.txt'.
Can anyone help me write a PUT query so that it fails in case the item already exists?
Is that even supported by OneDrive?
Do I need to go to the beta version of Microsoft Graph?
Per the documentation this should be specified within request body, not as a query parameter:
{
"item": {
"#microsoft.graph.conflictBehavior": "fail"
}
}
This is also only supported in the Resumable Upload" scenario as the request body for a direct upload is the file itself. In general, the guidance is to always use resumable uploads where possible. Direct uploads are limited to files less than 4MB which makes it unsuitable for most scenarios.
It is also worth noting that the documentation you referenced is for the standalone OneDrive API. While this is very similar to Graph's implementation, they are not entirely interchangeable. The Microsoft Graph documentation is the only authoritative source for Graph information.

Facebook Graph API changed results from /posts today?

I have an iOS app that has been fetching the user's Facebook status updates and location checkins using "/me/posts" for several months. After today's "breaking changes" update, "/me/posts" only returns recent "Like"s. It looks like "/me/statuses" and "/me/checkins" are the new proper places to check for these things. I guess that makes sense, but I saw no documentation anywhere describing these changes or saying that they would happen today. The original documentation about what is specifically returned from the graph API also seems pretty slim.
So my questions are: is this an official change to the API? Where was it specified? Where should I look so I can stay on top of these things and not have my app break for hundreds of users?
Perhaps more importantly: are "/me/statuses" and "/me/checkins" the new proper ways to get this information? Or is there something else?
Always good to keep a (sharp) eye on the Developer Roadmap. These types of changes happen often, but FB usually does a good job of calling them out ahead of time. You've answered your own question as far as whether or not it's an "official" change - you're seeing it in the wild - insofar as how Facebook works, it's official.
Try using the Graph API Explorer. It could be an access token issue.
FYI: I see a similar issue with my application, and I am able retrieve the posts only when I use the Graph API Explorer and the token I get from there.
Update: I found where some of the problems lived. In the app profile in Facebook, pick "Edit Settings" and then go to "Advanced" where you'll see a section called "Migrations". This is mostly switches to show compatibility for various "breaking changes" updates, but it also includes an option for "Include Checkins with Statuses".
Now I know where to look, things are making a bit more sense.

How to make iOS client synchronize craigslist-like data

I'm curious what would be the best approach for synchronizing data found on a website like craigslist where an API is not available.
Let's say you have already downloaded a set of posts. When you want to update the posts, what is the best way to compare what you already have with what is there, and then determine which ones are new to download and which ones should be deleted because they no longer exist on the server?
Please note my question isn't specific to craigslist, as this is just an example. I'm interested in general principles/techniques with specific regards to iOS.

Get watched issues in Redmine via REST API

We're looking to create a tool to help with time management in Redmine. The issue we are currently having is that we want to get a list of issues that are watched by a particular user but can't find an API for it. Does anyone know if this is possible or are we just going to have to try and modify Redmine directly?
SOLUTION: Similar to the solution provided below by dmf85, I found a solution to this problem that worked for me. The Issues API takes a query_id as one of its parameters. What I ended up doing was filtering my issues by Watcher (like dmf85 said) then saving the query. I then used the query_id from that saved custom query in my API call.
At least in Redmine 3.1, there’s an undocumented parameter for the Issues API that allows you to specify a watcher directly: watcher_id. It works just like assigned_to_id, you can pass either a user ID (i.e. watcher_id=23) or the special string me (i.e. watcher_id=me).
An example of URL could be like the following: https://example.com/redmine/issues.json?watcher_id=me&key=redmine_api_key
Under your issues tab in the interface, click:
add filter
watcher
select a watcher in the box
Then, click the atom, csv, or pdf link at the bottom for a link that you can write a program to consume at your discretion.
Does this help?

Resources