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.

Request
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--
http
Response
{"file":"bundles.zip","name":"bundles.zip","type":".zip"}
json
Response (error)
{"error":"error message here"}
json

Query Packages

Search for packages in the registry.

Request
GET /resources/jsregistry/packs?filter=name%20like%20"b*"&range=0-1&sort=+id
http
Response
{
    "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"
    }]
}
json
Query Parameter
Name Default Description

filter

A filter query expression that allows to search for packages with special properties.

Simple Query:

<property>=<value>, for example version="3.1.0" or title="test"

Simple Queries can be combined using and, or, not operators like:

(and version="3.1.0";name like "b*") which means: return all packages starting with b and version 3.1.0.

sort

+title

A comma separated list of property names prefixed by + or -, which defines the sort order of the response, for example:

+title,-id, for example, sorts based on the title property (ascending) and then remaining equal items after the ID (descending).

range

0-

This is a range expression to allow paging through the result list.

The formal definition of the range expression is: <startindex>-<endindex>.

0- = return all results

0-0 = return the first item

0-1 = return the first two items of the result set

10-12 = return the 10th, 11th, 12th item

0—​1 = return nothing (only return the count)

Get Package

Access a package identified by its ID.

Request
GET /resources/jsregistry/packs/{id}
http
Response
//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"
}
json

Delete Package

Packages with the "location" value db can be deleted.

Request
DELETE /resources/jsregistry/packs/{id}
http
Response
// DELETE /resources/jsregistry/packs/mybundle@1.0.0

204 No Content
http

Get Package Info (package.json)

Returns package info identified by the package ID.

Request
GET /resources/jsregistry/packs/{id}/info
http
Response
// 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"]
    },
    ...
    ]
    }]
}
json

Get Package Dependencies

The dependencies which are directly declared by the bundle are returned.

Request
GET /resources/jsregistry/packs/{id}/deps
http
Response
// GET /resources/jsregistry/packs/basemaptoggler@3.1.0-SNAPSHOT/deps
{
    "total": 1,
    "items": [{
        "name": "map",
        "optional": false,
        "scope": "RUNTIME",
        "version": ">=3.1.0-SNAPSHOT"
    }]
}
json

Get Package Files

The files imported into the database and/or available for download are returned.

Request
GET /resources/jsregistry/packs/{id}/files
http
Response
// 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
    }]
}
json

Query Files

Search for all files in the database.

Request
GET /resources/jsregistry/files?filter=id%20like%20"B*"&range=0-1&sort=+id
http
Response
{
    "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
    }]
}
json
Query Parameter
Name Default Description

filter

A filter query expression that allows to search for files with special properties.

Simple Query:

<property>=<value>, for example dataType="zip"

Simple Queries can be combined using and, or, not operators like:

(and packageId="Bookmark@1.0.0-beta";dataType="zip"): return the zip files for package Bookmark.

sort

+title

A comma separated list of property names prefixed by + or -, which defines the sort order of the response, for example:

+title,-id sorts based on the title property (ascending) and then remaining equal items after the ID (descending).

range

0-

This is a range expression to allow paging through the result list.

The definition of the range expression is: <startindex>-<endindex>.

0- = return all results

0-0 = return the first item

0-1 = return the first two items of the result set

10-12 = return the 10th, 11th, 12th item

0—​1 = return nothing (only return the count)

Get File

Returns a file description identified by its ID.

Request
GET /resources/jsregistry/files/{id}
http
Response
//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
}
json

Download File

Downloads a file identified by its ID.

Request
GET /resources/jsregistry/files/{id}/download
http
Response
//GET /resources/jsregistry/files/Bookmark@1.0.0-beta@MAIN/download

<<binary data>>
plain