Skip to main content
Solved

Include "scoping" settings on API response

  • July 11, 2023
  • 1 reply
  • 383 views

Daniel_C

I’m writing a script to transform Figma Variables into design tokens, and I need to differentiate between different types of tokens.

The API is returning me this structure for the variables:

"VariableID:209:1372": {
  "id": "VariableID:209:1372",
  "name": "spacing-xs",
  "remote": false,
  "key": "490e2217721624da15c389ac089a09b2cfc8ffe4",
  "variableCollectionId": "VariableCollectionId:209:1371",
  "resolvedType": "FLOAT",
  "valuesByMode": { "209:3": 8, "209:4": 16, "209:5": 2 }
}

The “resolvedTokenType” field is useful, but only to an extent. The numeric variables can represent many different things: border radius, spacing, sizing, etc. I would like to be able to identify the intended use of the variable from the meta data associated with it.

One very useful piece of information would be the “scoping” of the variable:

image

This would help me narrow down the specificity of the token, but I can’t seem to find it on the response from the API. I’m using the GET /v1/files/:file_key/variables/local ¿is there other endpoint I can use to get that data?

If not, it would be great for the next version of the API to have the “scoping” of the variable to give that extra bit of information for the applications reading this data.

Best answer by James_Yang

Hi Daniel, we definitely plant to add scoping information to the GET /v1/files/:file_key/variables/local endpoint.

View original
This topic has been closed for replies.

1 reply

James_Yang
Figmate
  • Figmate
  • 82 replies
  • Answer
  • July 11, 2023

Hi Daniel, we definitely plant to add scoping information to the GET /v1/files/:file_key/variables/local endpoint.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings