BackBlaze Integration logo

BackBlaze Integration

DB Services

Summary

Product Type: Apps

Price: Free

Last updated: 6/24/2020

Language: English

Product website

Category

Upload and download files to the cloud from FileMaker.

Upload and download files to the cloud from FileMaker by integrating with the BackBlaze.

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.

BackBlaze App Key Info
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 ( <>; "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.

BackBlaze File Display
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 rec

Additional resources

Claris product features

See why Claris products are the top choice for developers for their low code needs.

See features

Product resources

Get instant access to helpful resources and start creating custom apps today.

Get resources