Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

cURL transformation on FileMaker Pro 16

Featured Replies

  • Newbies

imageproxy.php?img=&key=b0a00e4a1cc52ac1

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 by katok

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.