Forum Discussion

AmanSingh's avatar
AmanSingh
Explorer | Level 3
4 years ago

invalid_revision error while restoring file version through api

 

I am trying to restore file to an older version through API but it throws the error as shown in the picture.
What can be best solution to use through API ?

Hope for the quick reply.

Thanks & Regards
Aman

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    The /2/files/restore endpoint is the right way to restore a previous version of a file. An 'invalid_revision' error like that should indicate that the value you supplied in the "rev" parameter isn't usable though, e.g., it's not an actual revision value, or it refers to a version that cannot be restored (e.g., because it doesn't exist anymore).

     

    If something's not working as expected/documented, I'll be happy to look into it, but I'd need some more information. In that case, reply with:

    • the name and version number of the SDK/library you are using, if any
    • the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)
    • the full text of any error or unexpected output
    • AmanSingh's avatar
      AmanSingh
      Explorer | Level 3

      Hi,
      Thanks for the response.

      Actually I am trying to restore a deleted file through this API.
      But its showing this "invalid_revision" error.
      Also the file I am trying to restore is deleted within 30 days. (2-3 days before)

      What can be the reason, anything to help here?

      I am using Dropbox Java SDK v4.0.1
      Error message I am getting - Exception in 2/files/restore: "invalid_revision"

      • Здравко's avatar
        Здравко
        Legendary | Level 20

        AmanSingh wrote:

        ...
        Error message I am getting - Exception in 2/files/restore: "invalid_revision"


        Hi AmanSingh,

        How and where did you get the revision from, that gets refused here as an invalid? 🤔 Can you describe exact steps or, as Greg-DB has mentioned above, share some code snippet reproducing the issue?