使用google-drive-api导出文件时如何设置mimeType?
How to set mimeType when use files export of google-drive-api?
我用[google-drive-sdk]
,我看看如何导出文件here。
我知道 fileId
和 mimeType
这两项是必需的。
当我将mimeType
设置为application/vnd.google-apps.spreadsheet
,然后我点击
按钮 EXECUTE
,响应是:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "The requested conversion is not supported.",
"locationType": "parameter",
"location": "convertTo"
}
],
"code": 400,
"message": "The requested conversion is not supported."
}
}
好像是我设置的mimeType不对,如何设置mimeType?
正如Tanaike所说,当我使用Files: export时,我将text/csv
设置为mimeType
,然后响应没有错误。
现在您可以看到正确的回复:
其实使用Files: get可以获得详细的下载信息。
例如,在节点 exportLinks
:
"exportLinks": {
"application/x-vnd.oasis.opendocument.spreadsheet": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=ods",
"text/tab-separated-values": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=tsv",
"application/pdf": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=pdf",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=xlsx",
"text/csv": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=csv",
"application/zip": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=zip",
"application/vnd.oasis.opendocument.spreadsheet": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=ods"
}
我用[google-drive-sdk]
,我看看如何导出文件here。
我知道 fileId
和 mimeType
这两项是必需的。
当我将mimeType
设置为application/vnd.google-apps.spreadsheet
,然后我点击
按钮 EXECUTE
,响应是:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "The requested conversion is not supported.",
"locationType": "parameter",
"location": "convertTo"
}
],
"code": 400,
"message": "The requested conversion is not supported."
}
}
好像是我设置的mimeType不对,如何设置mimeType?
正如Tanaike所说,当我使用Files: export时,我将text/csv
设置为mimeType
,然后响应没有错误。
现在您可以看到正确的回复:
其实使用Files: get可以获得详细的下载信息。
例如,在节点 exportLinks
:
"exportLinks": { "application/x-vnd.oasis.opendocument.spreadsheet": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=ods", "text/tab-separated-values": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=tsv", "application/pdf": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=pdf", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=xlsx", "text/csv": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=csv", "application/zip": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=zip", "application/vnd.oasis.opendocument.spreadsheet": "https://docs.google.com/spreadsheets/export?id=YpDWTfWh5VFtchFYA&exportFormat=ods" }