The script runs but instead of creating a proper shortcut, it generates a text file containing the JSON payload. The filename I specify gets ignored completely. Has anyone encountered this issue before? What’s the correct way to create shortcuts using the Drive API?
you’re hitting the upload endpoint instead of the regular files endpoint. try changing your api_url to https://www.googleapis.com/drive/v3/files and drop the upload part. the upload endpoint is meant for multipart data, so it’s treating your json as file content.
You’re using the wrong API endpoint. When you hit the upload URL with JSON data, Google thinks you’re uploading file content, not metadata. Switch to the standard files endpoint like mentioned, but double-check your shortcut structure too. The parents array needs strings, not objects - use “parents”: [“destination_folder_id”] instead. I’ve seen shortcut creation fail silently when target file permissions don’t match your access level, so test with a file you own first. The filename getting ignored? That’s normal when the API treats your request as raw content upload.
Had the same issue with Drive API last year. Yeah, it’s the upload endpoint, but you also need to explicitly set Content-Type to ‘application/json’ - the API gets weird without it. Double-check your auth token has the right scopes too. You’ll need at least ‘https://www.googleapis.com/auth/drive.file’ or broader Drive permissions. Shortcut creation is picky about targetId format, so make sure you can actually access that original file ID with your current credentials. Your parent folder structure looks good though.