Download Google File Gmail APi

2

using the function

 var request = gapi.client.gmail.users.messages.attachments.get({
              'id': attachId,
              'messageId': message.id,
              'userId': userId
            });

I get a JSON response like this:

{
  "attachmentId": string,
  "size": integer,
  "data": bytes
}

How do I download that file? or there is some function to download those attachments files from the api of gmail-google

I also have access to message.payload.parts and this brings me the following JSON:

 {
        "partId": "0.1",
        "mimeType": "image\/jpeg",
        "filename": "image001.jpg",
        "headers": [
          {
            "name": "Content-Type",
            "value": "image\/jpeg; name=\"image001.jpg\""
          },
          {
            "name": "Content-Description",
            "value": "image001.jpg"
          },
          {
            "name": "Content-Disposition",
            "value": "inline; filename=\"image001.jpg\"; size=1741; creation-date=\"Tue, 03 Oct 2017 15:46:00 GMT\"; modification-date=\"Tue, 03 Oct 2017 15:46:00 GMT\""
          },
          {
            "name": "Content-ID",
            "value": "<[email protected]>"
          },
          {
            "name": "Content-Transfer-Encoding",
            "value": "base64"
          }
        ],
        "body": {
          "attachmentId": "ANGjdJ-DGT4IBENdLsJvn6uXAioxfrLQ7TCLWY6f5i5i0bAzQwHvlMhKxpa7IP6xK1XzlLkCykgDRuyPpa15LO37MAmVrmskWjNz0VMEIE0O7DwKAffXTnnrs5essp6usU6JlHfhBL8zDlVMKSaPiYdnRWZ3TQWF6XhHgXbc2saStJULHufsYf66Xcon6GIvFp2Yy66eBXhMcKA_PV7aFEDrY_aDOVBphUdP2nfjlnRJJfDbnXotXd_OYDjk00Hv0IL-sNAwu1ZEzRSCitdzxkD6GqLBbhHIEdZV_N0U0vNMukbJRDSIls2ljFMHoLyvdz5p6njPBAd-Ck7HWdYnQ26gGojUwSKx2j4G5BSfmGExeDCfFpqPn2oLJxWoG-fLtUJ1cALXOx9gBi3_hmZK",
          "size": 1741
        }
      }
    ]
  }

asked by Andress Blend 05.10.2017 в 18:08
source

0 answers