FortAwesome / Font-Awesome

The iconic SVG, font, and CSS toolkit
https://fontawesome.com
Other
73.71k stars 12.19k forks source link

Feature Request: FontAwesome JSON API Endpoint #14821

Open Log1x opened 5 years ago

Log1x commented 5 years ago

Describe the problem you'd like to see solved or task you'd like to see made easier

It would be extremely useful to provide a JSON API endpoint similar to the inlined JSON in the cheatsheet source to allow plugins/libraries that for example put FontAwesome icons into a Select2 / icon picker to pull the data from. There are a ton of repositories in the wild of people compiling this list theirselves, but it eventually gets abandoned as it is an absolute mess for someone to attempt to maintain. This API should include all of the icon types (including pro).

Is this in relation to an existing part of Font Awesome or something new?

Existing.

What is 1 thing that we can do when building this feature that will guarantee that it is awesome?

Ideally, it would have the following fields:

Here's an example of an implementation as an array (before JSONify):

[
  'version' => '5.8.1',
  'icons' => [
    'regular' => [
      [...],
    ],
    'solid' => [
      'clock' => [
        'name' => 'Clock',
        'type' => 'solid',
        'class' => 'fa-clock',
        'typeClass' => 'fas',
        'unicode' => 'f017',
      ],
      [...],
    ],
    'light' => [
      [...],
    ]
    'brand' => [
      [...],
    ],
  ],
]

Why would other Font Awesome users care about this?

It would allow developers who create libraries/packages that provide icon pickers, etc. with the ability to easily maintain their library while providing the latest icons and not having to compile their own datasets.

On a scale of 1 (sometime in the future) to 10 (absolutely right now), how soon would you recommend we make this feature?

  1. I feel as if this feature should've already been implemented.

Feature request checklist

tagliala commented 5 years ago

Hi!

Thanks for being part of the Font Awesome Community.

There have been a couple similar issues opened in the past regarding this, but as they are now rather buried, I think it's necessary to open a new one. I'm a little baffled this hasn't been done yet.

If there are other issues about the same topic, I should close this one because duplicates are not allowed.

At the moment, I've found #1820, but there are no +1s there are too few details. So, I've closed that request and I'm going to use this one.

Meanwhile, you can find json here: https://github.com/FortAwesome/Font-Awesome/blob/master/metadata/icons.json

Could you please edit the first post and fill out our feature request template?

Log1x commented 5 years ago

@tagliala Done. Also, I am indeed aware of the existing metadata– but this is not sufficient as it does not include Pro icons and the feature requested is meant to be something hosted outside of GitHub and contains a full dataset.

scottsawyer commented 5 years ago

In addition to allow showing Pro icons, a json api could allow filtering by version and style, which could open the door to a pretty powerful icon picker. I think this would be a great feature.

Log1x commented 5 years ago

@scottsawyer indeed.

As a basic example using query arguments:

https://api.fontawesome.com/all
https://api.fontawesome.com/solid 
https://api.fontawesome.com/solid/?icons=clock,star,star-half,cup

The above would show:

respectively.

tip2tail commented 5 years ago

So many +1s!

I have a lookup on my web app for a user to select an icon for a new object they add to the app. Having this in an "official" api would save me a TON of work when I upgrade the version of FontAwesome each time :)

sstenn commented 4 years ago

+1 !!

johnnorris commented 4 years ago

+1, yes please. I need to be able to supply a list of icons in a UI for the user to select from Font Awesome.

willfeerr commented 4 years ago

i've done something like that and using a free azure service, so, if someone want to me to mantain, i'll need money or just dont abuse.

https://icon-leets.azurewebsites.net/api/Icons

skip take like

https://icon-leets.azurewebsites.net/api/Icons?skip=0&take=10 <---- this is default, params are not needle

and search like that

https://icon-leets.azurewebsites.net/api/Icons?search=instagram // {partial term or partial name} like "instagram" or "yout"

is fully on code, dont use DB