I’m having trouble with the Google Drive API when I try to mark a folder as starred. The API call seems to work fine and returns the correct response, but when I check the actual Google Drive web interface, the star doesn’t show up.
I can successfully update other properties like the folder name, but the starred status just won’t appear visually in Drive. I’ve waited over 20 minutes thinking it might be a delay issue, but still no luck.
Here’s my setup code for creating a directory:
from googleapiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials
from credentials import DRIVE_API_KEY, ROOT_DIR_ID
API_SCOPES = ["https://www.googleapis.com/auth/drive"]
creds = ServiceAccountCredentials.from_json_keyfile_dict(
DRIVE_API_KEY, API_SCOPES
)
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 attempt to modify both the name and starred status:
modify_data = {"name": "Updated Directory Name", "starred": True}
result = (
drive_service.files()
.update(fileId=new_folder["id"], body=modify_data, fields="name, starred")
.execute()
)
When I verify the changes 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 Google Drive web interface, there’s no star visible next to the folder. Has anyone encountered this issue before? Is there something I’m missing in my API calls?