User Tools

Site Tools


Sidebar

Welcome to DIDO WIKI

dido:public:ra:xapend:xapend.b_stds:defact:odc:tools:licenses_api

This is an old revision of the document!


Licenses API

The Open Definition states: “A piece of content or data is open if anyone is free to use, reuse, and redistribute it — subject only, at most, to the requirement to attribute and share-alike.”

Data on more than 100 open licenses

Including all OSI-approved open source licenses and all Open Definition conformant open data and content licenses. Provided in easy to use, machine readable JSON – perfect if you need to drop a license chooser into your app.

View the licenses available

License Groups

In addition various generic groups are provided that are useful when constructing license choice lists, including non-commercial options, generic Public Domain and more. Pre-packaged groups include:

  • All licenses
  • OSI compliant
  • Open Definition compliant
  • Specially selected set developed for CKAN that is perfect for data and content site license choosers.

Format

JSON hashes with the following keys:

{
    "id": "ODC-BY-1.0", 
    "domain_content": false, 
    "domain_data": true, 
    "domain_software": false, 
    "od_conformance": "approved", 
    "osd_conformance": "not reviewed", 
    "status": "active", 
    "title": "Open Data Commons Attribution License 1.0", 
    "url": "https://opendatacommons.org/licenses/by"
}
<code>
 
Spot an error, think we should have more info? Please file an issue or submit a patch.
===== How do I use it? =====
 
==== Get the data ====
 
Download the licenses, either all in one, individually (see below) or in specific groups (see above).
 
For example, here's how to use curl to access an individual license:
 
curl [[https://licenses.opendefinition.org/licenses/ODC-BY-1.0.json]]
 
And here's how to use curl to access the CKAN license group:
 
curl [[https://licenses.opendefinition.org/licenses/groups/ckan.json]]
 
==== Git Access ====
 
You can also get the material as a git repo:
 
git clone [[https://github.com/okfn/licenses]]
 
Javascript Access (JSONP)
 
We also provide a simple way to get direct access from javascript in the browser using JSONP, by providing versions of the all of the data in the jsonp subdirectory wrapped in a callback function named
 
<code>
license_callback

Thus, the JSONP version of a file named:

xyz.json

whether it is a license group or an individual license, will be located at:

licenses/jsonp/xyz.json

For example from jQuery:

$.ajax({
    url:'https://licenses.opendefinition.org/groups/jsonp/ODC-BY-1.0.js',
    dataType: 'jsonp',
    // you *must* set the callback function to be license_callback
    jsonpCallback: 'license_callback',
    success: function(data) {
        console.log('License title is ' + data.title);
    }
});

Because our JSONP data is served from a static files, it has a hardcoded callback function and therefore must name your callback function for the JSONP request

license_callback
dido/public/ra/xapend/xapend.b_stds/defact/odc/tools/licenses_api.1633197159.txt.gz · Last modified: 2021/10/02 13:52 by nick
Translations of this page: