Giter Site home page Giter Site logo

api's Introduction

DEPRECATED

The v1 API has been deprecated. All endpoints will continue to work, but will use a dataset created on June 8, 2017 and won't receive any future updates. See https://github.com/jsdelivr/data.jsdelivr.com for a new API.

Public CDNs API

Root: /v1/<cdn>/libraries

Supports jsdelivr, google, cdnjs, bootstrap, and jquery.

Only GET requests are allowed. No limits are set.

Get all hosted libraries in JSON format

http://api.jsdelivr.com/v1/jsdelivr/libraries
http://api.jsdelivr.com/v1/google/libraries
http://api.jsdelivr.com/v1/cdnjs/libraries
http://api.jsdelivr.com/v1/bootstrap/libraries
http://api.jsdelivr.com/v1/jquery/libraries

Get full information for a single library based on name parameter.

http://api.jsdelivr.com/v1/jsdelivr/libraries?name=jquery
http://api.jsdelivr.com/v1/jsdelivr/libraries/jquery - alias

Get full information for any library starting with jq that has lastversion ending with 0.1. minimatch syntax is supported.

http://api.jsdelivr.com/v1/jsdelivr/libraries?name=jq*&lastversion=*.0.1

You can use any of the following parameters to search for libraries. A search will be performed for projects matching your input. You can use multiple parameters at the same time. If multiple projects match they all will be outputed.

  • name - name of library. Example: jquery
  • mainfile - mainfile parameter in info.ini. Example: jquery.min.js
  • lastversion- lastversion of the project. Example: 2.0.3 (will match multiple projects)
  • versions - all hosted versions for selected project. (read only)
  • description - description of the project
  • homepage- webpage of project. Example: http://jquery.com/
  • github- github page of project. Example: https://github.com/jquery/jquery
  • author - the author of project. Example: jQuery Foundation
  • assets - files hosted per versions. (read only)

You can combine the above parameters with the parameter fields. This way you can control the output. For example to get the mainfile for jQuery you would run the following request.

http://api.jsdelivr.com/v1/jsdelivr/libraries?name=jquery&fields=mainfile

It's possible to set multiple fields using a comma for separation.

http://api.jsdelivr.com/v1/jsdelivr/libraries?name=jquery&fields=mainfile,name

Get hosted files per version for jQuery

http://api.jsdelivr.com/v1/jsdelivr/libraries?name=jquery&fields=assets

Get hosted files for a selected version

http://api.jsdelivr.com/v1/jsdelivr/libraries/jquery/2.0.3

Get libraries matching to any part of query (defaults to and)

http://api.jsdelivr.com/v1/jsdelivr/libraries?name=jquery&op=or

api's People

Contributors

bebraw avatar gavinhungry avatar jimaek avatar martinkolarik avatar megawac avatar tombyrer avatar unboundev avatar yasuyk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

api's Issues

Add SSL/TLS support

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

Add MaxCDN's Bootstrap CDN

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.

handlebarsjs doesn't work via compiled request

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.

jsdelivr api's down

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

Add github stars

Having an occasionally updated number of stars on github for the project would be awesome for search.

Allow to hide projects per CDN

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?

Prune `/libraries` out of urls?

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.

URL: SemVer API matching & shorten API path

API idea looks great!

Idea:

  1. Please use full Semantic Versioning for the API version. EG first released version will be v1.0.0
  2. Use shortened alias URL for latest sub-version:
    • Newest v1.0.* will be accessed as only /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.
    • Latest v1.. = /v1/
    • Newest version = / (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 ;)

Runscope feedback

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.

bootstrap/bootstrap Update project name to match URL part

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.

Add keywords

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"

Explicit documentation of asset URLs

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.

Confirm sources

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

FYI: other CDN APIs

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.

Search for lib API

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?

A couple of notices about README.md

Hello,

  1. There is a typo in README.md:

    a comma for seperation

  2. Why is description not mentioned in list of parameters that can be used for search?
    Search by description works fine.

requests for .map throws 404 if the original library is in a grouped request

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.

http://api.jsdelivr.com/v1/best

Daily/Hourly data from CDNperf

  • master index of files on all CDNs
  • jsdelivr's load-balancing closest-POP scripting wizardry (I assume you do this already for //cdn.jsdelivr.net/)
    = a CDN API that kicks... can I say arce on here? ;)

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?

(fuzzy) search by field

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

  1. Could you please allow quoting?
  2. I hope there is a wildcard search that will find both lower & uppercase variants, along with partial matches. But I am not certain how to suggest wildcard searching:
    • all inquiries will be assumed wildcard search, with a flag to turn on literal matching
    • if entered lowercase then wildcard, if mixed case then literal match
    • other way to turn on wildcard (GET parameter, quoting...)?

Drop `lastversion`?

Given it's easy to figure out the last version based on versions what if we just dropped it in v2? Any objections?

How to find same project, different CDN, different "name" field?

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?

  • client-side or server-side lookup table (might grow large)
  • switching to RegEx, since I can't figure out how to use minimatch here. In RegEx, I think all of the above files would be isolated via NAME.?(js)?, right?

thanks :)

Add `normname` field

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.

API down

Got AppFog 404.
I hope I didn't break it with my script demos!

search by 'file grouping'?

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:

  • do nothing (could be a pain for you guys; someone else can make a linkfarm of fonts on CDNs)
  • have a separate directory/API for fonts
  • make separate repos with just the font
    • all named font-FONTNAME
    • Description must have the keyword font & allow the API have description=*font*
    • have a 'keywords' field, & if the repo is a font, it can be listed there

Just a thought, incase you wanted to allow someone to make a fonts directory easier.
Likely a v2/v3 thing.

Add `/libraries`

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.

Confirm recency

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.

Support searching against arrays

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

Incorrect .woff font path in v 4.2.0

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.

Ability to search by using logical OR connective

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.

SemVer sorting, reversed prefered

    "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

Reformat `assets`

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.

How to parse results?

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

Add `repositories` field

Standardize with NPM format. Ie.

"repositories": [
    {
        "type": "git",
        "url": "https://github.com/medialize/URI.js"
    }
],

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.