Documentation

This documentation and answers will help you get started and master the way you use PageCDN for better content delivery.

List files of a public repo

GEThttps://pagecdn.com/api/v2/public/filesCopy

This endpoint allows you to fetch list of all files of a repo (a library, a theme, etc) on PageCDN's Public CDN. With this endpoint, you can:

  • Get list of all files of a repo;
  • Get list of all files of a specific version of a repo;

Please note that in most cases the list of files returned by this endpoint will not match the list of files available on the origin. This is for various reasons, some of which are mentioned next.

Excluded files

PageCDN does not host all the files found in that project. For example, for WordPress themes, we ignore all PHP files. Similarly, some dot-files are not useful in browser so we remove them. Here is a complete list of files which are excluded from hosting on CDN.

  • readme
  • readme.txt
  • readme.md
  • readme.markdown
  • gemfile
  • bower.json
  • package.json
  • changelog.txt
  • changelog
  • gruntfile.js
  • webpack.config.js
  • contributing
  • makefile
  • component.json
  • composer.json
  • cname
  • .npmignore
  • _config.yml
  • .editorconfig
  • .travis.yml
  • .ds_store

Similarly, some file extensions are also ignored when importing repos to the CDN. The most common of the extensions are: php, md, exe, msi, htaccess, ini and a few more.

PageCDN fetches just production releases from origin, and skips all releases that have trunk, rc, beta, alpha, dev, pre, canary or similar keywords that indicate a non-production release. Releases containing invalid characters are also skipped.

When importing a repo from Github, PageCDN supports importing just a single directory, that is usually dist, but can also be some other path deep down in the directory hierarchy of the repo. If a target directory is found at the time of import, PageCDN will ignore all files outside of that directory and such ignored files will not be available on the list returned by this API endpoint.

In rare cases, we manually remove some unnecessary files to clean things up, and for some large projects, we manually import specific files for hosting (like in case of browser logos we do not host all browser logos). However, these are special cases and rarely affect a library files list.

Files added by PageCDN

PageCDN supports on the fly optimization of css, js and images. Such optimized files are stored and made part of the original project so that other people can use them too. So, if you get a list of files, it may contain reference of such optimized files too.

  1. When a JS or CSS files has no minified alternative, with on-the-fly minification we create .min.css or .min.js variant of the original files. Such minified files are also returned by this API.
  2. PageCDN supports on-the-fly image optimization. Users can just change image file extension (for example png) to something like ._o.png to optimize and to ._o_768w_1300h.png to optimize and resize the file. Such resized files are made part of the repo for benefit of other users and to increase reuse.

Query String Parameters

apikeystringrequiredThe api key to identify originator of the request.
repostringrequiredSpecify the repo of which you want to list files, as lib/jquery.
versionstringoptionalYou can optionally limit the files list to a specific version. For example, 3.4.0. Some repos have versions that start with v, like v3.4.0. See version names from official repo of that library, or use the other Public API endpoint to get list of versions.

Successful Response

 {
    "status": "200",
    "message": "Ok",
    "details": "Success",
    "response": {
        "count": 7,
        "files": [
            {
                "version": "3.4.0",
                "file_hash": "6093d906fa1c80c99d08c89735c87aa13955bfccf2e3688f2bbeac34497c4383",
                "file_url": "https://pagecdn.io/lib/jquery/3.4.0/core.js",
                "file_size": 9165
            },
            {
                "version": "3.4.0",
                "file_hash": "0d864c082f074c2f900ebe5035a21c7d1ed548fb5c212ca477ee9e4a6056e6aa",
                "file_url": "https://pagecdn.io/lib/jquery/3.4.0/jquery.js",
                "file_size": 279860
            },
            {
                "version": "3.4.0",
                "file_hash": "0497a8d2a9bde7db8c0466fae73e347a3258192811ed1108e3e096d5f34ac0e8",
                "file_url": "https://pagecdn.io/lib/jquery/3.4.0/jquery.min.js",
                "file_size": 88151
            },
            {
                "version": "3.4.0",
                "file_hash": "c675644b85074aa21b5633a8c305e8818454f1440cf766957ed03be5dd808512",
                "file_url": "https://pagecdn.io/lib/jquery/3.4.0/jquery.min.map",
                "file_size": 136403
            },
            {
                "version": "3.4.0",
                "file_hash": "9a295ecf1e656a4ad9bb438ff5bd90585cb57edfd41142ba347d49ab3f215214",
                "file_url": "https://pagecdn.io/lib/jquery/3.4.0/jquery.slim.js",
                "file_size": 226518
            },
            {
                "version": "3.4.0",
                "file_hash": "65a5e76241c6a8886a4db27a301e25f45aecfebed4e23971ee2afc3c9601a9b2",
                "file_url": "https://pagecdn.io/lib/jquery/3.4.0/jquery.slim.min.js",
                "file_size": 71043
            },
            {
                "version": "3.4.0",
                "file_hash": "6b8587d211685b8cde0a827e75fff6319f01d75feb87324ddc43b0d7b9255fb1",
                "file_url": "https://pagecdn.io/lib/jquery/3.4.0/jquery.slim.min.map",
                "file_size": 108763
            }
        ]
    }
} 

Sample Requests

List all files of a repo

https://pagecdn.com/api/v2/public/files?apikey=160a426ff2894252cd7cebbdd6d6b7da8fcd319c65b70468f10b6690c45d02ef&repo=lib/jquery 

List files of a repo filtered by a version

https://pagecdn.com/api/v2/public/files?apikey=160a426ff2894252cd7cebbdd6d6b7da8fcd319c65b70468f10b6690c45d02ef&repo=lib/jquery&version=3.4.0