Software tips, techniques, and news.

By Andrew Bosworth  Posted on  June 24th, 2020  in  Free Downloads, FileMaker

FileMaker BackBlaze Integration

BackBlaze is a large scale cloud storage platform that currently boasts an impressive 1 billion gigabytes of file data hosted on the cloud and counting. With its competitive pricing, BackBlaze makes a strong case for a place where you can store and retrieve large amounts of data at an affordable rate. Integrating your FileMaker application with BackBlaze’s B2 Cloud Storage API can assist moving external files to the cloud, minimizing file size growth and keeping your FileMaker application lightweight.

What You Need

In addition to owning a BackBlaze account, you will need to create a Bucket on your account page. A Bucket is a location where files can be stored, and you can upload files to the Bucket of your choosing. Following this, you will need to generate an application key with access to this Bucket to perform API calls. Please note that the information will only display once so please make sure to document it.

Authentication

You will need your application key and associated info you received on the BackBlaze account page to authenticate with the BackBlaze B2 Cloud Storage API. Authenticating successfully gives you an Authentication Token, an API Url, and a Download Url. These credentials are only valid for 24 hours, and after that they must be refreshed. Here is an example of a result:

{
  "absoluteMinimumPartSize": 5000000,
  "accountId": "d7afd9e250f5",
  "allowed": {
    "bucketId": "7db75acf7d99eeb275100f15",
    "bucketName": "FileMakerArticle",
    "capabilities": [
      "listBuckets",
      "readBuckets",
      "listFiles",
      "readFiles",
      "shareFiles",
      "writeFiles",
      "deleteFiles"
    ],
    "namePrefix": null
  },
  "apiUrl": "https://api002.backblazeb2.com",
  "authorizationToken": "4_002d7afd9e250f50000000001_01941816_6fa62b_acct_PQ6MJFWUoCp6159-dKFNBzBNM7g=",
  "downloadUrl": "https://f002.backblazeb2.com",
  "recommendedPartSize": 100000000
}

Uploading Files

Using the API Url from the authentication process and its associated credentials, you now need to generate an Upload Url. This Url is used to upload files onto your BackBlaze account. Much like the authentication process, this Url is only valid for 24 hours.

With the Upload Url in hand, you can now push container files from FileMaker into BackBlaze’s cloud storage. Your curl request should look something like this:

"-X POST " & ¶ & "-H \"Authorization: " & $uploadAuthToken & "\"" & ¶ & 
"-H \"X-Bz-File-Name: " & $fileNameEncoded & "\"" & ¶ & 
"-H \"Content-Type: b2/x-auto" & "\"" & ¶ & 
"-H \"X-Bz-Content-Sha1: " & $sha1 & "\"" & ¶ &
"-H \"X-Bz-Info-Author: unknown" & "\"" & ¶ & 
"--data-binary @$container"

A SHA1 Checksum is recommended when uploading your files to BackBlaze. This ensures that the file is not corrupted while in transit between FileMaker and the cloud. You can apply the following FileMaker function to generate a SHA1 checksum on a container.

HexEncode ( CryptDigest ( <<YourContainer>>; "SHA1" ) )

If your file was successfully uploaded, you should receive a response with a status of 200, indicating that your file was successfully uploaded to your bucket on BackBlaze. Additionally, a fileID will be passed alongside the response, which is that file’s unique identifier on your BackBlaze account. You will need this fileID to download that file from BackBlaze.

Additionally, successful uploads should display on your BackBlaze account.

Downloading Files

Using the Download Url from authentication in tandem with the fileID from your upload request, you can perform an API call to request a download of a specific file.  In the headers from the response you have access to BackBlaze’s SHA1 checksum as well, so you can compare it against what you have to see if there is any corruption.

Displaying Files In FileMaker

One thing you’ll want to keep in mind when working with the API is that you’ll need to store a representation of all the files as records in your FileMaker solution. In the sample file, we have a file table to store the document names, BackBlaze fileID, size, etc.

Conclusion

BackBlaze’s B2 Cloud Storage API allows you offload large amounts of file data from your FileMaker application to the cloud. With all your files stored on the cloud, you can keep your data size low, while also being able to easily access your files on the web. Contact us if you would like help integrating your BackBlaze account with your FileMaker application!

Did you know we are an authorized reseller for FileMaker Licensing?
Contact us to discuss upgrading your FileMaker software.

Download
Download the FileMaker BackBlaze Integration File
Please complete the form below to download your FREE FileMaker file.
FileMaker Experience *
Terms of Use *
OPT-IN: I agree that I am downloading a completely free FileMaker application file with no strings attached. This file is unlocked, and I may use it for my business or organization as I see fit. Because I am downloading a free file, I agree that I should receive occasional marketing. I understand that I can OPT-OUT of these emails at anytime.
Andrew Bosworth thumbnail
Andrew Bosworth

Andrew is a certified FileMaker and web developer with a penchant for building things, particularly custom applications to improve business efficiencies.

FileMaker 18 Certified Developer
FileMaker 17 Certified Developer
FileMaker 16 Certified Developer
FileMaker 15 Certified Developer
FileMaker 14 Certified Developer
FileMaker 13 Certified Developer
FileMaker 12 Certified Developer
FileMaker 11 Certified Developer
"We were actually able to add more features than we thought would be possible within our budget. We always experienced a ‘can do’ attitude and DB Services was incredibly patient and easy to work with."
Courtney Hartman
Art Director
"The new FileMaker custom website interface is very user-friendly and easy to follow for our clients. In addition, it is much faster than the old Instant Web Publishing (IWP) interface. Thank you and all the others who have helped us out at DB Services. I am very grateful for the excellent service you provide us. Its nice to know we can call you for help if we have an issue."
Wayne Capek
President
"We needed a solution that would simplify the administration of our responsibilities under our contract with the State of Indiana. We have seen a dramatic increase across the state in the number of potential foster and adoptive parents that have begun the preparation and training process. This increase has resulted in a significant opportunity for children available for adoption. That’s a big win for everyone! And it’s all because we can refer potential parents to the proper state contacts efficiently and quickly."
Chris Morrison
Executive Director
"Thank you for all of your expertise and valuable help. I am so grateful to have found DB Services."
Linda Findlay
Owner
"Thank you for our new database system. We transitioned from a carbon copy paper based system to a digital database. The software has saved us time and money. We used to archive all our jobs in cabinets, now we can look up a job in seconds from anywhere. The software allows us to easily email estimates to our customers in pdf format. In a year there was a return on investment just from eliminating the purchasing of our carbon forms."
Todd Cartmel
Owner
"The new system allows us to create and track jobs for customers along with inventory, something we had been doing with separate word and spreadsheet files. Because it’s now so intuitive, new staff members are able to begin using the database immediately without our usual training session and ‘cheat sheets’ for getting around within the file."
Tom Andrews
President