CTAN
Comprehensive TeX Archive Network

Query­ing the CTAN Database with JSON – Pack­age

The in­for­ma­tion about a sin­gle pack­age can be ob­tained un­der the URL like

http://www.ctan.org/json/pkg/tex

The last el­e­ment in the URl is the key of the pack­age as used by CTAN. Those keys are also listed in the list of pack­ages.

The re­sult is a JSON ob­ject as in the fol­low­ing list­ing:

{"id":"tex",
 "name":"TeX",
 "caption":"A sophisticated typesetting engine",
 "authors":[{"id":"knuth","active":true}],
 "copyright":[{"owner":"D. E. Knuth","year":"1982"}],
 "license":"knuth",
 "version":{"number":"3.14159265","date":"2014-01-07"},
 "descriptions":[{"description":"TeX is a typesetting system that incorporates a macro processor.\nA TeX source document specifies or incorporates a number of macro\ndefinitions that instruct the TeX engine how to typeset the\ndocument.  The TeX engine also uses font metrics generated by\nMetafont, or by any of several other\nmechanisms that incorporate fonts from other sources into an\nenvironment suitable for TeX.\n\nTeX has been, and continues, a basis and an inspiration for\nseveral other programs, including e-TeX\nand PDFTeX.\n\nThe distribution includes the source of Knuth’s\nTeX book; this source is there to read, as an\nexample of writing TeX — it should not be processed\nwithout Knuth’s direct permission."],
                  "lang":null}],
 "ctan":{"path":"/systems/knuth/dist/tex",
 "file":true},
 "miktex":"miktex-tex-bin-2.9",
 "texlive":"tex",
 "topics":["engine"]}   

The en­try ob­ject has sev­eral at­tributes:

id
This at­tribute con­tains the unique id of the pack­age. This at­tribute is manda­tory.
name
The en­try has the manda­tory at­tribute <name>. The name con­tains the print rep­re­sen­ta­tion of the pack­age name.
caption
The en­try has the manda­tory at­tribute <caption>. The cap­tion con­tains a short de­scrip­tion of the pack­age.
authors
The en­try has the at­tribute authors which con­tains a list of au­thors. The au­thor is a ob­ject which has sev­eral at­tributes:
id
This at­tribute con­tains the id of the au­thor. This at­tribute is manda­tory.
givenname
This at­tribute con­tains the given name of the au­thor. It is present only if the pa­ram­e­ter author-name is true and the given name is known.
familyname
This at­tribute con­tains the fam­ily name of the au­thor. It is present only if the pa­ram­e­ter author-name is true and the fam­ily name is known.
copyright
The en­try can have a list-val­ued at­tribute copyright. It car­ries the in­for­ma­tion about the copy­right. This list con­tains ob­jects which have sev­eral at­tributes:
owner
This at­tribute con­tains the name of the copy­right holder. This at­tribute is manda­tory.
year
This at­tribute con­tains the year or years of the copy­right. This at­tribute is manda­tory.
version
The en­try has the at­tribute version. It car­ries the in­for­ma­tion about the ver­sion of the pack­age. This ob­ject has sev­eral at­tributes:
number
This at­tribute con­tains the ver­sion num­ber.
date
This at­tribute con­tains the ver­sion date.

At least one of number or date have to be given. Other­wise the tag is sup­pressed.

descriptions
The en­try has a list of de­scrip­tion ob­jects. It may have at­tributes:
description
This at­tribute con­tains the longer de­scrip­tion of the pack­age. It may in­clude HTML markup.
lang
This at­tribute con­tains the ISO code for the lan­guage of the de­scrip­tion. Al­ter­nately it may be null to in­di­cate the de­fault lan­guage, i.e. English.
<ref>
An in­ner tag of <description> is <ref>. It is used to ref­er­ence a pack­age. The tag may have an at­tribute:
refid
This at­tribute con­tains the ref­er­ence.
documentation
The en­try has the list at­tribute documentation. The list el­e­ments in­di­cate ref­er­ences to doc­u­men­ta­tion. The ob­jects may have at­tributes:
lang
This at­tribute con­tains the ISO code for the lan­guage of the de­scrip­tion.
details
This at­tribute con­tains the (English) text de­scrib­ing this doc­u­men­ta­tion item.
href
This at­tribute con­tains a ref­er­ence to the doc­u­men­ta­tion. The pre­fix ctan: in­di­cates a ref­er­ence to a di­rec­tory on CTAN. If the pa­ram­e­ter keep-url is true then this at­tribute con­tains al­ways a valid URL with­out the ctan: pre­fix.
ctan
The en­try has the op­tional at­tribute ctan. It car­ries the lo­ca­tion of the pack­age in the CTAN tree. This JSON ob­ject has sev­eral at­tributes:
path
This at­tribute con­tains the rel­a­tive path of the pack­age in the CTAN tree. This at­tribute is manda­tory.
file
This at­tribute con­tains the in­di­ca­tor that this pack­age con­sists of a sin­gle file only. This is in con­trast to a whole pack­age di­rec­tory. This at­tribute is op­tional and de­faults to false.
install
The en­try has the op­tional at­tribute install. It car­ries the lo­ca­tion of the pack­age on CTAN in form of an in­stal­lable TDS-com­pli­ant zip archive. This JSON ob­ject has sev­eral at­tributes:
path
This at­tribute con­tains path rel­a­tive to the CTAN di­rec­tory /install. This at­tribute is manda­tory.
miktex
The en­try has the op­tional at­tribute miktex. It car­ries the name of the pack­age in MiK. This JSON ob­jetc has sev­eral at­tributes:
location
This at­tribute con­tains name of the pack­age in MiK. This at­tribute is manda­tory.
texlive
The en­try has the op­tional at­tribute texlive. It car­ries the name of the pack­age in  Live. This JSON ob­ject has sev­eral at­tributes:
location
This at­tribute con­tains name of the pack­age in  Live. This at­tribute is manda­tory.
index
The en­try has the op­tional at­tribute index. If present then it con­tains a list of ex­tra terms to be in­dexed for the search.
topics
The en­try has the op­tional at­tribute topics. If present then it con­tains a list of top­ics keys for this en­try.

Ex­pand­ing Author In­for­ma­tion

The au­thor in­for­ma­tion is con­tained as id ref­er­enc­ing an en­try in the au­thors file. If the pa­ram­e­ter author-name can be set to true to in­clude the first name and fam­ily name of the au­thor as well. Ex­am­ple:

http://www.ctan.org/json/pkg/tex?au­thor-name=true

Select­ing Fields

Some­times it might be de­sir­able to get some of the fields only. This can be ac­com­plished with the pa­ram­e­ter drop. It takes a comma sep­a­rated list of fields to drop. Ex­am­ple:

http://www.ctan.org/json/pkg/tex?drop=doc­u­men­ta­tion,de­scrip­tion

The fol­low­ing fields are rec­og­nized in the drop list:

author, caption, copyright, ctan, description, documentation, home, index, install, miktex, name, texlive, topic, version
Guest Book Sitemap Contact Contact Author