request-data processor

request-data processor can be used to find the data from query string and named-path parameters or from request body.

Query Parameters

curl ''
In above example url contains query parameter message with value hello world. We can access this value in ftd file as like below by calling request-data processor.
-- import: fastn/processors as pr

-- record r-data:
string message:

-- r-data data:
$processor$: pr.request-data

-- ds.markdown: $data.message
Please note that all the parameters defined in the record must be present. If you have not specified the default value to any of the record fields, they will not be used if the parameter is missing in the request. RFC #832 is to fix this behaviour.

Named Parameters In Dynamic URLs

When using dynamic URLs, the named parameters can also be extracted using the same method:
-- fastn.dynamic-urls:

# RD Test:
  url: /rd-test/<string:message>/
  document: ftd-host/r.ftd
The same code used above will get the data from URL as well if someone visits, say, /rd-test/hello/, the value data.message would be hello.


If the request body is not empty, and has content type application/json, the body is parsed as JSON and the fields in your record are looked in the JSON as well.

Note On Priority

If a field is present in more than one places, the JSON value is preferred over the named URL pattern, which itself is preferred over the query string.

Support fastn!

Enjoying fastn? Please consider giving us a star ⭐️ on GitHub to show your support!

Getting Help

Have a question or need help?

Visit our GitHub Q&A discussion to get answers and subscribe to it to stay tuned.

Join our Discord channel and share your thoughts, suggestion, question etc.

Connect with our community!

Found an issue?

If you find some issue, please visit our GitHub issues to tell us about it.

Join us

We welcome you to join our Discord community today.

We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.
Copyright © 2023 -