Skip to main content
Bogriceanu_Sorin
New Participant
Feb 7, 2024 10:18 AM UTC
Solved

Get the curent file version trough the Plugin API

Hello,

Is there a way to get the current file version in the Plugin API?

In the docs, I only found the function to save a new version, but nothing on getting the version.

My workaround would be the REST API versions endpoint looped trough a lambda function… but it seems schetchy… 🫣

Thanks!

This topic has been closed for replies.
tank666
tank666Solution
Feb 7, 2024 11:29 AM UTC

Thanks for the clarifications. Unfortunately, using the Plugin API you can only get the new version ID, as you described, when saving the version. There are no other ways.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank

4 replies

tank666
Feb 7, 2024 10:54 AM UTC

Plugin API always displays the latest version of the file. To access previous versions you need to use the REST API, as you are doing.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Bogriceanu_Sorin
New Participant
Feb 7, 2024 11:01 AM UTC

I don’t need to change the version, I only need to get the version ID.

… as I am writing this, I realized I could just create a new version and use the returned response to collect the versionID

Maybe some background would help… 🙂

I am creating some artefacts in the file. A few of them get synced into an external DB, more or less like a wiki. I was tring to cover the case where my created assets get modified in Figma.

If I keep the file version when I created them, I can DIFF and go back to the original if required.

… does this make any sense? 😕

tank666
tank666Solution
Feb 7, 2024 11:29 AM UTC

Thanks for the clarifications. Unfortunately, using the Plugin API you can only get the new version ID, as you described, when saving the version. There are no other ways.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank
Bogriceanu_Sorin
New Participant
Feb 7, 2024 11:36 AM UTC

Thanks for the response 😃