API Key use

By: Jay Mac | Asked: 02/06/2023
Jay Mac asked 2 years ago
The support at Formidable will not explain how the API integration works or what use is the API Key. Does anyone have any experience. I cannot connect to AWS API Gateway. The API Keys in AWS are 20 chars min and Formidables keys are 18 chars and I assume that means I can't use the Formidable API key but the documentation does not explain how their API should be used. Any help would be appreciated   Thanks,
2 Answers
Victor Font answered 2 years ago
The API key is generated when you install the Formidable API add-on and is stored in the wp_options database table as frm_api_key. It has 19 characters by default and is used to secure your site and prevent unauthorized access to form entries by any API call not secured by your site's API key.
Victor Font replied 2 years ago

This information is all found in the Formidable knowledge, that continues:

"t would take billions of years to make a request via the API by guessing it with brute force. We do not use a password on top of the API key (in the examples below x is used as a placeholder). It is strongly recommended to use SSL ("https") on your server if you will be using the API add-on to send or receive requests."

Every API you request information from or send data to with the API add-on has some sort of authentication protocol. Your API key is the authentication for other sites to access your data. Likewise, for you to access Formidable data through a REST REQUEST to the remote site, you need that sites' api key to authenticate your request as legitimate.

Connecting to the AWS API means using their credentials in the API add-on action you add to your form. You may have to change the authentication message, or even write raw JSON to send your REST REQUEST.

Jay Mac replied 2 years ago

Victor thank you for your response. I did read the documentation. I actually have a form that connects that I built over a year ago. My new form does not connect and I cannot find any difference in either the form or the AWS API Gateway. The EC2 server, API gateway, and Lambda are all in the same vpc, so I'm going to try migrating this into a private API-Gateway and eliminate public traffic and the need for any tokens or credentials. My concern was that since the last time I built a form and the API gateway, formidable changed something in the code that could have affected how it works. Since the documentation hadn't changed I was hoping Formidable support would confirm that but they just responded with the standard response go to Codeable.

Victor Font replied 2 years ago

Formidable does not support custom setups, which is why they say go to Formidable Masterminds, Codeable, or here.

There's no readme.txt information about API add-on releases so we don't know if anything in the code base changed. The current version is 1.13. But if the code base changed, why is your original form still working if you've been keeping the site updated? I think something is missing or not configured correctly somewhere.

Jay Mac answered 2 years ago
This is resolved. I created a VPC endpoint in AWS and since my ec2 WP server is in the same VPC as my API Gateway and Lambda Function I created a PRIVATE API Gateway that does not need validation tokens or any other permissions as the API call never leaves the AWS backbone and does not go out to the public internet. The API gateway does have its own resource policy. I tested with a curl command first on the ec2 server and then in a form. I can't use Postman as it only has a command line utility for linux and didn't want to learn yet another thing.  The curl command to test was:  curl -X POST https://{yourapiid}.execute-api.[your aws region}.amazonaws.com/test -H 'content-type: application/json' -d '{"ID": 1001","blockName": "block1","blockDescription": "block1 description","aliasUserID": "dawgdawg","wpMediaID": "1234","blockType": "png","blockSize": 45,"blockWidth": 5.4,"blockHeight": 4.15,"blockSiteURL": "https://www.savingsinthecloud.com/","blockQuestionID": 1234,"s3URL": "https://my-media-102222.s3.us-west-2.amazonaws.com/"}'    

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right