machine readable output API

stuff is available at http://$host/<path>
output is json




URL: /mr/package/
summary: list source package names
http status codes: 200 500 304
output: a list of hashes.  each hash has at least a 'package' key with one source package name
{   '_comment': "yadayadayda",
    'result':
        [   { 'package': "eglibc" },
            { 'package': "tor" }
            ...
        ]
}

URL: /mr/package/<package>/
http status codes: 200 500 404 304
summary: list all available source versions for this package
{   '_comment': "yadayadayda",
    'package': "tor",
    'result':
        [   { 'version': "0.1.2.20-1" },
            { 'version': "0.1.2.20-2" },
            { 'version': "0.1.2.21-1" },
            ...
        ]
}

URL: /mr/package/<package>/<version>/srcfiles
Options: fileinfo=1  includes fileinfo section
http status codes: 200 500 404 304
summary: list all source files associated with this package at that version
{   '_comment': "yadayadayda",
    'package': "tor",
    'version': "0.1.2.20-1",
    'result':
        [   { 'hash': "4955b5f663b9dccc84d7c264da9c483330ed3fdf" },
            { 'hash': "b4e15cbc18155955311207a3b5db0aeb6680ecaf" },
            { 'hash': "3beaecd47f4c0d3d5d182ef8d47166a81f9f62eb" },
            ...
        ]
}

URL: /mr/package/<package>/<version>/binpackages
http status codes: 200 500 404 304
summary: list all binary packages associated with this source package at that version
{   '_comment': "yadayadayda",
    'package': "tor",
    'version': "0.2.1.22-1",
    'result':
        [   { 'name': 'tor'      , 'version': '0.2.1.22-1' },
            { 'name': 'tor-dbg'  , 'version': '0.2.1.22-1' },
            { 'name': 'tor-geoip', 'version': '0.2.1.22-1' },
            ...
        ]
}

URL: /mr/package/<package>/<version>/binfiles/<binpkg>/<binversion>
Options: fileinfo=1  includes fileinfo section
http status codes: 200 500 404 304
summary: list all files associated with a binary package
{   '_comment': "yadayadayda",
    'package': "tor",
    'version': "0.2.1.22-1",
    'binary': "tor",
    'binary-version': '0.2.1.22-1',
    'result':
        [   { 'architecture': 'mipsel', hash: '2a3f98cce2f8054621e53d91c7c02d7125ea9c82' },
            { 'architecture': 'hurd-i386', hash: 'a4e9f6abf9664a44f7c94208a236464a59a68103' },
            { 'architecture': 'mips', hash: 'a2bfcdb202331e52b0a50cbce02623083328237e' },
            ...
        ]
}

URL: /mr/package/<package>/<version>/allfiles
Options: fileinfo=1  includes fileinfo section
http status codes: 200 500 404 304
summary: list all files associated with this source package at that version
{   '_comment': "yadayadayda",
    'package': "tor",
    'version': "0.2.1.22-1",
    'result': {
        'source':
            [   { 'hash': "4955b5f663b9dccc84d7c264da9c483330ed3fdf" },
                { 'hash': "b4e15cbc18155955311207a3b5db0aeb6680ecaf" },
                { 'hash': "3beaecd47f4c0d3d5d182ef8d47166a81f9f62eb" },
                ..
            ]
        'binaries':
            [   { 'name': 'tor',
                  'version': '0.2.1.22-1',
                  'files':
                      [   { 'architecture': 'mipsel', hash: '2a3f98cce2f8054621e53d91c7c02d7125ea9c82' },
                          { 'architecture': 'hurd-i386', hash: 'a4e9f6abf9664a44f7c94208a236464a59a68103' },
                          ..
                      ]
                },
                { 'name": 'tor-geoipdb',
                  'version': '0.2.1.22-1',
                  'files':
                      [   { 'architecture': 'all', hash: '1d8b7383b100f00a1b99664dd38914081e929aaf' },
                          ..
                      ]
                },
            ...
            ]
    }
}

URL: /mr/binary/<binary>/
http status codes: 200 500 404 304
summary: find binary package versions and corresponding source names and versions
{   '_comment': "foo",
    'binary': "keylookup",
    'result': [ {
                 'name': "keylookup",
                 'binary_version': "2.0-2",
                 'source': "keylookup",
                 'version': "2.0-2"},
                {
                 'name': "keylookup",
                 'binary_version': "2.2-2",
                 'source': "keylookup",
                 'version': "2.2-2"},
                {
                 'name': "keylookup",
                 'binary_version': "3.0-1",
                 'source': "signing-party",
                 'version': "0.4.2-1"},
                ...
              ]
}





URL: /file/<hash>
http status codes: 200 500 404 403 304
[return the file]

URL: /mr/file/<hash>/info
http status codes: 200 500 404 304
{   '_comment': "yadayadayda",
    'hash': "bae0f2e5bbedf1fcbdc88061f3f5b1f916824522",
    'result':
        [   {   'archive_name': 'debian-security',
                'name': 'xulrunner_1.9.0.12.orig.tar.gz',
                'path': '/pool/updates/main/x/xulrunner',
                'size': 43962222,
                'first_seen': '20090723T101051Z'},
            {   'archive_name': 'debian',
                'name': 'iceweasel_3.0.12.orig.tar.gz',
                'path': '/pool/main/i/iceweasel',
                'size': 43962222,
                'first_seen': '20090801T192339Z'},
            {   'archive_name': 'debian',
                'name': 'xulrunner_1.9.0.12.orig.tar.gz',
                'path': '/pool/main/x/xulrunner',
                'size': 43962222,
                'first_seen': '20090801T192339Z'}
       ]
}



Fileinfo section:

An additional block in the result hash, listing for each hash when it was seen
similar to the result attribute in /file/<hash>/info's result:

{   '_comment': 'foo',
    'fileinfo':
        {   '03bac2ae872d47ebaba2a7d90e242e89e420d33a': [{'archive_name': 'debian',
                                                          'name': 'tor_0.2.1.23.orig.tar.gz',
                                                          'path': '/pool/main/t/tor',
                                                          'run': '20100215T155930Z',
                                                          'size': 2396565}],
            '0588383298e7fe2bfd62fd2838057489bfd3d2ac': [{'archive_name': 'debian',
                                                          'name': 'tor_0.2.1.23-2_sparc.deb',
                                                          'path': '/pool/main/t/tor',
                                                          'run': '20100218T221946Z',
                                                          'size': 1502742}],
            ...
            }
    'result': ...
}

# vim:set et:
# vim:set ts=4:
# vim:set shiftwidth=4:
