Mirrors API

Mirror management via REST API.

Create

POST /api/mirrors

Create empty mirror with specified parameters (see also aptly repo create).

JSON body params:

NameTypeDescription
Namerequired, stringmirror name
ArchiveURLrequired, stringurl of the archive to mirror e.g. http://deb.debian.org/debian/
Distributionstringdistribution name to mirror e.g. buster, for flat repositories use ./ instead of distribution name
Filterstringpackage query that is applied to packages in the mirror
Components[]stringcomponents to mirror, if not specified aptly would fetch all components
Architectures[]stringlimit mirror to those architectures, if not specified aptly would fetch all architectures
Keyrings[]stringgpg keyring(s) to use when verifying Release file
DownloadSourcesboolwhether to mirror sources
DownloadUdebsboolwhether to mirror .udeb packages (Debian installer support)
DownloadInstallerboolwhether to download additional not packaged installer files
FilterWithDepsboolwhen filtering, include dependencies of matching packages as well
SkipComponentCheckboolwhether to skip if the given components are in the Release file
IgnoreSignaturesboolwhether to skip the verification of Release file signatures

HTTP Errors:

CodeDescription
400mirror creation failed

Example:

$ curl -X POST -H 'Content-Type: application/json' --data '{"Name": "aptly-mirror", "ArchiveURL": "http://security.debian.org/debian-security/", "Distribution": "buster/updates", "Components": ["main"]}' http://localhost:8080/api/mirrors
{"UUID":"2dcc40c2-68e2-402c-a73b-af242b648452","Name":"aptly-mirror","ArchiveRoot":"http://security.debian.org/debian-security/","Distribution":"buster/updates","Components":["main"],"Architectures":["amd64","arm64","armhf","i386"],"Meta":{"Acquire-By-Hash":"yes","Architectures":"amd64 arm64 armhf i386","Codename":"buster","Components":"updates/main updates/contrib updates/non-free","Date":"Wed, 08 Mar 2023 23:32:32 UTC","Description":" Debian 10 - Security Updates\n","Label":"Debian-Security","Origin":"Debian","Suite":"oldstable","Valid-Until":"Wed, 15 Mar 2023 23:32:32 UTC","Version":"10"},"LastDownloadDate":"0001-01-01T00:00:00Z","Filter":"","Status":0,"WorkerPID":0,"FilterWithDeps":false,"SkipComponentCheck":false,"SkipArchitectureCheck":false,"DownloadSources":false,"DownloadUdebs":false,"DownloadInstaller":false}

Show

GET /api/mirrors/:name

Returns basic information about a mirror.

HTTP Errors:

CodeDescription
404mirror with such name doesn’t exist

Example:

curl http://localhost:8080/api/mirrors/aptly-mirror
{"UUID":"2dcc40c2-68e2-402c-a73b-af242b648452","Name":"aptly-mirror","ArchiveRoot":"http://security.debian.org/debian-security/","Distribution":"buster/updates","Components":["main"],"Architectures":["amd64","arm64","armhf","i386"],"Meta":{"Acquire-By-Hash":"yes","Architectures":"amd64 arm64 armhf i386","Codename":"buster","Components":"updates/main updates/contrib updates/non-free","Date":"Wed, 08 Mar 2023 23:32:32 UTC","Description":" Debian 10 - Security Updates\n","Label":"Debian-Security","Origin":"Debian","Suite":"oldstable","Valid-Until":"Wed, 15 Mar 2023 23:32:32 UTC","Version":"10"},"LastDownloadDate":"0001-01-01T00:00:00Z","Filter":"","Status":0,"WorkerPID":0,"FilterWithDeps":false,"SkipComponentCheck":false,"SkipArchitectureCheck":false,"DownloadSources":false,"DownloadUdebs":false,"DownloadInstaller":false}

Show packages/search

GET /api/mirrors/:name/packages

List all packages in a mirror or perform search on repository contents and return result.

Query params:

NameDescription
qpackage query, if missing - return all packages
withDepsset to 1 to include dependencies when evaluating package query
formatresult format, compact by default (only package keys), details to return full information about each package (might be slow on large repos)

Example:

$ curl http://localhost:8080/api/mirrors/aptly-mirror/packages
["Pi386 aptly 0.8 966561016b44ed80"]

$ curl http://localhost:8080/api/mirrors/aptly-mirror/packages?q=aptly
["Pi386 aptly 0.8 966561016b44ed80"]

$ curl http://localhost:8080/api/mirrors/aptly-mirror/packages?format=details
[{"Architecture":"i386","Description":" Debian repository management tool\n","Filename":"aptly_0.8_i386.deb","FilesHash":"966561016b44ed80","Homepage":"http://www.aptly.info/","Installed-Size":"11084","Key":"Pi386 aptly 0.8 966561016b44ed80","License":"MIT","MD5sum":"b9be9ed873f1a05da103406cc0a6b9d1","Maintainer":"Andrey Smirnov \u003cme@smira.ru\u003e","Package":"aptly","Priority":"extra","Recommends":"bzip2","SHA1":" 257ab261adcf5dd5bda800976ae606fedb882679","SHA256":" 6342804c7f6bd8cb004ca9d19a7e27f492b7e07843b935a4f96a07a254ae6312","Section":"default","ShortKey":"Pi386 aptly 0.8","Size":"3510032","Vendor":"Andrey Smirnov \u003cme@smira.ru\u003e","Version":"0.8"}]

Edit

PUT /api/mirrors/:name

This api has two functionalities:

  1. Update mirror meta information.
  2. Download packages from the archive to mirror

When updating a mirror, the packages will always be downloaded.

JSON body params:

NameTypeDescription
Namestringmirror name
ArchiveURLstringurl of the archive to mirror e.g. http://deb.debian.org/debian/
Filterstringpackage query that is applied to packages in the mirror
Components[]stringcomponents to mirror, if not specified aptly would fetch all components
Architectures[]stringlimit mirror to those architectures, if not specified aptly would fetch all architectures
Keyrings[]stringgpg keyring(s) to use when verifying Release file
DownloadSourcesboolwhether to mirror sources
DownloadUdebsboolwhether to mirror .udeb packages (Debian installer support)
DownloadInstallerboolwhether to download additional not packaged installer files
FilterWithDepsboolwhen filtering, include dependencies of matching packages as well
SkipComponentCheckboolwhether to skip if the given components are in the Release file
IgnoreSignaturesboolwhether to skip the verification of Release file signatures
ForceUpdateboolwhether to force a mirror update even if another process is already updating the mirror (use with caution!)
SkipExistingPackagesboolwhether to not download already downloaded packages

HTTP Errors:

CodeDescription
404mirror with such name doesn’t exist

Response is the same as for GET /api/mirror/:name API.

Example:

$ curl -X PUT http://localhost:8080/api/mirrors/aptly-mirror

List

GET /api/mirrors

Show list of currently available mirrors. Each mirror is returned as in “show” API.

Example:

$ curl http://localhost:8080/api/mirrors
[{"UUID":"2dcc40c2-68e2-402c-a73b-af242b648452","Name":"aptly-mirror","ArchiveRoot":"http://security.debian.org/debian-security/","Distribution":"buster/updates","Components":["main"],"Architectures":["amd64","arm64","armhf","i386"],"Meta":{"Acquire-By-Hash":"yes","Architectures":"amd64 arm64 armhf i386","Codename":"buster","Components":"updates/main updates/contrib updates/non-free","Date":"Wed, 08 Mar 2023 23:32:32 UTC","Description":" Debian 10 - Security Updates\n","Label":"Debian-Security","Origin":"Debian","Suite":"oldstable","Valid-Until":"Wed, 15 Mar 2023 23:32:32 UTC","Version":"10"},"LastDownloadDate":"0001-01-01T00:00:00Z","Filter":"","Status":0,"WorkerPID":0,"FilterWithDeps":false,"SkipComponentCheck":false,"SkipArchitectureCheck":false,"DownloadSources":false,"DownloadUdebs":false,"DownloadInstaller":false}]

Delete

DELETE /api/mirrors/:name

Delete a mirror.

If the mirror is used as a source to createsnapshots, aptly would refuse to delete it by default, but that can be overridden with force flag.

Query params:

NameDescription
forcewhen value is set to 1, delete the mirror even if it has snapshots

HTTP Errors:

CodeDescription
404mirror with such name doesn’t exist
409mirror can’t be dropped (reason in the message)

Example:

$ curl -X DELETE http://localhost:8080/api/mirrors/aptly-mirror