JSON: Difference between revisions

From OSSelot
Jump to navigation Jump to search
No edit summary
m (Updated OSSelot logo to new font feature)
 
(20 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Obtain curation data in JSON format==
==Obtain curation data in JSON format==
====Single version====
====Single version====
To obtain curation data of a single version of a software package, the following URL may be used:
To obtain curation data of a single version of a software package in JSON format, the following [[REST]] calls may be used:
<nowiki>
<pre>
http://osselot.org/json.php?<package>/version-<version>
http://www.osselot.org:3262/json/<package>/<version>
</nowiki>
</pre>
such as in a wget command
or
<pre>
https://www.osselot.org:3263/json/<package>/<version>
</pre>
such as in a <i>wget</i> command
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
wget -qO - http://osselot.org/json.php?angular/version-15.2.2
wget -qO - http://www.osselot.org:3262/json/dbus/1.15.2
</syntaxhighlight>
</syntaxhighlight>


Line 13: Line 17:
The command to obtain JSON formatted data of all available versions of a software package is very similar to the above except that the "version" part is not given such as
The command to obtain JSON formatted data of all available versions of a software package is very similar to the above except that the "version" part is not given such as
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
wget -qO - http://osselot.org/json.php?angular
wget -qO - http://wwww.osselot.org:3262/json/dbus
</syntaxhighlight>
</syntaxhighlight>


====Format JSON file in browser====
====Format JSON file in browser====
If your browser supports display of JSON data either natively or after having installed an appropriate extension, you may immediately browse to the URL such as
If a browser supports display of JSON data either natively or after having installed an appropriate extension, JSON data may be rendered and interactively inspected using links such as
<html>
<html>
<script>
<a href="https://www.osselot.org:3263/json/dbus/1.15.2">DBus version 1.15.2</a>
</html>
or even
<html>
<a href="https://www.osselot.org:3263/json/dbus">all curated versions of DBus</a>.
</html>


function loadJSON(anchor, url)
<i>(Please note that the above browser commands, particularly the second, may take a long time to render.)</i>
{
  if (window.XMLHttpRequest)
    xmlhttp = new XMLHttpRequest();
  else
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");


  xmlhttp.onreadystatechange = (function() {
<html>
    if (xmlhttp.readyState == 4) {
<script src="/scripts/osadl.js">
      if (xmlhttp.status == 200) {
</script>
        response = xmlhttp.responseText;
<h4>For browsers with generic JSON support: Search for a package, select it, submit it to the REST interface for JSON formatted data and display the <span style="font-family: OSSelot-Bold; font-weight: 500; color: #1565af;">OSSelot</span> curation data in a new window</h4>
        name = url.split("?")[1].replace("/", "-") + ".json";
<i>(Same as above, some of the packages may take a long time to render. If the browser does not know how to handle JSON code, use the below OSADL built-in display version.)</i><br />
        var blob = new File([response], name, {"type": "application/json"});
<input type="text" onkeyup="searchtextkeyup(event, this, 'restjson');" size="30" /><button onclick="searchOSSelot(this, 'restjson');">Search the <span style="font-family: OSSelot-Bold; font-weight: 500; color: #1565af;">OSSelot</span> repository</button><br />
        var a = document.createElement("a");
<span style="display: none;"></span>
        a.href = URL.createObjectURL(blob);
<br />
        a.setAttribute("target", "_blank");
</html>
        anchor.appendChild(a);
        a.click();
        a.remove();
      }
    }
  });
  xmlhttp.open('GET', url, true);
  xmlhttp.send();
}


</script>
<html>
<a onclick="loadJSON(this, 'https://www.osselot.org/json.php?angular/version-15.2.2');">https://www.osselot.org/json.php?angular/version-15.2.2</a>
<h4>If the browser does not generically support JSON display: Search for a package, select it, let the JSON formatted <span style="font-family: OSSelot-Bold; font-weight: 500; color: #1565af;">OSSelot</span> curation data be validated for syntax correctness and colorified, and display the code in a new window</h4>
<i>(Also same as above, some of the packages may take a long time to render.)</i><br />
<input type="text" onkeyup="searchtextkeyup(event, this, 'validatejson');" size="30" /><button onclick="searchOSSelot(this, 'validatejson');">Search the <span style="font-family: OSSelot-Bold; font-weight: 500; color: #1565af;">OSSelot</span> repository</button><br />
<span style="display: none;"></span>
<br />
</html>
</html>
====Other formats====
In addition to the above, the curated data are also available in [[RDF-XML]], [[SPDX2TV]] and [[YAML]] format.

Latest revision as of 15:42, 1 November 2023

Obtain curation data in JSON format

Single version

To obtain curation data of a single version of a software package in JSON format, the following REST calls may be used:

http://www.osselot.org:3262/json/<package>/<version>

or

https://www.osselot.org:3263/json/<package>/<version>

such as in a wget command

wget -qO - http://www.osselot.org:3262/json/dbus/1.15.2

All available versions of a software package

The command to obtain JSON formatted data of all available versions of a software package is very similar to the above except that the "version" part is not given such as

wget -qO - http://wwww.osselot.org:3262/json/dbus

Format JSON file in browser

If a browser supports display of JSON data either natively or after having installed an appropriate extension, JSON data may be rendered and interactively inspected using links such as DBus version 1.15.2 or even all curated versions of DBus.

(Please note that the above browser commands, particularly the second, may take a long time to render.)

For browsers with generic JSON support: Search for a package, select it, submit it to the REST interface for JSON formatted data and display the OSSelot curation data in a new window

(Same as above, some of the packages may take a long time to render. If the browser does not know how to handle JSON code, use the below OSADL built-in display version.)


If the browser does not generically support JSON display: Search for a package, select it, let the JSON formatted OSSelot curation data be validated for syntax correctness and colorified, and display the code in a new window

(Also same as above, some of the packages may take a long time to render.)


Other formats

In addition to the above, the curated data are also available in RDF-XML, SPDX2TV and YAML format.