How can I get an original video file by public ID without knowning the file extension?

adedesko Member Posts: 1
edited June 2023 in Developer APIs


I'm using the Cloudinary Java SDK to generate URL's for videos. I have the public ID of a video and I am trying to generate a URL to get that video without applying transformations. I'm running into trouble because I don't have the file extension of the uploaded video and I have strict transformations enabled. The URL the SDK generates does not work because without the file extension Cloudinary tries to apply a transformation (called "/"?) which strict transformations forbids and so the request fails.

Here's an example:

I have a video with public ID: 1022915676-1684940661

I'm using this code to generate a URL:

final var videoUrl = cloudinary.url()

This produces:

When I GET that URL I receive a 401 back with the header:

x-cld-error: Transformation / is not allowed

Any help is appreciated. Thanks for reading!



  • Cloudinary Team
    Cloudinary Team Administrator, Cloudinary Staff Posts: 135 admin


    If you don't want to specify the format explicitly, you can try using the rawTransformation method in the Cloudinary Java SDK. This method allows you to provide a string representing the transformation parameters directly.

    Here's an example of how you can modify your code to include the rawTransformation method:

    final var videoUrl = cloudinary.url()
            .rawTransformation("")  // Provide an empty string to disable transformations

    By passing an empty string to the rawTransformation method, you disable any transformations that Cloudinary would apply by default. This will generate a URL for the video without any transformations, allowing you to access the original video without encountering the strict transformations error.

    But if the video does not have an extension it most likely won't work.

    The easiest way would be to append the extension to the video after it is uploaded.