Forum Discussion

malleswari1's avatar
malleswari1
New Contributor II
6 years ago

REST Google Drive API - File is created as untitled

Hi Team,

I am trying to write a file into google drive using REST Post snap, while creating the file in google drive, filename is set to untitled, tried with other options as such as multipart file upload but unable to resolve the error.

Below is my Rest post configuration

Below is my REST OAuth2 Account config:

any help on this issue is very much appreciated.

Thanks,
Reddy

12 Replies

    • robin's avatar
      robin
      Former Employee

      Please note, the REST Snap Pack is targeted for an update in release 4.20 with explicit support for multipart/related Content-Type requests.

  • skodali's avatar
    skodali
    New Contributor III

    Does any one have an idea how to get the desired file name?

  • malleswari1's avatar
    malleswari1
    New Contributor II

    Hi , I am now able to post the data from SFTP to Google Drive API, but still working on the ‘untitled’ file name issue. I will let you know if I am able to fix the issue.

    Thanks,
    REddy

  • I don’t think the Rest POST snap can perform a POST with a multipart/related content-type, so you might try the resumable API end point and see if that would work. I haven’t gotten OAuth to work on my Google Drive account, so haven’t actually tried this, but might be worth looking at.

    It’ll require you to make two requests. The first will create the file metadata, which you could set the file’s title in, which responds with a location to upload the file contents. Then the next request uploads the file to the location that was returned in the first request.

  • malleswari1's avatar
    malleswari1
    New Contributor II

    Thanks for the update. I will try and let you know if I make any progress.

    • malleswari1's avatar
      malleswari1
      New Contributor II

      Hi Taylor,

      Yes, I have tried that option it is working for me I am able to upload the file, but the file is getting created as “untitled”

      • RogerSramkoski's avatar
        RogerSramkoski
        Employee

        Using @tlikarish’s suggestion of setting this up as a resumable upload rather than multipart/related, I was able to get this working. The pipeline is a REST POST used to create the resumable upload UIR followed by a REST PUT that uploads the file to the URI.

        Red boxes indicate the fields you need to configure and how I configured them. Since this is a basic demonstration pipeline you will need to modify it to account for your needs, such as paramaterization. Note that the file does not upload in the REST POST snap.

        Here are the Query Parameters and HTTP Headers set based on Google’s documentation:

        Here is the REST PUT snap which uses the $response.headers.location URI from the REST POST to upload the file. That link will contain a token to ensure the file data is associated with the metadata we previously sent via REST POST.

        Here is a screenshot of the file going into my Google Drive with the correct name.

        Finally, there is a caveat to this approach: the multi-part form data included by the REST POST snap is added to the file (rows 1-4 and the last row, row 8 in this example).

        Here is the pipeline and sample test.csv file:
        REST_TO_GOOGLE_DRIVE.slp (17.6 KB)
        test.csv.zip (908 Bytes)

        I’ll provide another update if I can find a way around the additional HTTP Body information making its way into the file.

  • skodali's avatar
    skodali
    New Contributor III

    @malleswari1, If possible can you please explain/post the approach which you have tried to perform this action?

    Thank,
    Sasank