Visual FoxPro Google Drive: About: Get Import and Export Formats

Back to Index

Gets information about Google Drive import formats and export formats.

Documentation: https://developers.google.com/drive/v3/reference/about/get


LOCAL loRest
LOCAL lnSuccess
LOCAL loOauth2
LOCAL loSbJson
LOCAL loJson
LOCAL i
LOCAL lnCount_i
LOCAL lcStrVal

loRest = CreateObject('Chilkat_9_5_0.Rest')

*   Provide a previously obtained OAuth2 access token.
loOauth2 = CreateObject('Chilkat_9_5_0.OAuth2')
loOauth2.AccessToken = "OAUTH2_ACCESS_TOKEN"
loRest.SetAuthOAuth2(loOauth2)

lnSuccess = loRest.Connect("www.googleapis.com",443,1,1)
IF (lnSuccess <> 1) THEN
    ? loRest.LastErrorText
    RELEASE loRest
    RELEASE loOauth2
    CANCEL
ENDIF

loRest.AddQueryParam("fields","importFormats,exportFormats")

loSbJson = CreateObject('Chilkat_9_5_0.StringBuilder')
lnSuccess = loRest.FullRequestNoBodySb("GET","/drive/v3/about",loSbJson)
IF (lnSuccess <> 1) THEN
    ? loRest.LastErrorText
    RELEASE loRest
    RELEASE loOauth2
    RELEASE loSbJson
    CANCEL
ENDIF

IF (loRest.ResponseStatusCode <> 200) THEN
    ? "Received error response code: " + STR(loRest.ResponseStatusCode)
    ? "Response body:"
    ? loSbJson.GetAsString()
    RELEASE loRest
    RELEASE loOauth2
    RELEASE loSbJson
    CANCEL
ENDIF

loJson = CreateObject('Chilkat_9_5_0.JsonObject')
loJson.LoadSb(loSbJson)

*  The following code parses the JSON response.
*  A sample JSON response is shown below the sample code.

i = 0
lnCount_i = loJson.SizeOfArray("importFormats.text/tab-separated-values")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.text/tab-separated-values[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/x-vnd.oasis.opendocument.presentation"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/x-vnd.oasis.opendocument.presentation"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.image/jpeg")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.image/jpeg[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.image/bmp")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.image/bmp[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.image/gif")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.image/gif[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.ms-excel.sheet.macroenabled.12"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.ms-excel.sheet.macroenabled.12"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.openxmlformats-officedocument.wordprocessingml.template"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.openxmlformats-officedocument.wordprocessingml.template"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.ms-powerpoint.presentation.macroenabled.12"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.ms-powerpoint.presentation.macroenabled.12"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.ms-word.template.macroenabled.12"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.ms-word.template.macroenabled.12"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.openxmlformats-officedocument.wordprocessingml.document"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.openxmlformats-officedocument.wordprocessingml.document"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.image/pjpeg")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.image/pjpeg[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.google-apps.script+text/plain"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.google-apps.script+text/plain"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.ms-excel"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.ms-excel"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.sun.xml.writer"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.sun.xml.writer"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.ms-word.document.macroenabled.12"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.ms-word.document.macroenabled.12"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.ms-powerpoint.slideshow.macroenabled.12"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.ms-powerpoint.slideshow.macroenabled.12"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.text/rtf")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.text/rtf[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.text/plain")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.text/plain[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.oasis.opendocument.spreadsheet"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.oasis.opendocument.spreadsheet"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/x-vnd.oasis.opendocument.spreadsheet"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/x-vnd.oasis.opendocument.spreadsheet"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.image/png")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.image/png[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/x-vnd.oasis.opendocument.text"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/x-vnd.oasis.opendocument.text"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.application/msword")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.application/msword[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.application/pdf")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.application/pdf[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.application/json")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.application/json[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.application/x-msmetafile")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.application/x-msmetafile[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.openxmlformats-officedocument.spreadsheetml.template"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.openxmlformats-officedocument.spreadsheetml.template"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.ms-powerpoint"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.ms-powerpoint"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.ms-excel.template.macroenabled.12"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.ms-excel.template.macroenabled.12"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.image/x-bmp")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.image/x-bmp[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.application/rtf")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.application/rtf[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.openxmlformats-officedocument.presentationml.template"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.openxmlformats-officedocument.presentationml.template"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.image/x-png")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.image/x-png[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.text/html")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.text/html[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.oasis.opendocument.text"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.oasis.opendocument.text"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.openxmlformats-officedocument.presentationml.presentation"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.openxmlformats-officedocument.presentationml.presentation"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.google-apps.script+json"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.google-apps.script+json"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.openxmlformats-officedocument.presentationml.slideshow"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.openxmlformats-officedocument.presentationml.slideshow"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.ms-powerpoint.template.macroenabled.12"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.ms-powerpoint.template.macroenabled.12"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.text/csv")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.text/csv[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('importFormats."application/vnd.oasis.opendocument.presentation"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('importFormats."application/vnd.oasis.opendocument.presentation"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.image/jpg")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.image/jpg[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray("importFormats.text/richtext")
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf("importFormats.text/richtext[i]")
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('exportFormats."application/vnd.google-apps.form"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('exportFormats."application/vnd.google-apps.form"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('exportFormats."application/vnd.google-apps.document"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('exportFormats."application/vnd.google-apps.document"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('exportFormats."application/vnd.google-apps.drawing"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('exportFormats."application/vnd.google-apps.drawing"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('exportFormats."application/vnd.google-apps.spreadsheet"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('exportFormats."application/vnd.google-apps.spreadsheet"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('exportFormats."application/vnd.google-apps.script"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('exportFormats."application/vnd.google-apps.script"[i]')
    i = i + 1
ENDDO
i = 0
lnCount_i = loJson.SizeOfArray('exportFormats."application/vnd.google-apps.presentation"')
DO WHILE i < lnCount_i
    loJson.I = i
    lcStrVal = loJson.StringOf('exportFormats."application/vnd.google-apps.presentation"[i]')
    i = i + 1
ENDDO

? "Example Completed."

RELEASE loRest
RELEASE loOauth2
RELEASE loSbJson
RELEASE loJson

Sample JSON Response Body

{
  "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"
    ]
  }
}