Проверка того, является ли файл на диске Google документами, таблицами и слайдами Google?

Как узнать, является ли файл на Google Диске документами, таблицами и слайдами Google?

Любые узоры?

{
                        "kind": "drive#file",
                        "id": "xxxxxxxxxxxxxxxxxxxxxxxx",
                        "etag": "\"xxxxxxxxxxxxxxxxxxxxx\"",
                        "selfLink": "https://www.googleapis.com/drive/v2/files/xxxxxxxxxxxxxx",
                        "alternateLink": "https://docs.google.com/document/d/xxxxxxxxxxxxx/edit?usp=drivesdk",
                        "embedLink": "https://docs.google.com/document/d/xxxxxxxxxxxxx/preview?ouid=xxxxxxxxxxxxxxx",
                        "iconLink": "https://drive-thirdparty.googleusercontent.com/16/type/application/vnd.google-apps.document",
                        "thumbnailLink": "https://docs.google.com/feeds/vt?gd=true&id=xxxxxxxxxxxxxxxxx&v=1&s=AMedNxxxxxxxxxxpdmctLve-fDRQL6N9iGoAJ-aE&sz=s220",
                        "title": "Title",
                        "mimeType": "application/vnd.google-apps.document",
                        "labels": ⊕{5 items},
                        "copyRequiresWriterPermission": false,
                        "createdDate": "2021-06-02T03:33:25.303Z",
                        "modifiedDate": "2021-06-02T03:34:04.112Z",
                        "markedViewedByMeDate": "1970-01-01T00:00:00.000Z",
                        "version": "17",
                        "parents": ⊕[1 item],
                        "exportLinks": ⊕{8 items},
                        "userPermission": ⊕{7 items},
                        "quotaBytesUsed": "0",
                        "ownerNames": ⊕[1 item],
                        "owners": ⊕[1 item],
                        "lastModifyingUserName": "myname",
                        "lastModifyingUser": ⊕{6 items},
                        "capabilities": ⊕{2 items},
                        "editable": false,
                        "copyable": true,
                        "writersCanShare": true,
                        "shared": true,
                        "explicitlyTrashed": false,
                        "appDataContents": false,
                        "spaces": ⊖[
                            "drive"
                        ]}

Кажется, mimeType дает некоторые подсказки, но не всегда

application/vnd.google-apps.document должен быть документом Google


person Luk Aron    schedule 22.07.2021    source источник


Ответы (2)


Стандартный способ указать любой тип файла — по его типу носителя или тип пантомимы.

Если вы проверите ответ, который вы показали, вы увидите

"mimeType": "application/vnd.google-apps.document",

Это скажет вам, что это файл типа google-apps. затем вы можете проверить документацию для Google типа mime, чтобы узнать, какой это тип

введите здесь описание изображения

person DaImTo    schedule 22.07.2021

"mimeType": "application/vnd.google-apps.spreadsheet"\
"mimeType": "application/vnd.google-apps.presentation"\
"mimeType": "application/vnd.google-apps.document",

это ответ

person Luk Aron    schedule 22.07.2021