This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
dido:public:ra:xapend:xapend.b_stds:defact:odc:tools:licenses_api [2021/10/02 13:52] nick created |
dido:public:ra:xapend:xapend.b_stds:defact:odc:tools:licenses_api [2021/11/08 16:20] (current) nick ↷ Links adapted because of a move operation |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Licenses API ====== | ====== Licenses API ====== | ||
| + | [[dido:public:ra:xapend:xapend.b_stds:defact:odc:tools:start| return to the Open Data Common Resources and Tools ]] | ||
| - | 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." | + | //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." [[dido:public:ra:xapend:xapend.b_stds:defact:odc:tools:open_definition]]// |
| ===== Data on more than 100 open licenses ===== | ===== Data on more than 100 open licenses ===== | ||
| + | [[dido:public:ra:xapend:xapend.b_stds:defact:odc:tools:licenses_api | Return to Top]] | ||
| - | 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. | + | //Including all [[https://opensource.org/licenses | Open Source Initiative (OSI)]] approved open source licenses and all Open Definition conformant open data and content licenses. Provided in easy to use, machine readable [[dido:public:ra:xapend:xapend.a_glossary:j:json]] -- perfect if you need to drop a license chooser into your app.// |
| - | View the licenses available | + | * [[https://opendefinition.org/licenses/api/#all-licenses | View the licenses available]] |
| ===== License Groups ===== | ===== License Groups ===== | ||
| + | [[dido:public:ra:xapend:xapend.b_stds:defact:odc:tools:licenses_api | Return to Top]] | ||
| - | 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: | + | In addition various generic groups are provided that are useful when constructing license choice lists, including non-commercial options, generic [[dido:public:ra:xapend:xapend.a_glossary:p:public_domain]] and more. Pre-packaged groups include: |
| - | * All licenses | + | * [[https://licenses.opendefinition.org/licenses/groups/all.json | All licenses]] |
| - | * OSI compliant | + | * [[https://licenses.opendefinition.org/licenses/groups/osi.json | OSI compliant]] |
| - | * Open Definition compliant | + | * [[https://licenses.opendefinition.org/licenses/groups/od.json | Open Definition compliant]] |
| - | * Specially selected set developed for CKAN that is perfect for data and content site license choosers. | + | * [[https://licenses.opendefinition.org/licenses/groups/ckan.json | Specially selected set for data and content site license choosers] developed for CKAN |
| ===== Format ===== | ===== Format ===== | ||
| + | [[dido:public:ra:xapend:xapend.b_stds:defact:odc:tools:licenses_api | Return to Top]] | ||
| - | JSON hashes with the following keys: | + | [[dido:public:ra:xapend:xapend.a_glossary:j:json]] hashes with the following keys: |
| - | <code JSON> | + | <code Javascript> |
| { | { | ||
| "id": "ODC-BY-1.0", | "id": "ODC-BY-1.0", | ||
| Line 34: | Line 38: | ||
| "url": "https://opendatacommons.org/licenses/by" | "url": "https://opendatacommons.org/licenses/by" | ||
| } | } | ||
| - | <code> | + | </code> |
| Spot an error, think we should have more info? Please file an issue or submit a patch. | Spot an error, think we should have more info? Please file an issue or submit a patch. | ||
| + | |||
| ===== How do I use it? ===== | ===== How do I use it? ===== | ||
| + | [[dido:public:ra:xapend:xapend.b_stds:defact:odc:tools:licenses_api | Return to Top]] | ||
| ==== Get the data ==== | ==== Get the data ==== | ||
| + | [[dido:public:ra:xapend:xapend.b_stds:defact:odc:tools:licenses_api | Return to Top]] | ||
| Download the licenses, either all in one, individually (see below) or in specific groups (see above). | Download the licenses, either all in one, individually (see below) or in specific groups (see above). | ||
| Line 45: | Line 52: | ||
| For example, here's how to use curl to access an individual license: | For example, here's how to use curl to access an individual license: | ||
| - | curl [[https://licenses.opendefinition.org/licenses/ODC-BY-1.0.json]] | + | * **curl** [[https://licenses.opendefinition.org/licenses/ODC-BY-1.0.json]] |
| And here's how to use curl to access the CKAN license group: | And here's how to use curl to access the CKAN license group: | ||
| - | curl [[https://licenses.opendefinition.org/licenses/groups/ckan.json]] | + | * **curl** [[https://licenses.opendefinition.org/licenses/groups/ckan.json]] |
| ==== Git Access ==== | ==== Git Access ==== | ||
| + | [[dido:public:ra:xapend:xapend.b_stds:defact:odc:tools:licenses_api | Return to Top]] | ||
| You can also get the material as a git repo: | You can also get the material as a git repo: | ||
| - | git clone [[https://github.com/okfn/licenses]] | + | * **git clone** [[https://github.com/okfn/licenses]] |
| Javascript Access (JSONP) | Javascript Access (JSONP) | ||
| Line 64: | Line 72: | ||
| license_callback | license_callback | ||
| </code> | </code> | ||
| + | |||
| + | * **NOTE:** [[https://en.wikipedia.org/wiki/JSONP | JSONP is vulnerable to the data source]] replacing the innocuous function call with malicious code, which is why it has been superseded by [[https://en.wikipedia.org/wiki/Cross-origin_resource_sharing | Cross-origin resource sharing]] (available since 2009(( | ||
| + | __Cross-Origin Resource Sharing__, | ||
| + | [[https://caniuse.com/cors | Can I use]] | ||
| + | Retrieved 4 May 2020. | ||
| + | ))) in modern applications. | ||
| + | |||
| Thus, the JSONP version of a file named: | Thus, the JSONP version of a file named: | ||
| Line 73: | Line 88: | ||
| whether it is a license group or an individual license, will be located at: | whether it is a license group or an individual license, will be located at: | ||
| - | [[licenses/jsonp/xyz.json]] | + | <code> |
| + | licenses/jsonp/xyz.json | ||
| + | </code> | ||
| For example from jQuery: | For example from jQuery: | ||
| - | <code AJAX> | + | <code HTML> |
| $.ajax({ | $.ajax({ | ||
| url:'https://licenses.opendefinition.org/groups/jsonp/ODC-BY-1.0.js', | url:'https://licenses.opendefinition.org/groups/jsonp/ODC-BY-1.0.js', | ||