Newbies katok Posted February 27, 2018 Newbies Posted February 27, 2018 (edited) Hello, I think I'm about to understand things around REST API and how to use them from my terminal when I see APIs documentation. I'm fighting a lot with the use of quotes when I want to use them from a FileMaker file. For example the following code works very well from my terminal (it's an example that you can try from IBM watson): (It's a text-to-speech service that provide a sound file made with the text you sent) curl -X POST -u login:password \ --header "Content-Type: application/json" \ --header "Accept: audio/wav" \ --data "{\"text\":\"My name is Christophe\"} " \ --output hello_world.wav \ "https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize" This works perfectly and the file is downloaded in my user folder So I tried to translate all this in a FileMaker script like this: Set Variable [ $File; Value:Test::FileToDownload ] // Test::FileToDownload is a container field Set Variable [ $cURLOption; Value:"-X POST -u login:password --header \"Content-Type: application/json\" --header \"Accept: audio/wav\" --data \"{\"text\":\"My name is Christophe\"}\" --output @$File" ] Set Variable [ $URL; Value:"https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize" ] Insert from URL [ $Result; $URL; cURL options: $cURLOption ] [ Select; No dialog ] The answer in $result is : { "code_description": "Bad Request", "code": 400, "error": "Expecting object: line 1 column 1 (char 0)" } I don't know if I'm far away from finding (and understanding) the right way to do but if anybody has an idea, I would be really glad Thanks in advance. Christophe Edited February 27, 2018 by katok
bcooney Posted February 27, 2018 Posted February 27, 2018 Check out this demo file: https://www.colibrisolutions.com/single-post/2017/06/01/FileMaker-Meet-Watson
Recommended Posts
This topic is 2808 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now