The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
API Post Params vs. Body
Greetings! I am using the twilio api to send a text via a http post.
I have purchased the Formidable API Add-On to make this happen (Yes, I do realize there is another add-on to use Twilio SMS).
However, I have crafted my http post URL, and it works in Postman. However, it only works when I add the required parameters to the Body (in Postman) using a x-www-form-urlencoded format, when I add them as params, I get a 400 error.
I am getting the same exact error in Formidable.
I am assuming the formidable "Key" and "Value" fields add the contents as Parameters, not Body.
How do I get around this? Thank you!
Example screen shots from each software attached
January 5, 2019 at 1:11 am
Hi Collin,
I think you forgot to attach the screenshots. It will be easier for me to help.
January 5, 2019 at 8:06 am
API posts are done using JSON, but if I understand you properly, are you saying that you are using a query string?
A 400 error means the HTTP request isn't formatted properly. I suggest you install the logging plugin to help with your troubleshooting: https://formidableforms.com/downloads/logs/
You can also use the Network tab in your browser's dev tools to view the header request/response activities in real time.
January 5, 2019 at 8:30 am
Thank you both for the replies. Here is a image that will hopefully paint a better picture. To further clarify, the auth is in the url; I did try this both ways. I was able to get it to work in postman (see below) using basic auth in the URL, so I kept it that way
Attachment:
January 5, 2019 at 9:08 am
I wouldn't use the API credentials in the url. I would place them in the Basic Auth field as required by the plugin.
If you look at the API log plugin results, you're probably receiving and authentication error. My experience with Postman vs. Formidable API is the most common issues are authentication and field validation. Your screen print is clearly showing a validation error. Postman is a good testing tool, but the Postman results have never reflected what's actually going on in the API.
January 5, 2019 at 9:20 am
vfontjr - Thanks again, please see the result of the changes in the image below. 400 error bad request. I have to think that it has to do with the placement of the parameters in the body (x-www-form-urlencoded format) vs. how formidable is sending it in JSON.
Attachment:
January 6, 2019 at 7:15 am
You're still adding the account to the URL. If you look at the docs for the Twilio Add-on instead of the API add-on, there is no URL to enter. I think you should use the right add-on, the one designed for Twilio, https://formidableforms.com/knowledgebase/twilio-add-on/
Discussion closed.