Jump to content

Recommended Posts


I am novice filemaker developer, and trying to learn the cool ways Filemaker can integrate with other apps.

The "simple" task: upload document (.pdf) to Google Drive Folder with native filemaker funtions (no plugin).

So far: I have managed to get the authorisation token (following Seedcode guide for Gmail integration and Harmonic DevCon18 presentation and demo files) and make the POST call to create a file in the Google Drive root folder, however the file is unreadable. So my guess is that I am not putting all the curl options correctly from what I understand from the Google Drive API documentation ( https://developers.google.com/drive/api/v3/manage-uploads😞

POST https://www.googleapis.com/upload/drive/v3/files?uploadType=media HTTP/1.1
Content-Type: image/jpeg
Authorization: Bearer [YOUR_AUTH_TOKEN]


My script steps are as follow:

Set Variable [ $file ; Value: google_api::file_upload_v2 (container)] 
Set Variable [ $length ; Value: GetContainerAttribute ( google_api::file_upload_v2 ; "filesize" ) ] 

Set Variable [$curlOptions;
&" -H \"Content-Type: image/jpeg"
& " -H \"Content-Length: " & $length & "\""
& " -H \"Authorization: Bearer "  & API_tokens::access_token & "\""
& " -d @$file" ]

- - - - - - - - - 

Any guidance would be much appreciated! thanks a lot in advance for your valued time.



Link to post
Share on other sites


I have edited my curl following the advise from other users in a different forum and looks like this:

    & " -H \"Authorization: Bearer "  & API_tokens::access_token & "\""
    & " -H \"Content-Type: multipart/related; boundary=foo_bar_baz\""
    & " -H \"Content-Length: 119\"" & Char(13)&Char(10)
    & "--data-binary \"--foo_bar_baz" & Char(13)&Char(10) &
    "Content-Type: application/json; charset=UTF-8" & Char(13)&Char(10) &
    "--data-binary @$metadata" & Char(13)&Char(10) & Char(13)&Char(10) &
    "--foo_bar_baz" & Char(13)&Char(10)
    & "Content-Type: image/jpeg" & Char(13)&Char(10) & Char(13)&Char(10)
    & "--data-binary @$file\"" & Char(13)&Char(10)
    & "--foo_bar_baz--"

But Still I get the Malform multipart body...

Any suggestions how to fix this?

Thanks a lot,


Link to post
Share on other sites
Posted (edited)


4 hours ago, IdealData said:

Is the Content-Type correct?

If this is PDF should it be application/pdf?

Hi many thanks for your input.

I reviewed the code and the $metadata is json = {"mimeType":"image/jpeg","name":"file.jpeg"}

I am just trying to upload first a jpeg file on multipart POST, this is with the name and the type of file (extension). I found two articles in stackoverflow that first suggested to put the "char(13)&char(10)"  after each line inside the body, but I think I am not putting them in the correct place because as I play around I get errors. I am pretty sure it is about one " that I am not properly formating... but cant figure out what it is.

While there are plenty of demos out there for other Google Services, I wonder why I havent been able to find any tutorial for Google Drive, could it be that it cant be done without Plugin?

Thanks a lot to the community for any feedback :)


Edited by docasar
Link to post
Share on other sites

All of the curl commands require a space before them so,

& "--data-binary @$file\"" & Char(13)&Char(10)

should be

& " --data-binary @$file\"" & Char(13)&Char(10)

I'm not convinced you need the CR/LF pairs.

Also, have you tried running the curl command manually - from the command prompt?

Link to post
Share on other sites
  • 2 months later...
  • Newbies

Hi Docasar!!  What an interesting post... and EXACTLY what 'm trying to achieve as well.

Did you have any luck with this solution?  Were you able to connect FM to GoogleDrive?

I'd really like to save PDFs into a GDrive shared folder.

Can you share a sample file?  It would be HUGELY appreciated!!!


Cheers Tanya, from NZ

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Similar Content

    • By dancer5678
      I am using Filemaker Server 18 on Windows Server 2012 R2
      Been using it for years with no issues
      Currently when I log in to the console it is very sluggish.
      When I get to the Dashboard it shows No databases, then it auto refreshes and the database list appears.
      Within 15 seconds of scrolling the database list to open files the screen refreshes. This situations is happening over and over in a loop.
      Any Thoughts on what is causing this issue?
    • By stevaroni
      I get an error 3 when using a script to Export Records via WebDirect. Using FileMaker Server 18 and have tried both Safari and Chrome both with same results. I have tried using the temporary path, desktop path, and documents path. I have tried using with the automatically open and not. I have tried writing a tab delimited and comma delimited file. Does anyone have ideas I haven't yet tried?
    • By cheerfulzebra
      Hi All
      I am hoping some one can help!
      I have a table called TPM, in that table is a field "Next Due Date" Which is auto generated by creating a new record. You input the date you did the service and then it adds 3 months to that date and that appears in the Next Due Date Field.. All working...
      What I am trying to do is when the database loads it runs a script to see if there are any outstanding TPM Services to do...
      Here is the script
      Show Customer Dialog
      Message: If ( TPM::TPM Next Due Date < Get (CurrentDate ) ; "You have outstanding TPM services" ; "You have no outstanding services")
      I thought it would be that simple. So I created a TPM Due date Less that Current date and ran the script...."You have outstanding TPM Services"...GREAT! Then I deleted that record and ran the script again...""You have outstanding TPM Services" Oh!!! That isnt true!
    • By Kitesurfer
      Can someone please explain why Leftwords function is not properly working when importing an excell sheet.
      For example the name John Doe LeftWords ( Client ; 1 ) should show "John" only.
      When typing John Doe it works fine but not when importing ????
      Looking forward to a reply.
      Kind regards
    • By Pio Soto
      My issue is that my customer layout has a script trigger on LayOutEnter that sorts my customers portal list by "Active" customers,
      but when I do a go to related record from another table say from quotes or any other the customer layout does not load that customer
      or show my related customer because the OnLayoutEnter script trigger changes it, I would like it to go to the related customer and also sort it by "Active"
      on the list.
      Hope someone can help me with this.
  • Who Viewed the Topic

    16 members have viewed this topic:
    Quant  jon1009  doughemi  keywords  Steve Martino  Fitch  Lee Smith  comment  kingzcq  Nippon Maru  MikeKD  LaRetta  Aussie John  ericire  bruceR  Courtney 

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.