AnsweredAssumed Answered

FileMaker Data API - how to download container field using Insert from URL

Question asked by skywillmott on Jan 28, 2018
Latest reply on Apr 5, 2018 by alecgregory

I'm not sure if I'm missing something, maybe some particular cURL options are needed that I'm not using, but anyway, I am trying to use the Insert from URL script step to download a file from a container field in a FMS16 hosted file by using the URL given by the JSON result of the Data API, but can't get it to work.

 

For instance, the JSON returned from the Data API is something like:

 

{

  "data" :

  [

  {

  "fieldData" :

  {

  "myContainerField" : "https://myserver.com/Streaming_SSL/MainDB/58F59F18526716ED0D1CEB2A7B5BD2A9BD9F528DEC56A828F6F0C6FB4653C785?RCType=EmbeddedRCFileProcessor"

  },

  "modId" : "45",

  "portalData" : {},

  "recordId" : "3"

  }

  ],

  "errorCode" : "0",

  "result" : "OK"

}

 

I then try to use the 'Insert from URL' script step to download the file by using the URL given, but it doesn't work. I get a small file with HTML suggesting that the URL gets redirected...:

 

<html><head><title>Moved Temporarily</title></head><body><h1>302 Moved Temporarily</h1></body></html>

 

I have tried adding the '-L' option to the cURL options, but this didn't help... It did look like the file might be getting downloaded, but nothing is saved to the Container field in my local file.

 

The URL works when I copy and paste to a web browser, and it downloads the file, although it names the file as:

 

58F59F18526716ED0D1CEB2A7B5BD2A9BD9F528DEC56A828F6F0C6FB4653C785.dms

 

Renaming the file so it has it's proper file extension sorts it out and I can then open the file.

 

Any ideas on how to get this to work properly with 'Insert from URL' ??

 

I know I could work around this by using Base64 encoding and decoding for the transfer of the file, but would be great if I could use Insert from URL to directly download the container data from the hosted file.

Outcomes