Font-awesome: Feature Request: FontAwesome JSON API Endpoint

Created on 26 Mar 2019  Â·  8Comments  Â·  Source: FortAwesome/Font-Awesome

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:

  • Icon name (e.g. Clock)
  • Icon type (light, normal, solid, brand)
  • Unicode / HTML attribute (e.g. f017)
  • Class name (e.g. fa-clock)
  • Icon type classname (e.g. fas)

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

  • [x] This is a single feature (i.e. not a re-write of all of Font Awesome)
  • [x] The title starts with "Feature request: " and is followed by a clear feature name (Ex: Feature request: moar cowbell)
  • [x] I have searched for existing issues and to the best of my knowledge this is not a duplicate
feature

Most helpful comment

@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:

  • All icons
  • Only solid icons
  • Only the solid clock, star, star-half, and cup icons

respectively.

All 8 comments

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?

@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.

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.

@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:

  • All icons
  • Only solid icons
  • Only the solid clock, star, star-half, and cup icons

respectively.

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 :)

+1 !!

+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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faithdong picture faithdong  Â·  3Comments

petermolnar picture petermolnar  Â·  3Comments

omnimint picture omnimint  Â·  3Comments

tdolph picture tdolph  Â·  3Comments

desspro picture desspro  Â·  3Comments