-
Notifications
You must be signed in to change notification settings - Fork 1
API Form Handling
The contact form is located at https://www.sdgreporting.org/contact/.
When a contact form submission is received by the API, some basic input sanitation procedures are performed before inserting the submitted data into a formatted e-mail, which is then sent out to the proper (i.e. configured) e-mail address.
The URL that the contact form submits to can be set via Jekyll's configurations.
The forms both look for a setting called api_url
to provide the base URL for the API, and then submits via a POST
request to their respective endpoints (contact_form
or submission_form
). The base API URL is currently the only setting in this project that is handled via Jekyll's configuration system.
Since this setting likely depends on your deployment environment, it's best if there are separate environment-specific configuration files for each type of deployment environment.
The current convention I use for naming each environment-specific file follows the format of config-environment.yml
. For example, config-development.yml
should contain local development settings.
The resource submission form is located at https://www.sdgreporting.org/submit-resource/.
This works much the same way that the contact form does. A POST
request is sent to the submission-form
endpoint upon form submission.
When a resource submission form is received by the API, the data is passed through some basic input sanitation procedures before being compiled into records to be written to the database.
After the records are written, the data is inserted into a formatted alert e-mail, which is then sent to the configured address.