Is it possible to call a function with a path as a parameter instead of a query string?

I’m building a tool to test different combinations of markup for generating link previews. e.g. oEmbed, Open Graph, Twitter Cards etc. As there are too many possible combinations of markup to generate static pages, I’m generating the pages with Netlify Functions.

I’m worried some websites will cache the results of a page, even if it has a different query string.

So instead of doing sending a request to:

https://mysite.com/.netlify/functions?oembed=true&opengraph=true

is it possible to do something like:

https://mysite.com/.netlify/functions/oembed-opengraph

?

Yes it is! But a caveat to be aware of: we do not intend to cache function responses based on query params: Netlify Function with query strings ignores custom Cache-Control header - #22 by jen For some people, this is ideal… for others, it’s a dealbreaker.

You should be able to access your query params within the function with event.queryStringParameters- please let us know if that doesn’t work for you or you have any other questions!