Management REST Interface
The base endpoint of the JS Registry is http://<server>:<port>/<contextname>/resources/jsregistry
The management resource endpoints are:
<base>/upload
-
upload new packages
<base>/packs
-
flat search and delete packages
<base>/files
-
search and delete uploaded file content
Upload Packages
This endpoint allows the upload of a zip or JAR archive containing packages. There are no special requirements to the directory structure of the zip file. After the upload the archive is extracted and scanned for packages. Packages being detected are imported into the registry.
POST /resources/jsregistry/upload
Content-Type: multipart/form-data; boundary=----BOUNDARY
------BOUNDARY
Content-Disposition: form-data; name="file"; filename="bundles.zip"
Content-Type: application/x-zip-compressed
BINARY DATA HERE
------BOUNDARY--
{"file":"bundles.zip","name":"bundles.zip","type":".zip"}
{"error":"error message here"}
Query Packages
Search for packages in the registry.
GET /resources/jsregistry/packs?filter=name%20like%20"b*"&range=0-1&sort=+id
{
"total": 5,
"items": [{
"id": "basemapgallery@3.1.0-SNAPSHOT",
"name": "basemapgallery",
"main": "main",
"layer": "module",
"title": "Basemap Gallery",
"description": "A user can open a gallery of available basemaps and select one for further use as a background map.",
"createdBy": "",
"createdAt": 1405002216855,
"modifiedBy": "",
"modifiedAt": 1405002216855,
"location": "file:webapp_js:bundles/basemaps/basemapgallery",
"version": "3.1.0-SNAPSHOT"
},
{
"id": "basemaptoggler@3.1.0-SNAPSHOT",
"name": "basemaptoggler",
"main": "main",
"layer": "module",
"title": "Basemap Toggler",
"description": "The Basemap Toggler provides different UI elements for switching between basemaps.",
"createdBy": "",
"createdAt": 1405002216373,
"modifiedBy": "",
"modifiedAt": 1405002216373,
"location": "file:webapp_js:bundles/basemaps/basemaptoggler",
"version": "3.1.0-SNAPSHOT"
}]
}
Name | Default | Description |
---|---|---|
|
A filter query expression that allows to search for packages with special properties. Simple Query:
Simple Queries can be combined using
|
|
|
|
A comma separated list of property names prefixed by
|
|
|
This is a range expression to allow paging through the result list. The formal definition of the range expression is:
|
Get Package
Access a package identified by its ID.
GET /resources/jsregistry/packs/{id}
//GET /resources/jsregistry/packs/basemaptoggler@3.1.0-SNAPSHOT
{
"id": "basemaptoggler@3.1.0-SNAPSHOT",
"name": "basemaptoggler",
"main": "main",
"layer": "module",
"title": "Basemap Toggler",
"description": "The Basemap Toggler provides different UI elements for switching between basemaps.",
"createdBy": "",
"createdAt": 1405002216373,
"modifiedBy": "",
"modifiedAt": 1405002216373,
"location": "file:webapp_js:bundles/basemaps/basemaptoggler",
"version": "3.1.0-SNAPSHOT"
}
Delete Package
Packages with the "location"
value db
can be deleted.
DELETE /resources/jsregistry/packs/{id}
// DELETE /resources/jsregistry/packs/mybundle@1.0.0
204 No Content
Get Package Info (package.json)
Returns package info identified by the package ID.
GET /resources/jsregistry/packs/{id}/info
// GET /resources/jsregistry/packs/basemaptoggler@3.1.0-SNAPSHOT/info
{
"name": "basemaptoggler",
"version": "3.1.0-SNAPSHOT",
"title": "Basemap Toggler",
"description": "The Basemap Toggler provides different UI elements for switching between basemaps.",
"vendor": "con terra GmbH",
"keywords": ["mapping"],
"layer": "module",
"main": "main",
"i18n": ["bundle"],
"dependencies": {
"map": ">=3.1.0-SNAPSHOT"
},
"components": [{
"name": "BasemapModel",
"provides": ["basemaptoggler.BasemapModel"]
},
...
]
}]
}
Get Package Dependencies
The dependencies which are directly declared by the bundle are returned.
GET /resources/jsregistry/packs/{id}/deps
// GET /resources/jsregistry/packs/basemaptoggler@3.1.0-SNAPSHOT/deps
{
"total": 1,
"items": [{
"name": "map",
"optional": false,
"scope": "RUNTIME",
"version": ">=3.1.0-SNAPSHOT"
}]
}
Get Package Files
The files imported into the database and/or available for download are returned.
GET /resources/jsregistry/packs/{id}/files
// GET /resources/jsregistry/packs/Bookmark@1.0.0-beta/files
{
"total": 2,
"items": [{
"id": "Bookmark@1.0.0-beta@MAIN",
"packageId": "Bookmark@1.0.0-beta",
"name": "MAIN",
"checksumAlg": "SHA1",
"checksum": "9cf9688436b1d5409137d12ca9488299f90b58ab",
"dataType": "zip",
"dataSize": 283350,
"modifiedAt": 1405000844820
},
{
"id": "Bookmark@1.0.0-beta@NPM_DIST",
"packageId": "Bookmark@1.0.0-beta",
"name": "NPM_DIST",
"checksumAlg": "SHA1",
"checksum": "eb6913b029214805ae375549945a78f4149542df",
"dataType": "tgz",
"dataSize": 277618,
"modifiedAt": 1405000844836
}]
}
Query Files
Search for all files in the database.
GET /resources/jsregistry/files?filter=id%20like%20"B*"&range=0-1&sort=+id
{
"total": 2,
"items": [{
"id": "Bookmark@1.0.0-beta@MAIN",
"packageId": "Bookmark@1.0.0-beta",
"name": "MAIN",
"checksumAlg": "SHA1",
"checksum": "9cf9688436b1d5409137d12ca9488299f90b58ab",
"dataType": "zip",
"dataSize": 283350,
"modifiedAt": 1405000844820
},
{
"id": "Bookmark@1.0.0-beta@NPM_DIST",
"packageId": "Bookmark@1.0.0-beta",
"name": "NPM_DIST",
"checksumAlg": "SHA1",
"checksum": "eb6913b029214805ae375549945a78f4149542df",
"dataType": "tgz",
"dataSize": 277618,
"modifiedAt": 1405000844836
}]
}
Name | Default | Description |
---|---|---|
|
A filter query expression that allows to search for files with special properties. Simple Query:
Simple Queries can be combined using
|
|
|
|
A comma separated list of property names prefixed by
|
|
|
This is a range expression to allow paging through the result list. The definition of the range expression is:
|
Get File
Returns a file description identified by its ID.
GET /resources/jsregistry/files/{id}
//GET /resources/jsregistry/files/Bookmark@1.0.0-beta@MAIN
{
"id": "Bookmark@1.0.0-beta@MAIN",
"packageId": "Bookmark@1.0.0-beta",
"name": "MAIN",
"checksumAlg": "SHA1",
"checksum": "9cf9688436b1d5409137d12ca9488299f90b58ab",
"dataType": "zip",
"dataSize": 283350,
"modifiedAt": 1405000844820
}