5 Replies Latest reply on Apr 3, 2017 11:07 PM by nickorr

    Unsuccessful when using BE_HTTP_POST to Post x-www-form-urlencoded with post fields in the payload

    philipHPG

      I'm attempting to interface our FileMaker database with a new API. We have successfully used the BaseElements plugin to interface with another API, which went fairly smoothly, but this one is a little bit more complicated. To obtain a token the API requires a Post with a Content-Type of "application/x-www-form-urlencoded" and a payload of "grant_type=client_credentials" as post fields. I'm using the following script steps:

       

      Screen Shot 2017-03-29 at 2.26.15 PM.png

      (I'm not sure that line 15 is necessary, but I introduced it, hoping to push curl to use the CURLOPT_POSTFIELDS option.)

       

      Unfortunately I get a response of "Incorrect Content-Type. Only application/x-www-form-urlencoded is allowed."

       

      I was able to successfully complete an API call using Postman and from comparing that request to the info from BE_Curl_Trace it appears that the BE_HTTP_POST request is sending multipart form data (there is a Content-Length header field added and then a separate Send data line whereas with Postman the post fields are sent directly). The API documentation indicates to use CURLOPT_POSTFIELDS, but I don't see an option for that with BE.

       

      Am I missing something or is this beyond what the BaseElements plugin is capable of doing and I need to look into other options (MBS)?

       

      Thanks,

       

      Philip