AnsweredAssumed Answered

Any good tutorials & tips for v17 Data API?

Question asked by skywillmott on May 15, 2018
Latest reply on Nov 25, 2018 by mdenyse

Just wondering if anybody has any good tutorials and tips for using the new version Data API with Server 17?


I'm particularly interested in how to handle upload of files stored in container fields in local FileMaker files in FileMaker Go to container fields in a FMS17 hosted file using the new container upload functionality in the Data API.


One of the things I have found is that using the cURL option of:


-F upload=@$myFile


...results in the uploaded file being named as just 'myFile', i.e. the same name as the variable, rather than the name of the original file, which means that images do not display correctly etc.


To get around this, then I have used a technique outlined by Mike Duncan at Soliant - FileMaker 16: cURL and Container Fields | Soliant Consulting  - which results in the variable name being the same as the original file name, albeit with some character substitutions to avoid non-valid variable naming, e.g. spaces are replaced with underscores,  commas removed, etc.


This works great, and files such as images and PDFs display in the hosted file's container fields just fine - thank you Mike :-)


I also realise there are other ways to handle it, such as renaming the file stored in the hosted file's container by using a script to base64Encode/Decode the file and giving it a new file name that way - the script can now be triggered by the Data API itself which is nice :-)


So, just wondering if anybody else has any more insights on this?