File extensions as path variables

I am working on an API that allows a user to get a thumbnail representation of a file.

GET /files/:id/thumbnail.:extension

As you can see, the extension is a variable that can either be jpg or png. I’ve been able to model this just fine in our OAS3 file but it seems like Postman doesn’t recognise this path variable. Does anyone know how I could achieve this in Postman?

I have a way you can do it in Postman, but I’m not 100% sure on the implications it would have on your OAS3 spec.

Pull the word thumbnail into your path variable and concatenate your environment variable to it

Yeah that’s what I was thinking of too.

Seems like a hack though to work around Postman’s limitations.

It also messes with the OpenAPI spec, as now the path matches another path to some degree.

Another way you could go is that if the thumbnail can be either jpg or png like you said, you can extend the route and still be RESTful

/files/:id/thumbnails/:extension
or
/files/:id/thumbnails/extensions/:extension

Ha. Sadly this API has been out for a while and I do not control making that change.