当我们在任何Google api调用中选择字段(驱动器文件,日历,地图等)时,就是这样,字段名称以,:
分隔fields=items(name,lastName,stuff)
响应将是这样的:
items: {
name: 'name',
lastName: 'lastName',
stuff: [
paramA: 'a',
paramB: 'b'
]
...
}
Google还允许我们选择stuff
之类的对象内部的字段,我们只能选择paramA
,只需要在内容后面加上/:
fields=items(name,lastName,stuff/paramA)
items: {
name: 'name',
lastName: 'lastName',
stuff: [
paramA: 'a'
]
...
}
但是对于google drive api,名称中带有/的是一个对象参数,它是exportLikns对象:
files: [
others_params,
exportLinks: {
"application/rtf": "link",
"application/vnd.oasis.opendocument.text": "link",
"text/html": "link",
"application/pdf": "link",
"application/epub+zip": "link",
"application/zip": "link",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "link",
"text/plain": "link"
}
]
我只选择exportLinks.text/html
和exportLinks.application/pdf
但是当我这样做时:
fields=files(parms,exportLinks/text/html)
google api抛出错误,告诉我html参数是错误的,那么如何选择名称为/的对象param?
这里是google docs for that (didn't help me much)
我尝试了一些方法:
exportLinks(text/html)
exportLinks/'text/html'
exportLinks/text*
exportLinks/*html
但是我还不能使它工作。