jsdelivr / api Goto Github PK
View Code? Open in Web Editor NEWDEPRECATED - API for public CDNs
Home Page: http://api.jsdelivr.com
License: MIT License
DEPRECATED - API for public CDNs
Home Page: http://api.jsdelivr.com
License: MIT License
Now it's very difficult to find the same library across different CDNs. In order to solve this I propose adding normname
(stands for normalized name) field. For GitHub projects, it's /. If GitHub link is not available, project name is used instead.
Can you please confirm where data is coming from for this service. Are you a primary authority for the package list of any of the CDN?
Thank you
We just discovered this because Underscore is one of the libraries we use. If I request Underscore on its own, like so:
<script src="//cdn.jsdelivr.net/underscorejs/1.6.0/underscore-min.js"></script>
Then Chrome dev tools sees that there's a .map file, and requests it automatically from:
//cdn.jsdelivr.net/underscorejs/1.6.0/underscore-min.map
However, if we include Underscore in a grouped request:
<script src="//cdn.jsdelivr.net/g/[email protected],[email protected],[email protected],[email protected],[email protected],[email protected](handlebars.min.js)"></script>
Chrome attempts to find the .map file in the same directory, which in this case will 404:
//cdn.jsdelivr.net/g/underscore-min.map
This doesn't break the public-facing site, of course, so it's not a critical issue. I'm not sure what the best way to fix it would be. The Underscore javascript includes a line like:
//# sourceMappingURL=underscore-min.map
Which is obviously telling dev tools where to go looking for the .map file. Not sure if it's easiest to change that, or to add some logic to the /g/ grouping somehow.
Daily/Hourly data from CDNperf
Plus, this may help adding new POPs; being able to use all the CDNs with one link is close to combining them all into one CDN, isn't it?
http://api.jsdelivr.com/v1/jsdelivr/libraries?name=jquery&fields=mainfile
^ works great, however this does not:
http://api.jsdelivr.com/v1/jsdelivr/libraries/jquery?fields=mainfile
It is out of scope for the second command to work like the first?
cheers
The index file http://api.jsdelivr.com/v1/jsdelivr/
shows all included CDNs.
I would like to ask that here or some other location will explicitly state that date the the data files were last updated.
Is there a way to exclude a particular version or group of versions (e.g. 2.0.1 or 2.*)?
Thanks.
Standardize with NPM format. Ie.
"repositories": [
{
"type": "git",
"url": "https://github.com/medialize/URI.js"
}
],
"name": "jquery",
"versions": [
"2.1.0",
"2.0.3",
"2.0.2",
"2.0.1",
"2.0.0",
"1.9.1",
"1.9.0",
"1.8.3",
"1.7",
"1.4.4",
"1.11.0", // 1.11 > 1.9 :(
"1.10.2",
"1.10.1",
"1.10.0"
I hope to be:
"name": "jquery",
"versions": [
"2.1.0",
"2.0.3",
"2.0.2",
"2.0.1",
"2.0.0",
"1.11.0",
"1.10.2",
"1.10.1",
"1.10.0",
"1.9.1",
"1.9.0",
"1.8.3",
"1.7",
"1.4.4"
Perhaps this guy can help out? ;)
TIA
Would it make sense to add support for jQuery CDN to the API?
It would be potentially interesting to add a library oriented resource. Example:
GET /v2/libraries?normname=jquery/jquery
(need to use a normalized name here to avoid name clashes (just see all color libs))
[
{
"normname": "jquery/jquery",
"_id": "ey8mGL8Bp7q",
"created": "2014-02-25T08:48:09.270Z",
"description": "jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript.",
"homepage": "http://jquery.com/",
"github": "https://github.com/jquery/jquery",
"author": "jQuery Foundation",
"cdns": {
"jsdelivr": {
"name": "jquery",
"mainfile": "jquery.min.js",
"zip": "jquery.zip",
"lastversion": "2.1.0",
"versions": [
"2.1.0",
"2.0.3",
"2.0.2",
"2.0.1",
"2.0.0",
"1.11.0",
"1.10.2",
"1.10.1",
"1.10.0",
"1.9.1",
"1.9.0",
"1.8.3",
"1.7",
"1.4.4"
],
"assets": [
{
"version": "2.1.0",
"files": [
"jquery.js",
"jquery.min.js",
"jquery.min.map"
]
},
...
]
},
"cdnjs": {...},
"google": {...}
}
}
]
This simply aggregates the current information in a different format. In the beginning you can see common meta (name, description etc.). CDN specific information is stored to cdns
.
Possible additional benefit of the scheme is that it would allow us to aggregate libraries not available in any CDNs yet to the index.
I had a request to add jsdelivr to my Alfred CDN workflow (willfarrell/alfred-cdn-workflow#2). The other CDNs have a json file for everything or their search page isn't dynamically generated (thus I scrape). What is the best way to get all the libs on your cdn for fast local search?
How can I find just the Ember CDN, if:
http://api.jsdelivr.com/v1/cdnjs/libraries?name=lodash*&fields=name
[{"name": "lodash.js"}]
http://api.jsdelivr.com/v1/jsdelivr/libraries?name=lodash*&fields=name
[{"name": "lodash"}]
http://api.jsdelivr.com/v1/cdnjs/libraries?name=ember*&fields=name
[{"name":"ember-data-django-rest-adapter"},{"name":"ember-data.js"},{"name":"ember-resource.js"},{"name":"ember.js"}]
http://api.jsdelivr.com/v1/jsdelivr/libraries?name=ember*&fields=name
[{"name":"ember.localstorage-adapter"},{"name":"ember.table"},{"name":"emberjs"}]
There are other mismatched project names: underscore.js
|underscorejs
, can.js
|canjs
, hard to say how many now or in future. Not sure of the best approach?
NAME.?(js)?
, right?thanks :)
Ie. http://api.jsdelivr.com/v1/jsdelivr/libraries?versions=2.1.1
or http://api.jsdelivr.com/v1/jsdelivr/libraries?versions=2.1.*
.
This will become particularly useful if keywords are added to the API (#37).
runnable is like a jsBin for APIs. (scroll down to sign up)
I made a little demo, & have the most popular jsDelivr tag so far!
Seems to be good for demos. A bit slow to run scripts, but I suspect they'll speed up.
As I understand, currently AND
connective/operator is used when search is made with two or more parameters.
Is it possible to add support for OR
connective someway?
So that for example search for name=*key*&description=*key*
would return list with packages whose name or description contains specified key
.
http://api.yandex.ru/jslibs/libs.xml
Seems smaller, newish & current (eg Underscore has only the newest 3 versions, including very).
@jimaek In addition, perhaps reach out to them to get more CDN hosting in Russia for jsDelivr, if not just host for them?
The .woff font path included in the minified stylesheet for v 4.2.0 is incorrect, which is causing failures on TONS of sites that are using it.
The path is:
url('//oss.maxcdn.com/fontawesome/4.2.0/sfonts/fontawesome-webfont.woff?v=4.2.0')
Notice the /sfonts/ part. This should be /fonts/. The original Github and MaxCDN versions of this seems to be correct, but for some reason the jsDelivr version is not. Would love to see this fixed ASAP. Thanks.
Is your api down ?
http://api.jsdelivr.com/v1/jsdelivr/libraries?name=jquery
returns a code 52 when testing with curl (Empty request)(tested with IE,FF,and Chrome too)
Hi the api is down (404) (4:28 GMT+1) , not the first time , maybe you should had a status check system ( and a status page ) for the next version
Given it's easy to figure out the last version based on versions
what if we just dropped it in v2? Any objections?
Please update
http://api.jsdelivr.com/v1/bootstrap/libraries?name=*bootstrap
Which name is currently twitter-bootstrap
to instead be bootstrap
. This is more consistent to the asset URLs which are used, which include for example:
//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css
With information from #48, a linter can quickly for further inconsistencies in project names.
Hi there,
Noob question. I'm about to do some googling, but what's the best method you recommend to parse the results for PHP as an array?
Thanks :)
api.jsdelivr.com
is currently only served in the clear, which creates mixed-content warnings when an SSL/TLS page requests content from it.
Any plans to add SSL/TLS to this server? (not a huge problem if not, I can always proxy or self-host).
We've uncovered two issues that were causing the behavior you were seeing. The first is >that the server would not accept querystring parameters in a different order, and our retry >client did not guarantee a particular ordering for querystring parameters. The second is >that the server would not accept the percent-encoded value for the comma character >(%2C) in one of the parameters.
phuu / cdnjs
BTW, cdnjs cleanly lists non-GitHub source code repositories; there are only a few, but some still use Google-code, host their own repo on a non-homepage, & 2 others repos.
passy / google-cdn
Could be good starting points.
As I mentioned here, it'd be cool to have a trending hook that scrapes https://github.com/trending?l=javascript periodically or uses https://github.com/ricburton/trending.
We would then filter by what we host ofc.
Please consider:
http://api.jsdelivr.com/v1/bootstrap/libraries?name=*bootstrap
The result shows project name is twitter-bootstrap
, version is 3.2.0
and one asset is css/bootstrap.min.css
. However, the actual asset hosted on the CDN is located at this scheme-relative URL:
//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css
Please provide a reliable and documented way for API users to determine the full scheme-relative CDN asset URL with the returned information. Presently it is necessary to know the CDN's base URL and, in this case, the canonical name for twitter-bootstrap
.
For example for jsDelivr we want to hide highstocks
and some other projects.
Maybe a config file where we can set a list of project names we want to hide from each CDN we support?
Support for keywords/tags in the info.ini
would be potentially interesting and a reasonable solution (imo) for package aliasing (jsdelivr/jsdelivr#731)
The way I'd imagine it, assuming we want to continue using .ini files in v2 is a comma seperated list of tags for querying. Poor example below for ace
author = "Ajax.org B.V."
github = "https://github.com/ajaxorg/ace"
homepage = "http://ace.ajax.org/"
description = "Ace is a standalone code editor written in JavaScript. Our goal is to create a browser based editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page or JavaScript application. Ace is developed as the primary editor for Cloud9 IDE and the successor of the Mozilla Skywriter (Bespin) Project."
mainfile = "min/ace.js"
keywords = "wysiwyg,editor,ide"
Hello,
There is a typo in README.md
:
a comma for seperation
Why is description not mentioned in list of parameters that can be used for search?
Search by description works fine.
Would it make sense to add support for BootstrapCDN to the API?
Got AppFog 404.
I hope I didn't break it with my script demos!
While most of the files on CDNs are JS & their supporting CSS files, I do look at jsDelivr on occasion for fonts. However, a font might not be called a font, such as ratchicons. Searching by the file extensions .eot|.ttf|.woff
could be helpful, searching for .svg
that is a font is problematic. & fonts are sometimes on CDNs as part of larger distro, like Bootstrap & Ratchet, so they are only a sub-folder, not the main distro. Ideas:
font-FONTNAME
description=*font*
Just a thought, incase you wanted to allow someone to make a fonts directory easier.
Likely a v2/v3 thing.
Rather than returning
"assets": [
{
"version": "2.1.0",
"files": [
"jquery.js",
"jquery.min.js",
"jquery.min.map"
]
},
...
it would be convenient to return
"assets": {
"2.1.0": [
"jquery.js",
"jquery.min.js",
"jquery.min.map"
],
...
That way lastversion
and versions
would work well with the structure.
Loving jsDelivr, and I'm switching over all the CDN requests on one of my apps to use it today. HandlebarsJS works great if I request it individually, like so:
<script src="//cdn.jsdelivr.net/handlebarsjs/1.3.0/handlebars.min.js"></script>
However, as soon as I add it to a compiled request, handlebars stops working. Even if I request it as the only member of a compilation, like so:
<script src="//cdn.jsdelivr.net/g/[email protected]"></script>
Doing so results in this error everywhere I call handlebars:
TypeError: Handlebars.compile is not a function
The compiled request for the 5 other libraries I use is working great, so I'm not sure why Handlebars would be failing.
I wonder if we should just drop libraries
from url. That's the only resource type we serve so now it seems redundant. We could do this change in v2
.
The field searching is very useful, thanks! But it is too literal.
http://api.jsdelivr.com/v1/jsdelivr/libraries?author=angularui
gives one result
http://api.jsdelivr.com/v1/jsdelivr/libraries?author=AngularUI
gives another
http://api.jsdelivr.com/v1/jsdelivr/libraries?author=%22AngularUI%22
does not work, so 'AngularUI Team' or can never be found. (Many people use their full name at author).
Having an occasionally updated number of stars on github for the project would be awesome for search.
We should add more CDNs to the API.
Google - Scraping
jQuery - https://github.com/jquery/codeorigin.jquery.com/tree/master/cdn
BootstrapCDN - https://github.com/MaxCDN/bootstrap-cdn/tree/develop/public
Please add support for MaxCDN's BootstrapCDN.
Code for extracting the latest versions and URLs from MaxCDN are provided at:
https://github.com/fulldecent/web-puc
Please run the command web-puc -u
to have the that data extracted.
P.S. I intend to integrate this jsdelivr API into web-puc.
API idea looks great!
Idea:
/v1.0/
. This is perfect for most API calls, since API bug fixes will automatically be implemented with no user code changes, but code will not be negatively affected by non-compatible API removals or drastic updates./v1/
/
(version 'folder' is dropped;prefered) or //
or /v/
... for those who are lazy or like to live dangerously ;)Minor idea:
Shorten the URL, dropping the v
, & maybe abbreviate libraries
so this will return the latest jquery lib using the newest bugfixed 1.0.* API:
http://api.jsdelivr.com/1.0/jsdelivr/lib?name=jquery
Faster to type & slightly easier to remember IMHO. And just think of all the coffees you can buy from the saved bandwidth ;)
Documentation: http://www.asp.net/ajaxlibrary/cdn.ashx
http://www.jsdelivr.com/#!typeahead.js
Mainfile is typeahead.min.js
, but that's not in the files for the project. Should probably point to typeahead.bundle.min.js
We were referencing typeahead in a call for multiple libraries for our site, and this broke things, fwiw.
Given assets
will have versions in an easy to use format (#15), wouldn't it make sense to drop versions
field? Any objections?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.