Gets information about the user, the user's Drive, and system capabilities. This example will get the teamDriveThemes.
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 sId
String sBackgroundImageLink
String sColorRgb
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" "teamDriveThemes" 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 "teamDriveThemes" To iCount_i
While (i < iCount_i)
Set ComI Of hoJson To i
Get ComStringOf Of hoJson "teamDriveThemes[i].id" To sId
Get ComStringOf Of hoJson "teamDriveThemes[i].backgroundImageLink" To sBackgroundImageLink
Get ComStringOf Of hoJson "teamDriveThemes[i].colorRgb" To sColorRgb
Move i + 1 To i
Loop
Showln "Example Completed."
End_Procedure
{
"teamDriveThemes": [
{
"id": "abacus",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/Z5KeSUwxyWmRT9HGiVoXxqEp-KcWLSAkEgs3EgSHghCRi1_xPNFwdXbll6ivkDDqhtKabFeH1hw5fT3uDEmYDRVH3cNUXklNfZ0M8yuJ5Bwgu4w-vg=w1920-h216-n",
"colorRgb": "#ea6100"
},
{
"id": "blueprints",
"backgroundImageLink": "https://lh3.googleusercontent.com/proxy/UjEpDwYsn-r3TcmSB4k58Z-cKBa_KWgNy5F9sx-O2KGGTJXNXODqmxLJY999NCZG80WDFvs93nF3ISv_qGEiI5slt5eyoFxBCWKuFm873RZEqPy-E6GN4a8=w1920-h216-n",
"colorRgb": "#4285f4"
},
{
"id": "bok_choy",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/xVkWcsvjuebP-UnWCIJp6fEqRUHwIJObjK5KawhB-ReWImKOVk5FnbhqnirdhAuZLS3VWAqnks3-3SDjhQMePR15YYfuF7stMy1R14jdcd2WyhSLex00=w1920-h216-n",
"colorRgb": "#689f38"
},
{
"id": "books",
"backgroundImageLink": "https://lh4.googleusercontent.com/proxy/6Ok-qHt6muyfFg1x3Nd3y9M_iRUH5_aJRXq9JlTE6Z3a67qUFeVTdpLG80OBKpOtMXXffAPXtHMRkAMbzR-Q1e_dCqCntJAkV_q3U4VftNYC3k_V=w1920-h216-n",
"colorRgb": "#4285f4"
},
{
"id": "bread",
"backgroundImageLink": "https://lh3.googleusercontent.com/proxy/laR76MvgkpxgcFyKbLRlDHThRQ4PLNNwbzuHzSr_uQAOzxCdGhLFBsdMHk_jVWlFBlLSyqODOoLkCaO_lhmu_9zB1_z81r7fPVDjVL007HcvxXHc=w1920-h216-n",
"colorRgb": "#ef6c00"
},
{
"id": "bubbles_color",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/E3mV_x9XxkOnITzjKrPB0k8U1Cl6I_gqIff5aswwKAAnd7XtXCDQXgu_CMnLI8kbaPqoiqF695_eSyrp5d2Fp-OGeK-_WtpNU3LQAZNCQjYHzd1I1V-uw_Zmkco=w1920-h216-n",
"colorRgb": "#f06292"
},
{
"id": "circuit",
"backgroundImageLink": "https://lh3.googleusercontent.com/proxy/d_WN5RlW-1zH2gW_Kxj7hHqITZtlM7Zv-WlmBhdq6_43BeEHVxwCIhsqdxdWtCn2FYLH3bdPf0GeR3UCa9B2uXDrfwMOhnOaGwmJxAHLbC9K9Yp0VOg=w1920-h216-n",
"colorRgb": "#039be5"
},
{
"id": "clams",
"backgroundImageLink": "https://lh4.googleusercontent.com/proxy/LlctuQjxc_XPvwI_INV2KqcfflGjEreBmM2mFXp_5q24UUblES7O1yMNJYYtyMrpcvkziHO8Pyqd0OcvQyRBmNgQE3QI4vD88GMuCHPrd5E1NNl3=w1920-h216-n",
"colorRgb": "#e91e63"
},
{
"id": "clovers",
"backgroundImageLink": "https://lh4.googleusercontent.com/proxy/29RzK7cLA_mP_eh3Z0oAgElcC2DstGo9ujJNHecUyeoUIRbJ1npk_KhoNRtvBb5ZPVuv8dU5C5D0Ei18I_IPu_12ptLNoOioOvTAp_G9p0omV8gfHBg=w1920-h216-n",
"colorRgb": "#689f38"
},
{
"id": "cocktails",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/qVcF-uCcRs4eNsZFZHKDIiN_qdO20ifgGhQpi1t94SFzROGTb-1Kik2dbJ9_gk9G-QMawqhVQ_OVBE_5ZRAiqjhImQyfGSnnND7BEK1SiQYzRi_LpVfZnQ=w1920-h216-n",
"colorRgb": "#db4437"
},
{
"id": "concert",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/4rVgd0sxbyBKn2AF41Xn5alyAxc0nOgDAb6y1T3FnX6vntT6QQ0m8QgUlpr2J5rYLfCF9xh2cuGV7QxRSC13Ws2kgaDuf0Iopac-ZCBF6kgg40KXyCQ=w1920-h216-n",
"colorRgb": "#ef6c00"
},
{
"id": "desk",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/UzcLkepaZHw5GeAzjagJdp7-2DGaBMcj-9TU-X3o4PD1x_kQByZO_r-RDmBxS1iLzsq_MDEq4U_3w_qpTY_6VThyMPNk-Tz9lSEBUXXx-2ZclKA=w1920-h216-n",
"colorRgb": "#607d8b"
},
{
"id": "donut_coffee",
"backgroundImageLink": "https://lh5.googleusercontent.com/proxy/7Vo64b_mo3aTCFRR5JrnmwVrkeigpQuVpT0mOfsBbK_kdvyNVGY3b9CsrTj0t7E7_iMMg1g3GRltFQuCIuQ7vEUUVuWgxXgycBJhYdgAkUVoQK_Y_BwE2Yh3ng=w1920-h216-n",
"colorRgb": "#f06292"
},
{
"id": "fabric_rolls",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/aTqxoPupRaxlFYZDmlKz-ijfIYlHBPKk4ykKx_QO7P9r2HQzMlbKyPW6ZoslKMs7NMWeoFxi1sCcX_LLBop27LjO3Kd5H9_oa1UymAO_QtFHmHVrcxCNiIW2UA=w1920-h216-n",
"colorRgb": "#78909c"
},
{
"id": "flags",
"backgroundImageLink": "https://lh5.googleusercontent.com/proxy/D3i9Q2ZRdKAbGOFcE_zEOgRv2fX07_IDsfUdRBc4Kcwz8yBySLesQtcCM8wfdDxAlX3GqUueFwBdAU2HWuDib0uFsNgikds0N-iLhgdBEHDM3Gt9=w1920-h216-n",
"colorRgb": "#009688"
},
{
"id": "flower_field",
"backgroundImageLink": "https://lh4.googleusercontent.com/proxy/Gq6BmAzf26j19jOlJSFuQmFUobewCcVkInfjlXCVOCU1Sp-GuieGumKHiaK9oAOpD-NICfQJukjbqNzlCG90O0XKj0VnDR0abL2N7KCy6wIJIoIvOoqgvzCaww=w1920-h216-n",
"colorRgb": "#e06055"
},
{
"id": "flowers",
"backgroundImageLink": "https://lh3.googleusercontent.com/proxy/u56F0E7fTV972JarM1Q-rXAOOy-Zg-v5-Cm27-sKiV2hGdA3eeA1T9O1id4BfcuRdq46vXBbZT_tTl0JZNL4Ut0OMyh8op3IxOBGzKJpff9F7rVRCxw=w1920-h216-n",
"colorRgb": "#689f38"
},
{
"id": "glass",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/VPVLsbZj78Z8xpPMbAWjSF56mJZNw1Kyg7kN9LQ_pH6OA9z2v76rxC_8phHUXRst25qqFBRx14KxHwCDojH9ibzK3didVAx0g-uJqlb5s8-oz3ms=w1920-h216-n",
"colorRgb": "#0f9d58"
},
{
"id": "lighthouse",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/Pwl1rZFnKYnNRcSnIMnc_TsHX0E3OqbDuNT-yy3Ms9uUUjDGgGL21EQEYhoTdCN97pTSFRB086aNass2Kfk0mYOn0lnz-Vk2MrNJ1XrDkvwLmHCnliA-nL4=w1920-h216-n",
"colorRgb": "#4285f4"
},
{
"id": "maps",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/L8IbQigKrftSXEMsch8rXdBtZvlUiRZBfxIYiWbpp7S6oze0HZZ_QRcYP_EbEfkgZDU1QxGsVZffBzCRvhpPkgHhG53wVgj7M_nRxVZmOk-Lni0=w1920-h216-n",
"colorRgb": "#8d6e63"
},
{
"id": "mountains",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/1EIk6eaGyGTBI-Uug-G3KCwS_kE9esUIergJ2ohfcq5fmlMIYCDLtDbJgNSbAzQ6xB8VAKiE5w5jAYk3BofnuOpz5ccrcuuHwsamC2F34WOBg2_U9CJJwg=w1920-h216-n",
"colorRgb": "#5c6bc0"
},
{
"id": "notebook",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/iUd07dcNVNr6BO13gIGLhyorUezYWoxRf6nSJhT6nRK_NVvP3ABZAWS7vtXSZ6Th25OJ6q-mcYcHVE8pg4WrA9fZE8oVevnyuwLEOzOVHcH4IGac0Vto=w1920-h216-n",
"colorRgb": "#689f38"
},
{
"id": "paper_colored",
"backgroundImageLink": "https://lh5.googleusercontent.com/proxy/crERnz0f_KJZ7mN9iBmz5_AQiLGyaGNQfmu_kOocXzLChlK84r2aPp6AodqrG42sRv1yk_Og_DEuBIumug6wC6j9EcrZ1tqs6tTtH3SvtqDAkyK4MBbIMNBPAKs=w1920-h216-n",
"colorRgb": "#9c27b0"
},
{
"id": "pencils",
"backgroundImageLink": "https://lh5.googleusercontent.com/proxy/joaq8StlNK7Cp-apow03w_sP5HukbIrAHbZQRZJqpBhERCGYrixxXinALZ26nQ8N2o7NrR2reO4cGNJtfFnRQ9CtSnvXEjI3qM7uygrLlG3v573k71k=w1920-h216-n",
"colorRgb": "#0097a7"
},
{
"id": "roofing_metal",
"backgroundImageLink": "https://lh6.googleusercontent.com/proxy/pP_tp2yMg1wR-SzCbN9_w-mKyNXyquaaYakAvjv9hFGHGFJ6JLCvZYlpVabm-kXAaEUgg2odQ-GTZ4HyAaTOaEfPmxjYTqWyrAnGnSQ1RPMlOT2y3rtmsPF2FF0=w1920-h216-n",
"colorRgb": "#039be5"
},
{
"id": "sticky_notes",
"backgroundImageLink": "https://lh5.googleusercontent.com/proxy/UQ3zURt8as-FSzUcbkQQno8Dtk1oHeh38CyecfxIhSZArj6OIQ_ZTFR4sblspJxgHCKJKs4DSZB35UR4ReFEkN2SPo7OWqDRnMaz_MsMaVBXv0lw8kC_PTqfuQ=w1920-h216-n",
"colorRgb": "#0097a7"
},
{
"id": "table",
"backgroundImageLink": "https://lh5.googleusercontent.com/proxy/0A5qGh2DnHThdgzOJuZymFC7vt5aYKky-QWAuFjVROgK2Bxe47CT1sz72FhocQp0L-Lro5fK5kXKW5-uyVE7f-LhgokET-_Ndhe8BRQaGKzMhgms=w1920-h216-n",
"colorRgb": "#8d6e63"
},
{
"id": "travel",
"backgroundImageLink": "https://lh4.googleusercontent.com/proxy/eM-1oz45F6dCfOFQ2Yxr3ONAO7a549babd4jdMsBTqMErAeJ7fsk8EGPkDWi3IWoXxOA-cbftgzIDm0W7UCkepfhrONB_si1f8JfD3I0tt8IDT5hdA=w1920-h216-n",
"colorRgb": "#039be5"
},
{
"id": "upholstery",
"backgroundImageLink": "https://lh4.googleusercontent.com/proxy/SgwpfgisZXynN5lW3dPEEGAwdJGMZOF5eh-zBP-qkreIr8TlDRRUKUhmzUX0gRD49abGWMYVzYdIzgGc57-wEMDf6TdoFIdxFrdaG56NBaUOtA85RwaolvY=w1920-h216-n",
"colorRgb": "#009688"
},
{
"id": "waves",
"backgroundImageLink": "https://lh4.googleusercontent.com/proxy/MZfhMLHMVQQCU6ynMhZ_G_Byd4Yk2-zzKFADDpRM33LnFr9nRha-K3Iyk07IUOaQyuOPtMPVHkQ9-q13e2tXQMaDcF6DsTCnSxJBimZAQ5thT3lU=w1920-h216-n",
"colorRgb": "#ff5722"
},
{
"id": "waves_blue",
"backgroundImageLink": "https://lh3.googleusercontent.com/proxy/3culsw3bJyewo0Ql3IiKWm3HNeT54oEzDTVgNasW_V4L0FBZ-hazADPgfmLs06VL2p8b0vSyq9JFbtChXgRBAVX3iSZJeuRF19HYMwrOakDqL3GQMl_lZZ0=w1920-h216-n",
"colorRgb": "#5c6bc0"
},
{
"id": "wood",
"backgroundImageLink": "https://lh4.googleusercontent.com/proxy/FzzFqxrPJvhI24W_ZIbk7TNz3AYOArCU2m0UG4FNhc_2XPXGgcoF9B8FBIz6PsIctYn8aI5NKnU1NlsjHQEpu0DsMnEG8SDNopZZnwVzcFuQ3X4=w1920-h216-n",
"colorRgb": "#8d6e63"
}
]
}