I am able to capture submissions from a regular HTML form, however if I replicate the POST with JSON I get the following "Template not found" error.
Template not found: sprout-forms/entries/save-entry
1. in /var/www/Applications/vendor/craftcms/cms/src/controllers/TemplatesController.php
at line 70 61626364656667686970717273747576777879
* @param string $template
* @param array $variables
* @return Response
* @throws NotFoundHttpException if the requested template cannot be found
*/
public function actionRender(string $template, array $variables = []): Response
{
// Does that template exist?
if (!$this->getView()->doesTemplateExist($template)) {
throw new NotFoundHttpException('Template not found: ' . $template);
}
// Merge any additional route params
$routeParams = Craft::$app->getUrlManager()->getRouteParams();
unset($routeParams['template'], $routeParams['template']);
$variables = array_merge($variables, $routeParams);
return $this->renderTemplate($template, $variables);
}
2. craft\controllers\TemplatesController::actionRender('sprout-forms/entries/save-entry', [])
....
11. in /var/www/Applications/web/index.php at line 21 – yii\base\Application::run() 15161718192021
(new Dotenv\Dotenv(CRAFT_BASE_PATH))->load(); } // Load and run Craft define('CRAFT_ENVIRONMENT',
getenv('ENVIRONMENT') ?: 'production'); $app = require
CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php'; $app->run();
I have disabled CSRF for now in the hope of taking that out of the equation.
I believe I have replicated the HTML form request with a JSON POST using Postman but am hitting a dead-end. Any assistance with debug steps, or a sample Postman config to a working solution would be hugely appreciated.