Pictogrammers / pictogrammers.com

Code for Pictogrammers.com
https://pictogrammers.com
80 stars 18 forks source link

Migrating from materialdesignicons.com api to pictogrammers.com #22

Closed SmileyJoe closed 1 year ago

SmileyJoe commented 1 year ago

Hi,

I hope this is the correct repo to put this under,

I wrote and maintain a little library (https://github.com/SmileyJoe/lib_android_icons) to help with loading icons in Android. It gets a list of all icons from https://cdn.jsdelivr.net/npm/@mdi/svg@{version}/meta.json and then uses the materialdesignicons.com/api/icon/{id} endpoint to load the svg data.

The cdn url is still returning the list of icons, however, the api/icon/{id} endpoint is returning a 302 with a redirect to pictogrammers.com/library/mdi/?welcome

With the move to pictogrammers is there an updated url to retrieve the icon data?

Thanks

SmileyJoe commented 1 year ago

Closing as I found the documentation under contributing:

https://pictogrammers.com/docs/contribute/api/

mririgoyen commented 1 year ago

You shouldn't be using the API for this use case.

There are two ways you could do this:

SmileyJoe commented 1 year ago

Thanks for the reply @mririgoyen , I'm not sure if I'm missing something but I don't see how that fits into a java based library for android?

The idea of the lib is to load icons as needed based on the name of the icon, this can come from an api or be set in code, and then store the icon locally, is that the same thing you had in mind?

mririgoyen commented 1 year ago

Yes, that would be ideal for a number of reasons. You would bring all assets down locally, avoiding network requests. This will be much quicker for your users and prevent unneeded network traffic to the site. You also avoid things breaking if the site goes down for some reason.

Please note that the article you found on our API documentation explicitly states:

Please do not use these endpoints to scrape the site or to build third party applications. All data is provided in the meta.json on the CDN or in the GitHub repo after every release.

So, in your case, the two options available to you would be:

The first option bring all icons local and removes the need for network requests, which would be the ideal path IMO. The second option slightly alters what you are currently doing to avoid using the API.

SmileyJoe commented 1 year ago

Ah, I see, ok cool, I must have missed that api note on the old documentation. Thanks, let me make some updates.

mririgoyen commented 1 year ago

Sure thing! Let us know if you have any other questions. Limiting the use of the API is not only a benefit for you and your users, but for us as well. Running servers on ad-only income is a tough balancing act. 😄