user3396420
user3396420

Reputation: 840

Google Drive API. Get id from url

I need move a drive file between folders using the Google Drive API and PHP. But in some case I only have the url of the document, and I need to move that file to another folder. But I don't know if is possible to do this having only the file url.

Any body know if its possible and how? I'm looking for it in the documentation but I can't do it.

Thanks.

Upvotes: 0

Views: 1087

Answers (2)

pinoyyid
pinoyyid

Reputation: 22306

I just had a look at the documentation page for patch (https://developers.google.com/drive/v2/reference/files/patch) and it looks like Google has silently changed the API. There are now two new query parameters addParents and removeParents which look like they will do what you want. NB I haven't tested this as it has only appeared in the last couple of weeks.

Upvotes: 0

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117006

I don't think you can "move" the file like that. The only way it might work would be to try and patch the location of the file file.patch. I have never heard of anyone trying to patch the location of a file.

I consulted a colleague who is a Google Drive expert, he said he thought it was broken (patching location). He did a quick test and verified this is a broken feature. All it returns is 403 - insufficient permissions

You will need to download the file and upload it again.

Upvotes: 2

Related Questions