I’m having trouble with the Google Drive API when trying to mark a folder as starred. The API shows the update worked but the star doesn’t appear in the actual Google Drive web interface.
When I update other properties like the folder name, those changes show up right away. But the starred property seems to be stuck. I’ve waited over 20 minutes thinking it might be a delay issue, but still nothing.
Here’s my setup code for creating a directory:
from googleapiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
from config import DRIVE_API_CREDENTIALS, ROOT_DIR_ID
SCOPE_LIST = ["https://www.googleapis.com/auth/drive"]
creds = ServiceAccountCredentials.from_json_keyfile_dict(
DRIVE_API_CREDENTIALS, SCOPE_LIST
)
drive_service = build("drive", "v3", credentials=creds, cache_discovery=False)
folder_data = {
"name": "Test Directory",
"mimeType": "application/vnd.google-apps.folder",
"parents": [ROOT_DIR_ID],
}
new_folder = drive_service.files().create(body=folder_data, fields="id").execute()
Then I try to modify both the name and star status:
modification_data = {"name": "Updated Directory Name", "starred": True}
modified_result = (
drive_service.files()
.update(fileId=new_folder["id"], body=modification_data, fields="name, starred")
.execute()
)
When I check the result with a GET request:
verify_result = (
drive_service.files().get(fileId=new_folder["id"], fields="name,starred").execute()
)
print(verify_result)
The output shows: {'name': 'Updated Directory Name', 'starred': True}
But in the actual Google Drive interface, the folder shows the new name but no star icon. Has anyone else run into this problem? Is there something I’m missing in my API calls?