I am working on integrating Figma's API to automate certain tasks, specifically adding images into nodes within Figma files. The process involves using Make.com to send API requests to Figma to modify a node (for example, inserting an image into a rectangle).
I am using Google Drive to upload the image generated from ChatGPT and then obtaining a URL to insert it into Figma. Could this be causing the issue, or is the problem related only to the API?
I have successfully set up the API calls for retrieving file content and getting node information using the GET method, and I am able to retrieve the necessary data from Figma. However, when attempting to send a PATCH request to modify a node (inserting an image into a rectangle), I face an error.
The problem:
-
Error 404 (Not Found): When attempting to use a PATCH request to modify the node by adding an image, I receive a 404 Not Found error. This occurs even though I can retrieve the file and node data via GET successfully.
-
Possible Cause: The error might be due to insufficient permissions associated with my account or missing scopes for the PATCH request. The account currently being used may not have the necessary permissions to modify the files (such as adding images) through the API.
-
Request Structure: The request includes a URL similar to:
bash
Copier
https://api.figma.com/v1/files/{file_id}/nodes/{node_id}
where the file_id and node_id seem correct. The body of the request contains the necessary image data:
json
Copier
{ "fills": [ { "type": "IMAGE", "scaleMode": "FILL", "imageRef": "https://drive.google.com/uc?export=download&id=1r9iO9c7Xblmw1thgBN7bzEY8_1yH7HdZ" } ] }
Despite this, the request does not succeed.
Questions for Support:
-
Is it possible to modify files and nodes (such as inserting images) via the API with a standard account, or is this feature restricted to Figma Enterprise accounts?
-
Does the
file_content:write
scope, necessary for modifying files, require a specific type of account (Team or Enterprise) for access? -
If the API should work with a standard account, are there any additional configurations or permissions required to allow modification via the PATCH method?