Monday, April 1, 2024

Pull Information from an API right into a Figma Layer — SitePoint

Must read


Pulling knowledge from an API right into a Figma Layer is among the coolest, most helpful issues we will do utilizing Figma. If we have been engaged on a mockup for Airbnb, for instance, and we needed to insert condo knowledge into it, we’d wish to use the Airbnb API for velocity, realism, and realtime updates.

On this first step, we’ll use the Information Sync plugin, which permits us to request JSON, XML, or CSV-formatted knowledge from Google Sheets and APIs, after which insert it into our mockup.

Begin by deciding on the Textual content layer in “Desktop – 1” with the “Bigger” Textual content Fashion utilized, then run the Information Sync plugin.

Now let’s assume that what we’re designing tells customers what their IP handle is. We’ll use the ipify API to seek out out what ours is and insert it into the Layer. Paste https://api.ipify.org/?format=json into the textual content discipline after which click on on the Load button, which is able to request the info from the API earlier than switching us to the Join tab. (That is an open API, so we don’t want to incorporate any authentication credentials.)

Requesting data from the ipify API

We’ll see the info returned by the API immediately, which on this case is our IP handle. Click on on it after which click on on the Insert button to switch the Layer’s content material with the info.

Inserting our IP address into the Layer

Change the content material of “Heading” to “Your IP handle is…”

Changing the heading content

Setting Up API Entry

Most APIs require authentication and request choices, so until we’re utilizing an open API just like the one above, it may be somewhat difficult to arrange. That being mentioned, knowledge returned by APIs could be reformatted in Figma utilizing JavaScript, so it is perhaps price studying some JavaScript to make it simpler to work with APIs.

This text is a brief extract from The Designer’s Information to Figma, obtainable on SitePoint Premium.





Supply hyperlink

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article