{"id":717,"date":"2025-08-10T10:22:00","date_gmt":"2025-08-10T01:22:00","guid":{"rendered":"https:\/\/cg-method.com\/figma\/?p=717"},"modified":"2025-08-10T10:22:01","modified_gmt":"2025-08-10T01:22:01","slug":"figma-rest-api-plugin-api-data-list","status":"publish","type":"post","link":"https:\/\/cg-method.com\/figma\/figma-rest-api-plugin-api-data-list\/","title":{"rendered":"Figma\u2502Web API\uff08REST API\uff09\u3068Plugin API\u3067\u53d6\u5f97\u3067\u304d\u308b\u30c7\u30fc\u30bf\u3068\u6a5f\u80fd\u307e\u3068\u3081"},"content":{"rendered":"\n<p>Figma \u306b\u306f <strong>Web API\uff08REST API\uff09<\/strong> \u3068 <strong>\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\uff0fWeb\u30a2\u30d7\u30ea\u4e0a\u3067\u52d5\u4f5c\u3059\u308b Plugin API<\/strong> \u306e2\u3064\u306e\u958b\u767a\u7528\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u4e21\u8005\u3068\u3082Figma\u30d5\u30a1\u30a4\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u304c\u3001\u300c\u53d6\u5f97\u3067\u304d\u308b\u30c7\u30fc\u30bf\u306e\u7a2e\u985e\u300d\u3084\u300c\u63d0\u4f9b\u3055\u308c\u308b\u6a5f\u80fd\u300d\u306f\u7570\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001\u305d\u308c\u305e\u308c\u306eAPI\u3067<strong>\u53d6\u5f97\u53ef\u80fd\u306a\u30c7\u30fc\u30bf\u3084\u6a5f\u80fd\u3092\u3001\u4f53\u7cfb\u7684\u30fb\u7db2\u7f85\u7684\u306b\u5206\u985e\u3057\u3066<\/strong>\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>1. \u30d5\u30a1\u30a4\u30eb\u5168\u4f53\u306e\u30e1\u30bf\u30c7\u30fc\u30bf<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>\u9805\u76ee<\/strong><\/th><th><strong>REST API<\/strong><\/th><th><strong>Plugin API<\/strong><\/th><\/tr><\/thead><tbody><tr><td>\u30d5\u30a1\u30a4\u30eb\u540d<\/td><td>\u25cb GET \/files<\/td><td>\u25cb figma.root.name<\/td><\/tr><tr><td>\u30d5\u30a1\u30a4\u30eb\u30ad\u30fc\uff08file_key\uff09<\/td><td>\u25cb<\/td><td>\u25cb\uff08figma.fileKey\uff09<\/td><\/tr><tr><td>\u6700\u7d42\u66f4\u65b0\u65e5\u6642<\/td><td>\u25cb lastModified<\/td><td>\u00d7<\/td><\/tr><tr><td>\u30d0\u30fc\u30b8\u30e7\u30f3\u5c65\u6b74<\/td><td>\u25cb GET \/files\/{key}\/versions<\/td><td>\u00d7<\/td><\/tr><tr><td>\u30b5\u30e0\u30cd\u30a4\u30ebURL<\/td><td>\u25cb thumbnailUrl<\/td><td>\u00d7<\/td><\/tr><tr><td>\u6240\u5c5e\u30c1\u30fc\u30e0\uff0f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u60c5\u5831<\/td><td>\u25cb GET \/teams \/ GET \/projects<\/td><td>\u00d7<\/td><\/tr><tr><td>\u30d5\u30a1\u30a4\u30eb\u5171\u6709\u30ea\u30f3\u30af<\/td><td>\u25cb\uff08file_key\u304b\u3089\u751f\u6210\uff09<\/td><td>\u00d7<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>curl -X GET \\\n  &quot;https:\/\/api.figma.com\/v1\/files\/{FILE_KEY}&quot; \\\n  -H &quot;X-Figma-Token: ${FIGMA_TOKEN}&quot;\n# \u30dd\u30a4\u30f3\u30c8:\n# - FIGMA_TOKEN \u306f\u500b\u4eba\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\n# - \u5fdc\u7b54\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u3001\u6700\u7d42\u66f4\u65b0\u65e5\u6642\u3001thumbnailUrl\u3001\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30c4\u30ea\u30fc\u306a\u3069\u304c\u542b\u307e\u308c\u308b<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>\/\/ \u5b9f\u884c\u524d\u306b process.env.FIGMA_TOKEN \u3068 FILE_KEY \u3092\u8a2d\u5b9a\nconst res = await fetch(`https:\/\/api.figma.com\/v1\/files\/${FILE_KEY}`, {\n  headers: { &#39;X-Figma-Token&#39;: process.env.FIGMA_TOKEN }\n});\nconst data = await res.json();\nconsole.log({\n  name: data.name,\n  lastModified: data.lastModified,\n  thumbnailUrl: data.thumbnailUrl\n});\n\/\/ \u6ce8\u610f: thumbnailUrl \u306f\u6052\u4e45\u7684\u3002\u30ce\u30fc\u30c9\u753b\u50cfURL\u306f\u4e00\u6642\u7684\uff08\u5f8c\u8ff0\uff09<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>\/\/ \u73fe\u5728\u958b\u3044\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u540d\u3084 fileKey \u306f\u53d6\u5f97\u53ef\nconsole.log(&#39;file name:&#39;, figma.root.name);\nconsole.log(&#39;file key:&#39;, figma.fileKey);\n\/\/ \u6ce8\u610f: \u30d5\u30a1\u30a4\u30eb\u306e\u6700\u7d42\u66f4\u65b0\u3084\u30d0\u30fc\u30b8\u30e7\u30f3\u4e00\u89a7\u3001\u30b5\u30e0\u30cd\u30a4\u30ebURL\u306f Plugin API \u304b\u3089\u306f\u76f4\u63a5\u53d6\u5f97\u4e0d\u53ef<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>2. \u30b3\u30e1\u30f3\u30c8\u60c5\u5831<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>\u9805\u76ee<\/strong><\/th><th><strong>REST API<\/strong><\/th><th><strong>Plugin API<\/strong><\/th><\/tr><\/thead><tbody><tr><td>\u30b3\u30e1\u30f3\u30c8\u53d6\u5f97<\/td><td>\u25cb GET \/files\/{key}\/comments<\/td><td>\u00d7<\/td><\/tr><tr><td>\u30b3\u30e1\u30f3\u30c8\u6295\u7a3f<\/td><td>\u25cb POST \/files\/{key}\/comments<\/td><td>\u00d7<\/td><\/tr><tr><td>\u30b3\u30e1\u30f3\u30c8\u524a\u9664<\/td><td>\u25cb DELETE \/comments\/{id}<\/td><td>\u00d7<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>curl -X GET \\\n  &quot;https:\/\/api.figma.com\/v1\/files\/{FILE_KEY}\/comments&quot; \\\n  -H &quot;X-Figma-Token: ${FIGMA_TOKEN}&quot;\n# \u8fd4\u5374: comments[]\uff08id, message, created_at, user \u306a\u3069\uff09<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>curl -X POST &quot;https:\/\/api.figma.com\/v1\/files\/{FILE_KEY}\/comments&quot; \\\n  -H &quot;X-Figma-Token: ${FIGMA_TOKEN}&quot; \\\n  -H &quot;Content-Type: application\/json&quot; \\\n  -d &#39;{\n    &quot;message&quot;: &quot;\u3053\u306e\u30dc\u30bf\u30f3\u306e\u89d2\u4e38\u3092+4px\u306b&quot;,\n    &quot;client_meta&quot;: { &quot;x&quot;: 120, &quot;y&quot;: 300 }  \/\/ \u30ad\u30e3\u30f3\u30d0\u30b9\u5ea7\u6a19\u306b\u30d4\u30f3\u7559\u3081\n  }&#39;\n# \u6ce8\u610f: \u5ea7\u6a19\u306f\u30da\u30fc\u30b8\uff0f\u30ba\u30fc\u30e0\u306b\u4f9d\u5b58\u3002client_meta \u7701\u7565\u3082\u53ef<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>curl -X DELETE \\\n  &quot;https:\/\/api.figma.com\/v1\/comments\/{COMMENT_ID}&quot; \\\n  -H &quot;X-Figma-Token: ${FIGMA_TOKEN}&quot;<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>3. \u30da\u30fc\u30b8\u30fb\u30ec\u30a4\u30e4\u30fc\u69cb\u9020<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>\u9805\u76ee<\/strong><\/th><th><strong>REST API<\/strong><\/th><th><strong>Plugin API<\/strong><\/th><\/tr><\/thead><tbody><tr><td>\u30da\u30fc\u30b8\u4e00\u89a7<\/td><td>\u25cb\uff08\u30d5\u30a1\u30a4\u30eb\u69cb\u9020JSON\u5185\uff09<\/td><td>\u25cb\uff08figma.root.children\uff09<\/td><\/tr><tr><td>\u30ce\u30fc\u30c9\u968e\u5c64\u53d6\u5f97<\/td><td>\u25cb\uff08\u5168\u30da\u30fc\u30b8\u69cb\u9020\uff09<\/td><td>\u25cb\uff08\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u30a2\u30af\u30bb\u30b9\uff09<\/td><\/tr><tr><td>\u30ce\u30fc\u30c9ID<\/td><td>\u25cb<\/td><td>\u25cb<\/td><\/tr><tr><td>\u30ce\u30fc\u30c9\u540d<\/td><td>\u25cb<\/td><td>\u25cb<\/td><\/tr><tr><td>\u30ce\u30fc\u30c9\u7a2e\u5225\uff08FRAME, RECTANGLE\u306a\u3069\uff09<\/td><td>\u25cb<\/td><td>\u25cb<\/td><\/tr><tr><td>\u30ce\u30fc\u30c9\u4f4d\u7f6e\u30fb\u30b5\u30a4\u30ba<\/td><td>\u25cb<\/td><td>\u25cb<\/td><\/tr><tr><td>\u30ce\u30fc\u30c9\u53ef\u8996\u6027\uff08visible\uff09<\/td><td>\u25cb<\/td><td>\u25cb<\/td><\/tr><tr><td>\u30ce\u30fc\u30c9\u30b9\u30bf\u30a4\u30ebID<\/td><td>\u25cb<\/td><td>\u25cb<\/td><\/tr><tr><td>\u30ce\u30fc\u30c9\u7de8\u96c6<\/td><td>\u00d7<\/td><td>\u25cb\uff08node.resize() \u306a\u3069\uff09<\/td><\/tr><tr><td>\u30ce\u30fc\u30c9\u4f5c\u6210\u30fb\u524a\u9664<\/td><td>\u00d7<\/td><td>\u25cb<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-js\" data-lang=\"JavaScript\"><code>\/\/ \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u30c4\u30ea\u30fc\uff08\u5de8\u5927JSON\uff09\u304b\u3089\u30da\u30fc\u30b8\u3084\u30ec\u30a4\u30e4\u30fc\u3092\u8d70\u67fb\nconst res = await fetch(`https:\/\/api.figma.com\/v1\/files\/${FILE_KEY}`, {\n  headers: { &#39;X-Figma-Token&#39;: process.env.FIGMA_TOKEN }\n});\nconst { document } = await res.json(); \/\/ document.children[] \u304c\u30da\u30fc\u30b8\nconst pages = document.children.map(p =&gt; ({ id: p.id, name: p.name, type: p.type }));\nconsole.log(pages);\n\/\/ \u6ce8\u610f: REST\u306f\u8aad\u307f\u53d6\u308a\u5c02\u7528\u3002\u7de8\u96c6\u306f\u4e0d\u53ef<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>\/\/ \u30da\u30fc\u30b8\u5217\u6319\nfor (const page of figma.root.children) {\n  console.log(&#39;page:&#39;, page.name, page.id);\n}\n\n\/\/ \u30ce\u30fc\u30c9\u53d6\u5f97\u3068\u7de8\u96c6\uff08\u6700\u5c0f\u4f8b\uff09\nconst rect = figma.createRectangle();\nrect.name = &#39;\u751f\u6210\u3057\u305f\u56db\u89d2\u5f62&#39;;\nrect.resize(200, 100);\nrect.fills = [{ type: &#39;SOLID&#39;, color: { r: 0.2, g: 0.6, b: 1 } }];\nfigma.currentPage.appendChild(rect);\n\n\/\/ \u9078\u629e\u30ce\u30fc\u30c9\u306e\u57fa\u672c\u30d7\u30ed\u30d1\u30c6\u30a3\u53c2\u7167\nconst sel = figma.currentPage.selection[0];\nif (sel) {\n  console.log(sel.name, sel.width, sel.height, sel.type);\n}<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>4. \u30b9\u30bf\u30a4\u30eb\u30fb\u30a2\u30bb\u30c3\u30c8<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>\u9805\u76ee<\/strong><\/th><th><strong>REST API<\/strong><\/th><th><strong>Plugin API<\/strong><\/th><\/tr><\/thead><tbody><tr><td>\u30ab\u30e9\u30fc\u30b9\u30bf\u30a4\u30eb<\/td><td>\u25cb GET \/files\/{key}\/styles<\/td><td>\u25cb figma.getLocalPaintStyles()<\/td><\/tr><tr><td>\u30c6\u30ad\u30b9\u30c8\u30b9\u30bf\u30a4\u30eb<\/td><td>\u25cb<\/td><td>\u25cb<\/td><\/tr><tr><td>\u30a8\u30d5\u30a7\u30af\u30c8\u30b9\u30bf\u30a4\u30eb<\/td><td>\u25cb<\/td><td>\u25cb<\/td><\/tr><tr><td>\u30b0\u30ea\u30c3\u30c9\u30b9\u30bf\u30a4\u30eb<\/td><td>\u25cb<\/td><td>\u25cb<\/td><\/tr><tr><td>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u4e00\u89a7<\/td><td>\u25cb GET \/files\/{key}\/components<\/td><td>\u25cb figma.getLocalComponents()<\/td><\/tr><tr><td>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u30a4\u30f3\u30dd\u30fc\u30c8<\/td><td>\u00d7<\/td><td>\u25cb importComponentByKeyAsync()<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># \u30d5\u30a1\u30a4\u30eb\u5185\u30b9\u30bf\u30a4\u30eb\u4e00\u89a7\uff08\u8272\/\u6587\u5b57\/\u52b9\u679c\/\u30b0\u30ea\u30c3\u30c9\uff09\ncurl -X GET \\\n  &quot;https:\/\/api.figma.com\/v1\/files\/{FILE_KEY}\/styles&quot; \\\n  -H &quot;X-Figma-Token: ${FIGMA_TOKEN}&quot;\n# \u8fd4\u5374: styles[]\uff08style_key, name, style_type\u306a\u3069\uff09<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u4e00\u89a7\ncurl -X GET \\\n  &quot;https:\/\/api.figma.com\/v1\/files\/{FILE_KEY}\/components&quot; \\\n  -H &quot;X-Figma-Token: ${FIGMA_TOKEN}&quot;<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>\/\/ \u30ed\u30fc\u30ab\u30eb\uff08\u5f53\u8a72\u30d5\u30a1\u30a4\u30eb\uff09\u306b\u5b58\u5728\u3059\u308b\u30b9\u30bf\u30a4\u30eb\nconst paints = figma.getLocalPaintStyles();\npaints.forEach(s =&gt; console.log(&#39;paint style:&#39;, s.name, s.id));\n\n\/\/ \u30ed\u30fc\u30ab\u30eb\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u4e00\u89a7\nconst comps = figma.getLocalComponents();\ncomps.forEach(c =&gt; console.log(&#39;component:&#39;, c.name, c.key));\n\n\/\/ \u30e9\u30a4\u30d6\u30e9\u30ea\uff08\u5225\u30d5\u30a1\u30a4\u30eb\uff09\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u30ad\u30fc\u6307\u5b9a\u3067\u30a4\u30f3\u30dd\u30fc\u30c8\nconst comp = await figma.importComponentByKeyAsync(&#39;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#39;);\nconst inst = comp.createInstance();\nfigma.currentPage.appendChild(inst);\n\/\/ \u6ce8\u610f: \u30e9\u30a4\u30d6\u30e9\u30ea\u516c\u958b\uff06\u6a29\u9650\u304c\u5fc5\u8981\u3002\u30ad\u30fc\u306f REST\/DevMode\/\u691c\u67fb\u304b\u3089\u53d6\u5f97\u53ef<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>5. \u753b\u50cf\u30fb\u30a8\u30af\u30b9\u30dd\u30fc\u30c8<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>\u9805\u76ee<\/strong><\/th><th><strong>REST API<\/strong><\/th><th><strong>Plugin API<\/strong><\/th><\/tr><\/thead><tbody><tr><td>\u30ce\u30fc\u30c9\u753b\u50cfURL\u53d6\u5f97<\/td><td>\u25cb GET \/images<\/td><td>\u00d7<\/td><\/tr><tr><td>\u30d5\u30a1\u30a4\u30eb\u5168\u4f53\u306e\u30b5\u30e0\u30cd\u30a4\u30ebURL<\/td><td>\u25cb<\/td><td>\u00d7<\/td><\/tr><tr><td>\u30ce\u30fc\u30c9\u753b\u50cf\u30d0\u30a4\u30ca\u30ea\u53d6\u5f97<\/td><td>\u00d7<\/td><td>\u25cb node.exportAsync()<\/td><\/tr><tr><td>\u753b\u50cf\u5f62\u5f0f\u6307\u5b9a\uff08PNG\/SVG\/JPG\uff09<\/td><td>\u25cb<\/td><td>\u25cb<\/td><\/tr><tr><td>\u89e3\u50cf\u5ea6\u6307\u5b9a\uff08scale\u30d1\u30e9\u30e1\u30fc\u30bf\u7b49\uff09<\/td><td>\u25cb<\/td><td>\u25cb<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code># ids=\u30ce\u30fc\u30c9ID\uff08\u30ab\u30f3\u30de\u533a\u5207\u308a\u53ef\uff09\u3001format=png\/svg\/jpg\u3001scale=\u500d\u7387\ncurl -X GET \\\n  &quot;https:\/\/api.figma.com\/v1\/images\/{FILE_KEY}?ids=12:34,56:78&format=png&scale=2&quot; \\\n  -H &quot;X-Figma-Token: ${FIGMA_TOKEN}&quot;\n\n# \u5fdc\u7b54\u4f8b:\n# { &quot;images&quot;: { &quot;12:34&quot;: &quot;https:\/\/figma-alpha.imgix.net\/....&quot;, &quot;56:78&quot;: &quot;...&quot; } }\n# \u6ce8\u610f: \u3053\u306eURL\u306f\u77ed\u671f\u6709\u52b9\uff08\u6570\u5206\uff09\u3002\u9577\u671f\u4fdd\u5b58\u306f\u81ea\u524d\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u2192\u4fdd\u7ba1\u304c\u5fc5\u8981<\/code><\/pre><\/div>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>\/\/ \u4efb\u610f\u30ce\u30fc\u30c9\u3092PNG\u66f8\u304d\u51fa\u3057\uff08Uint8Array\uff09\nconst node = figma.currentPage.selection[0];\nif (node) {\n  const bytes = await node.exportAsync({ format: &#39;PNG&#39;, constraint: { type: &#39;SCALE&#39;, value: 2 } });\n  \/\/ \u4f8b: UI\u5074\u3078\u8ee2\u9001\u3057\u3066\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3055\u305b\u308b\n  figma.ui.postMessage({ type: &#39;exported&#39;, bytes: Array.from(bytes) });\n}\n\/\/ \u6ce8\u610f: Plugin\u306f\u300c\u5916\u90e8\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308bURL\u300d\u306f\u8fd4\u3055\u306a\u3044\u3002\u5fc5\u8981\u306a\u3089\u81ea\u524d\u3067\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>6. \u30d5\u30a9\u30f3\u30c8<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>\u9805\u76ee<\/strong><\/th><th><strong>REST API<\/strong><\/th><th><strong>Plugin API<\/strong><\/th><\/tr><\/thead><tbody><tr><td>\u5229\u7528\u53ef\u80fd\u30d5\u30a9\u30f3\u30c8\u4e00\u89a7<\/td><td>\u00d7<\/td><td>\u25cb figma.listAvailableFontsAsync()<\/td><\/tr><tr><td>\u30d5\u30a9\u30f3\u30c8\u8aad\u307f\u8fbc\u307f<\/td><td>\u00d7<\/td><td>\u25cb figma.loadFontAsync()<\/td><\/tr><tr><td>\u30c6\u30ad\u30b9\u30c8\u7de8\u96c6<\/td><td>\u00d7<\/td><td>\u25cb<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>\/\/ \u5229\u7528\u53ef\u80fd\u30d5\u30a9\u30f3\u30c8\u4e00\u89a7\uff08\u30e6\u30fc\u30b6\u30fc\u306e\u74b0\u5883\uff0bFigma\u30d5\u30a9\u30f3\u30c8\u30b5\u30fc\u30d3\u30b9\uff09\nconst fonts = await figma.listAvailableFontsAsync();\nconsole.log(&#39;font count:&#39;, fonts.length);\n\n\/\/ \u30c6\u30ad\u30b9\u30c8\u7de8\u96c6\u306b\u306f\u5fc5\u305a loadFontAsync \u304c\u5fc5\u8981\nawait figma.loadFontAsync({ family: &#39;Inter&#39;, style: &#39;Regular&#39; });\nconst text = figma.createText();\ntext.characters = &#39;\u3053\u3093\u306b\u3061\u306f\u3001Figma\uff01&#39;;<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>7. \u5916\u90e8\u901a\u4fe1\u30fbUI<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>\u9805\u76ee<\/strong><\/th><th><strong>REST API<\/strong><\/th><th><strong>Plugin API<\/strong><\/th><\/tr><\/thead><tbody><tr><td>\u5916\u90e8API\u30a2\u30af\u30bb\u30b9<\/td><td>\u25cb\uff08HTTP\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\uff09<\/td><td>\u25cb\uff08Fetch API\uff0fUI iframe\uff09<\/td><\/tr><tr><td>\u30d7\u30e9\u30b0\u30a4\u30f3\u5c02\u7528UI<\/td><td>\u00d7<\/td><td>\u25cb\uff08HTML\/CSS\/JS\u3067\u69cb\u7bc9\uff09<\/td><\/tr><tr><td>\u30e6\u30fc\u30b6\u30fc\u5165\u529b\u30c0\u30a4\u30a2\u30ed\u30b0<\/td><td>\u00d7<\/td><td>\u25cb figma.showUI()<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>\/\/ code.ts\nfigma.showUI(__html__, { width: 360, height: 280 });\nfigma.ui.onmessage = (msg) =&gt; {\n  if (msg.type === &#39;ping&#39;) figma.ui.postMessage({ type: &#39;pong&#39; });\n};\n\n\/\/ ui.html\uff08\u629c\u7c8b\uff09\n\/*\n&lt;script&gt;\n  parent.postMessage({ pluginMessage: { type: &#39;ping&#39; } }, &#39;*&#39;);\n  onmessage = (e) =&gt; {\n    if (e.data.pluginMessage?.type === &#39;pong&#39;) console.log(&#39;PONG!&#39;);\n  };\n&lt;\/script&gt;\n*\/<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>8. \u7279\u6b8a\u30e2\u30fc\u30c9\u30fb\u305d\u306e\u4ed6<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>\u9805\u76ee<\/strong><\/th><th><strong>REST API<\/strong><\/th><th><strong>Plugin API<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Dev Mode\u5c02\u7528\u30c7\u30fc\u30bf<\/td><td>\u00d7<\/td><td>\u25cb\uff08\u8aad\u307f\u53d6\u308a\u5c02\u7528\uff09<\/td><\/tr><tr><td>\u52d5\u7684\u30da\u30fc\u30b8\u8aad\u307f\u8fbc\u307f<\/td><td>\u00d7<\/td><td>\u25cb\uff08\u975e\u540c\u671f\u30ed\u30fc\u30c9\u5bfe\u5fdc\uff09<\/td><\/tr><tr><td>\u8907\u6570\u30d5\u30a1\u30a4\u30eb\u540c\u6642\u51e6\u7406<\/td><td>\u25cb<\/td><td>\u00d7<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-ts\" data-lang=\"TypeScript\"><code>\/\/ \u52d5\u7684\u8aad\u307f\u8fbc\u307f\u4e0b\u3067\u306e\u5b89\u5168\u306a\u30a2\u30af\u30bb\u30b9\u4f8b\uff08\u6982\u5ff5\u7684\uff09\nfor (const page of figma.root.children) {\n  await figma.loadFontAsync({ family: &#39;Inter&#39;, style: &#39;Regular&#39; }).catch(() =&gt; {});\n  \/\/ \u5fc5\u8981\u306a\u51e6\u7406\u3060\u3051\u3092\u884c\u3044\u3001\u4fdd\u6301\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u5897\u3084\u3057\u3059\u304e\u306a\u3044\n}<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>\u307e\u3068\u3081<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>REST API<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u4e3b\u306b\u300c\u8aad\u307f\u53d6\u308a\u5c02\u7528\u300d\u3067\u3001\u30d5\u30a1\u30a4\u30eb\u306e\u30e1\u30bf\u30c7\u30fc\u30bf\u3001\u30b3\u30e1\u30f3\u30c8\u3001\u30b9\u30bf\u30a4\u30eb\u60c5\u5831\u3001\u753b\u50cfURL\u53d6\u5f97\u306a\u3069\u304c\u5f97\u610f<\/li>\n\n\n\n<li>\u8907\u6570\u30d5\u30a1\u30a4\u30eb\u3084\u30c1\u30fc\u30e0\u5358\u4f4d\u306e\u60c5\u5831\u3092\u6271\u3048\u308b<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Plugin API<\/strong>\n<ul class=\"wp-block-list\">\n<li>\u73fe\u5728\u958b\u3044\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u69cb\u9020\u3092\u76f4\u63a5\u8aad\u307f\u66f8\u304d\u53ef\u80fd<\/li>\n\n\n\n<li>\u30d5\u30a9\u30f3\u30c8\u64cd\u4f5c\u3001\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u7de8\u96c6\u3001UI\u69cb\u7bc9\u304c\u53ef\u80fd<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>\u3053\u306e\u5206\u985e\u3092\u77e5\u3063\u3066\u304a\u304f\u3068\u3001\u300c\u3069\u3061\u3089\u306eAPI\u3092\u4f7f\u3048\u3070\u76ee\u7684\u306e\u60c5\u5831\u304c\u53d6\u308c\u308b\u304b\u300d\u3092\u4e8b\u524d\u306b\u5224\u65ad\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u305c\u3072\u3001\u53c2\u8003\u306b\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Figma \u306b\u306f Web API\uff08REST API\uff09 \u3068 \u30c7\u30b9\u30af\u30c8\u30c3\u30d7\uff0fWeb\u30a2\u30d7\u30ea\u4e0a\u3067\u52d5\u4f5c\u3059\u308b Plugin API \u306e2\u3064\u306e\u958b\u767a\u7528\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u304c\u3042\u308a\u307e\u3059\u3002 \u4e21\u8005\u3068\u3082Figma\u30d5\u30a1\u30a4\u30eb\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u307e\u3059\u304c\u3001\u300c\u53d6\u5f97\u3067 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":719,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"swell_btn_cv_data":"","footnotes":""},"categories":[132],"tags":[],"class_list":["post-717","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to-use"],"_links":{"self":[{"href":"https:\/\/cg-method.com\/figma\/wp-json\/wp\/v2\/posts\/717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cg-method.com\/figma\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cg-method.com\/figma\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cg-method.com\/figma\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cg-method.com\/figma\/wp-json\/wp\/v2\/comments?post=717"}],"version-history":[{"count":2,"href":"https:\/\/cg-method.com\/figma\/wp-json\/wp\/v2\/posts\/717\/revisions"}],"predecessor-version":[{"id":720,"href":"https:\/\/cg-method.com\/figma\/wp-json\/wp\/v2\/posts\/717\/revisions\/720"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cg-method.com\/figma\/wp-json\/wp\/v2\/media\/719"}],"wp:attachment":[{"href":"https:\/\/cg-method.com\/figma\/wp-json\/wp\/v2\/media?parent=717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cg-method.com\/figma\/wp-json\/wp\/v2\/categories?post=717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cg-method.com\/figma\/wp-json\/wp\/v2\/tags?post=717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}