Gets information about Google Drive import formats and export formats.
Use ChilkatAx-9.5.0-win32.pkg
Procedure Test
Handle hoRest
Boolean iSuccess
Variant vOauth2
Handle hoOauth2
Variant vSbJson
Handle hoSbJson
Handle hoJson
Integer i
Integer iCount_i
String sStrVal
String sTemp1
Integer iTemp1
Get Create (RefClass(cComChilkatRest)) To hoRest
If (Not(IsComObjectCreated(hoRest))) Begin
Send CreateComObject of hoRest
End
// Provide a previously obtained OAuth2 access token.
Get Create (RefClass(cComChilkatOAuth2)) To hoOauth2
If (Not(IsComObjectCreated(hoOauth2))) Begin
Send CreateComObject of hoOauth2
End
Set ComAccessToken Of hoOauth2 To "OAUTH2_ACCESS_TOKEN"
Get pvComObject of hoOauth2 to vOauth2
Get ComSetAuthOAuth2 Of hoRest vOauth2 To iSuccess
Get ComConnect Of hoRest "www.googleapis.com" 443 True True To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComAddQueryParam Of hoRest "fields" "importFormats,exportFormats" To iSuccess
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbJson
If (Not(IsComObjectCreated(hoSbJson))) Begin
Send CreateComObject of hoSbJson
End
Get pvComObject of hoSbJson to vSbJson
Get ComFullRequestNoBodySb Of hoRest "GET" "/drive/v3/about" vSbJson To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComResponseStatusCode Of hoRest To iTemp1
If (iTemp1 <> 200) Begin
Get ComResponseStatusCode Of hoRest To iTemp1
Showln "Received error response code: " iTemp1
Showln "Response body:"
Get ComGetAsString Of hoSbJson To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJson
If (Not(IsComObjectCreated(hoJson))) Begin
Send CreateComObject of hoJson
End
Get pvComObject of hoSbJson to vSbJson
Get ComLoadSb Of hoJson vSbJson To iSuccess
// The following code parses the JSON response.
// A sample JSON response is shown below the sample code.
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.text/tab-separated-values" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.text/tab-separated-values[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/x-vnd.oasis.opendocument.presentation"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/x-vnd.oasis.opendocument.presentation"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.image/jpeg" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.image/jpeg[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.image/bmp" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.image/bmp[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.image/gif" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.image/gif[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.ms-excel.sheet.macroenabled.12"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.ms-excel.sheet.macroenabled.12"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.wordprocessingml.template"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.wordprocessingml.template"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.ms-powerpoint.presentation.macroenabled.12"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.ms-powerpoint.presentation.macroenabled.12"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.ms-word.template.macroenabled.12"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.ms-word.template.macroenabled.12"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.wordprocessingml.document"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.wordprocessingml.document"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.image/pjpeg" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.image/pjpeg[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.google-apps.script+text/plain"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.google-apps.script+text/plain"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.ms-excel"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.ms-excel"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.sun.xml.writer"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.sun.xml.writer"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.ms-word.document.macroenabled.12"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.ms-word.document.macroenabled.12"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.ms-powerpoint.slideshow.macroenabled.12"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.ms-powerpoint.slideshow.macroenabled.12"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.text/rtf" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.text/rtf[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.text/plain" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.text/plain[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.oasis.opendocument.spreadsheet"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.oasis.opendocument.spreadsheet"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/x-vnd.oasis.opendocument.spreadsheet"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/x-vnd.oasis.opendocument.spreadsheet"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.image/png" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.image/png[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/x-vnd.oasis.opendocument.text"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/x-vnd.oasis.opendocument.text"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.application/msword" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.application/msword[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.application/pdf" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.application/pdf[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.application/json" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.application/json[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.application/x-msmetafile" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.application/x-msmetafile[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.spreadsheetml.template"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.spreadsheetml.template"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.ms-powerpoint"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.ms-powerpoint"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.ms-excel.template.macroenabled.12"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.ms-excel.template.macroenabled.12"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.image/x-bmp" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.image/x-bmp[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.application/rtf" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.application/rtf[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.presentationml.template"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.presentationml.template"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.image/x-png" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.image/x-png[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.text/html" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.text/html[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.oasis.opendocument.text"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.oasis.opendocument.text"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.presentationml.presentation"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.presentationml.presentation"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.google-apps.script+json"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.google-apps.script+json"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.presentationml.slideshow"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.openxmlformats-officedocument.presentationml.slideshow"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.ms-powerpoint.template.macroenabled.12"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.ms-powerpoint.template.macroenabled.12"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.text/csv" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.text/csv[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'importFormats."application/vnd.oasis.opendocument.presentation"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'importFormats."application/vnd.oasis.opendocument.presentation"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.image/jpg" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.image/jpg[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson "importFormats.text/richtext" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "importFormats.text/richtext[i]" To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'exportFormats."application/vnd.google-apps.form"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'exportFormats."application/vnd.google-apps.form"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'exportFormats."application/vnd.google-apps.document"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'exportFormats."application/vnd.google-apps.document"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'exportFormats."application/vnd.google-apps.drawing"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'exportFormats."application/vnd.google-apps.drawing"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'exportFormats."application/vnd.google-apps.spreadsheet"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'exportFormats."application/vnd.google-apps.spreadsheet"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'exportFormats."application/vnd.google-apps.script"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'exportFormats."application/vnd.google-apps.script"[i]' To sStrVal
Move i + 1 To i
Loop
Move 0 To i
Get ComSizeOfArray Of hoJson 'exportFormats."application/vnd.google-apps.presentation"' To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson 'exportFormats."application/vnd.google-apps.presentation"[i]' To sStrVal
Move i + 1 To i
Loop
Showln "Example Completed."
End_Procedure
{
"importFormats": {
"text/tab-separated-values": [
"application/vnd.google-apps.spreadsheet"
],
"application/x-vnd.oasis.opendocument.presentation": [
"application/vnd.google-apps.presentation"
],
"image/jpeg": [
"application/vnd.google-apps.document"
],
"image/bmp": [
"application/vnd.google-apps.document"
],
"image/gif": [
"application/vnd.google-apps.document"
],
"application/vnd.ms-excel.sheet.macroenabled.12": [
"application/vnd.google-apps.spreadsheet"
],
"application/vnd.openxmlformats-officedocument.wordprocessingml.template": [
"application/vnd.google-apps.document"
],
"application/vnd.ms-powerpoint.presentation.macroenabled.12": [
"application/vnd.google-apps.presentation"
],
"application/vnd.ms-word.template.macroenabled.12": [
"application/vnd.google-apps.document"
],
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [
"application/vnd.google-apps.document"
],
"image/pjpeg": [
"application/vnd.google-apps.document"
],
"application/vnd.google-apps.script+text/plain": [
"application/vnd.google-apps.script"
],
"application/vnd.ms-excel": [
"application/vnd.google-apps.spreadsheet"
],
"application/vnd.sun.xml.writer": [
"application/vnd.google-apps.document"
],
"application/vnd.ms-word.document.macroenabled.12": [
"application/vnd.google-apps.document"
],
"application/vnd.ms-powerpoint.slideshow.macroenabled.12": [
"application/vnd.google-apps.presentation"
],
"text/rtf": [
"application/vnd.google-apps.document"
],
"text/plain": [
"application/vnd.google-apps.document"
],
"application/vnd.oasis.opendocument.spreadsheet": [
"application/vnd.google-apps.spreadsheet"
],
"application/x-vnd.oasis.opendocument.spreadsheet": [
"application/vnd.google-apps.spreadsheet"
],
"image/png": [
"application/vnd.google-apps.document"
],
"application/x-vnd.oasis.opendocument.text": [
"application/vnd.google-apps.document"
],
"application/msword": [
"application/vnd.google-apps.document"
],
"application/pdf": [
"application/vnd.google-apps.document"
],
"application/json": [
"application/vnd.google-apps.script"
],
"application/x-msmetafile": [
"application/vnd.google-apps.drawing"
],
"application/vnd.openxmlformats-officedocument.spreadsheetml.template": [
"application/vnd.google-apps.spreadsheet"
],
"application/vnd.ms-powerpoint": [
"application/vnd.google-apps.presentation"
],
"application/vnd.ms-excel.template.macroenabled.12": [
"application/vnd.google-apps.spreadsheet"
],
"image/x-bmp": [
"application/vnd.google-apps.document"
],
"application/rtf": [
"application/vnd.google-apps.document"
],
"application/vnd.openxmlformats-officedocument.presentationml.template": [
"application/vnd.google-apps.presentation"
],
"image/x-png": [
"application/vnd.google-apps.document"
],
"text/html": [
"application/vnd.google-apps.document"
],
"application/vnd.oasis.opendocument.text": [
"application/vnd.google-apps.document"
],
"application/vnd.openxmlformats-officedocument.presentationml.presentation": [
"application/vnd.google-apps.presentation"
],
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [
"application/vnd.google-apps.spreadsheet"
],
"application/vnd.google-apps.script+json": [
"application/vnd.google-apps.script"
],
"application/vnd.openxmlformats-officedocument.presentationml.slideshow": [
"application/vnd.google-apps.presentation"
],
"application/vnd.ms-powerpoint.template.macroenabled.12": [
"application/vnd.google-apps.presentation"
],
"text/csv": [
"application/vnd.google-apps.spreadsheet"
],
"application/vnd.oasis.opendocument.presentation": [
"application/vnd.google-apps.presentation"
],
"image/jpg": [
"application/vnd.google-apps.document"
],
"text/richtext": [
"application/vnd.google-apps.document"
]
},
"exportFormats": {
"application/vnd.google-apps.form": [
"application/zip"
],
"application/vnd.google-apps.document": [
"application/rtf",
"application/vnd.oasis.opendocument.text",
"text/html",
"application/pdf",
"application/epub+zip",
"application/zip",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"text/plain"
],
"application/vnd.google-apps.drawing": [
"image/svg+xml",
"image/png",
"application/pdf",
"image/jpeg"
],
"application/vnd.google-apps.spreadsheet": [
"application/x-vnd.oasis.opendocument.spreadsheet",
"text/tab-separated-values",
"application/pdf",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"text/csv",
"application/zip",
"application/vnd.oasis.opendocument.spreadsheet"
],
"application/vnd.google-apps.script": [
"application/vnd.google-apps.script+json"
],
"application/vnd.google-apps.presentation": [
"application/vnd.oasis.opendocument.presentation",
"application/pdf",
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
"text/plain"
]
}
}