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
Body:
------BOUNDARY
Content-Disposition: form-data; name="file"; filename="bundles.zip"
Content-Type: application/x-zip-compressed
BINARY DATA HERE

------BOUNDARY--


Response (Success)
------------------
{"file":"bundles.zip","name":"bundles.zip","type":".zip"}

Response (Error)
------------------
{"error":"error message here"}

Query Packages

Search for packages in the registry.

Request
-------
GET /resources/jsregistry/packs?filter=name%20like%20"b*"&range=0-1&sort=+id

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"
	}]
}
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, e.g:

+title,-id means sort 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}

for example
GET /resources/jsregistry/packs/basemaptoggler@3.1.0-SNAPSHOT

Response
--------
{
	"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.

Request
-------
DELETE /resources/jsregistry/packs/{id}

for example
DELETE /resources/jsregistry/packs/mybundle@1.0.0

Response
--------
204 No Content

Get Package Info (package.json)

Returns package info identified by the package id.

Request
-------
GET /resources/jsregistry/packs/{id}/info

for example
GET /resources/jsregistry/packs/basemaptoggler@3.1.0-SNAPSHOT/info

Response
--------
{
	"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.

Request
-------
GET /resources/jsregistry/packs/{id}/deps

for example
GET /resources/jsregistry/packs/basemaptoggler@3.1.0-SNAPSHOT/deps

Response
--------
{
	"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.

Request
-------
GET /resources/jsregistry/packs/{id}/files

for example
GET /resources/jsregistry/packs/Bookmark@1.0.0-beta/files

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
	}]
}

Query Files

Search for all files in the database.

Request
-------
GET /resources/jsregistry/files?filter=id%20like%20"B*"&range=0-1&sort=+id

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
	}]
}
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") which means: 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, e.g:

+title,-id means sort 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 File

Returns a file description identified by its id.

Request
-------
GET /resources/jsregistry/files/{id}

for example
GET /resources/jsregistry/files/Bookmark@1.0.0-beta@MAIN

Response
--------
{
	"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
}

Download File

Downloads a file identified by its id.

Request
-------
GET /resources/jsregistry/files/{id}/download

for example
GET /resources/jsregistry/files/Bookmark@1.0.0-beta@MAIN/download

Response
--------
Binary data