CLI tool for GeonicDB — a FIWARE Orion compatible Context Broker.
Supports the NGSI-LD API.
npm install -g @geolonia/geonicdb-cliOr run directly with npx:
npx @geolonia/geonicdb-cli <command>The CLI is available as geonic.
# Set the server URL
geonic config set url http://localhost:3000
# Create an entity
geonic entities create '{"id":"Room1","type":"Room","temperature":{"value":23,"type":"Number"}}'
# List entities
geonic entities list
# Get an entity by ID
geonic entities get Room1
# Update attributes
geonic entities update Room1 '{"temperature":{"value":25,"type":"Number"}}'
# Delete an entity
geonic entities delete Room1The CLI provides built-in help in wp-cli style. Use geonic help to explore available commands:
# Show all available commands
geonic help
# Get help on a specific command
geonic help entities
# Get help on a subcommand
geonic help entities list
# Works with nested commands too
geonic help admin tenantsYou can also use --help on any command:
geonic entities --help
geonic entities list --help| Option | Description |
|---|---|
-u, --url <url> |
Base URL of the GeonicDB server |
-s, --service <name> |
NGSILD-Tenant header |
--token <token> |
Authentication token |
-p, --profile <name> |
Use a named profile |
--api-key <key> |
API key for authentication |
-f, --format <fmt> |
Output format: json, table, geojson |
--no-color |
Disable color output |
-v, --verbose |
Verbose output |
--dry-run |
Print the equivalent curl command without executing |
Options are resolved in this order (first wins):
- Command-line flags
- Config file (
~/.config/geonic/config.json) - Defaults (
format=json)
geonic help [<command>] [<subcommand>]| Subcommand | Description |
|---|---|
config set <key> <value> |
Save a config value |
config get <key> |
Get a config value |
config list |
List all config values |
config delete <key> |
Delete a config value |
| Subcommand | Description |
|---|---|
profile list |
List all profiles |
profile use <name> |
Switch active profile |
profile create <name> |
Create a new profile |
profile delete <name> |
Delete a profile |
profile show [name] |
Show profile settings |
| Subcommand | Description |
|---|---|
auth login |
Authenticate and save token |
auth logout |
Clear saved authentication token |
The auth login command reads GDB_EMAIL and GDB_PASSWORD environment variables. It also supports OAuth Client Credentials flow with --client-id and --client-secret.
geonic meDisplays the current authenticated user, token expiry, and active profile.
| Subcommand | Description |
|---|---|
entities list |
List entities |
entities get <id> |
Get an entity by ID |
entities create [json] |
Create a new entity |
entities update <id> [json] |
Update attributes (PATCH) |
entities replace <id> [json] |
Replace all attributes (PUT) |
entities upsert [json] |
Create or update entities |
entities delete <id> |
Delete an entity by ID |
entities list supports filtering options: --type, --id-pattern, --query, --attrs, --georel, --geometry, --coords, --spatial-id, --limit, --offset, --order-by, --count.
| Subcommand | Description |
|---|---|
entities attrs list <entityId> |
List all attributes |
entities attrs get <entityId> <attrName> |
Get a specific attribute |
entities attrs add <entityId> [json] |
Add attributes |
entities attrs update <entityId> <attrName> [json] |
Update an attribute |
entities attrs delete <entityId> <attrName> |
Delete an attribute |
| Subcommand | Description |
|---|---|
entityOperations create [json] |
Batch create entities |
entityOperations upsert [json] |
Batch upsert entities |
entityOperations update [json] |
Batch update entities |
entityOperations delete [json] |
Batch delete entities |
entityOperations query [json] |
Batch query entities |
entityOperations merge [json] |
Batch merge entities |
batch is available as an alias for entityOperations.
| Subcommand | Description |
|---|---|
sub list |
List subscriptions |
sub get <id> |
Get a subscription by ID |
sub create [json] |
Create a subscription |
sub update <id> [json] |
Update a subscription |
sub delete <id> |
Delete a subscription |
| Subcommand | Description |
|---|---|
reg list |
List registrations |
reg get <id> |
Get a registration by ID |
reg create [json] |
Create a registration |
reg update <id> [json] |
Update a registration |
reg delete <id> |
Delete a registration |
| Subcommand | Description |
|---|---|
types list |
List available entity types |
types get <typeName> |
Get details for a type |
| Subcommand | Description |
|---|---|
temporal entities list |
List temporal entities |
temporal entities get <id> |
Get a temporal entity by ID |
temporal entities create [json] |
Create a temporal entity |
temporal entities delete <id> |
Delete a temporal entity |
Temporal entities list/get support: --time-rel, --time-at, --end-time-at, --last-n.
| Subcommand | Description |
|---|---|
temporal entityOperations query [json] |
Query temporal entities (POST) |
Temporal entityOperations query supports: --aggr-methods, --aggr-period.
| Subcommand | Description |
|---|---|
snapshots list |
List snapshots |
snapshots get <id> |
Get a snapshot by ID |
snapshots create |
Create a new snapshot |
snapshots delete <id> |
Delete a snapshot |
snapshots clone <id> |
Clone a snapshot |
| Subcommand | Description |
|---|---|
rules list |
List all rules |
rules get <id> |
Get a rule by ID |
rules create [json] |
Create a new rule |
rules update <id> [json] |
Update a rule |
rules delete <id> |
Delete a rule |
rules activate <id> |
Activate a rule |
rules deactivate <id> |
Deactivate a rule |
| Subcommand | Description |
|---|---|
custom-data-models list |
List all models |
custom-data-models get <id> |
Get a model by ID |
custom-data-models create [json] |
Create a new model |
custom-data-models update <id> [json] |
Update a model |
custom-data-models delete <id> |
Delete a model |
models is available as an alias for custom-data-models.
| Subcommand | Description |
|---|---|
catalog get |
Get the catalog |
catalog datasets list |
List all datasets |
catalog datasets get <id> |
Get a dataset by ID |
catalog datasets sample <id> |
Get sample data for a dataset |
| Subcommand | Description |
|---|---|
admin tenants list |
List all tenants |
admin tenants get <id> |
Get a tenant by ID |
admin tenants create [json] |
Create a new tenant |
admin tenants update <id> [json] |
Update a tenant |
admin tenants delete <id> |
Delete a tenant |
admin tenants activate <id> |
Activate a tenant |
admin tenants deactivate <id> |
Deactivate a tenant |
| Subcommand | Description |
|---|---|
admin users list |
List all users |
admin users get <id> |
Get a user by ID |
admin users create [json] |
Create a new user |
admin users update <id> [json] |
Update a user |
admin users delete <id> |
Delete a user |
admin users activate <id> |
Activate a user |
admin users deactivate <id> |
Deactivate a user |
admin users unlock <id> |
Unlock a user |
| Subcommand | Description |
|---|---|
admin policies list |
List all policies |
admin policies get <id> |
Get a policy by ID |
admin policies create [json] |
Create a new policy |
admin policies update <id> [json] |
Update a policy |
admin policies delete <id> |
Delete a policy |
admin policies activate <id> |
Activate a policy |
admin policies deactivate <id> |
Deactivate a policy |
| Subcommand | Description |
|---|---|
admin oauth-clients list |
List all OAuth clients |
admin oauth-clients get <id> |
Get an OAuth client by ID |
admin oauth-clients create [json] |
Create a new OAuth client |
admin oauth-clients update <id> [json] |
Update an OAuth client |
admin oauth-clients delete <id> |
Delete an OAuth client |
| Subcommand | Description |
|---|---|
admin cadde get |
Get CADDE configuration |
admin cadde set [json] |
Set CADDE configuration |
admin cadde delete |
Delete CADDE configuration |
geonic healthgeonic versionCommands that accept JSON data support multiple input methods. The [json] argument is optional — when omitted, the CLI auto-detects piped stdin or launches interactive mode.
Inline JSON / JSON5
# Standard JSON
geonic entities create '{"id":"Room1","type":"Room"}'
# JSON5 — unquoted keys, single quotes, trailing commas, comments
geonic entities create "{id: 'Room1', type: 'Room',}"JSON5 syntax is supported everywhere JSON is accepted (inline, files, stdin, interactive).
File input (prefix with @)
geonic entities create @payload.jsonStdin (auto-detect)
When no argument is given and stdin is piped, the CLI reads from stdin automatically — no - required:
cat payload.json | geonic entities create
echo '{"id":"Room1","type":"Room"}' | geonic entities createThe explicit - marker is still supported for backward compatibility:
cat payload.json | geonic entities create -Interactive mode
When no argument is given and the terminal is a TTY (no pipe), the CLI enters interactive mode with a json> prompt. Type or paste JSON and the input auto-submits when braces/brackets are balanced:
$ geonic entities create
Enter JSON (auto-submits when braces close, Ctrl+C to cancel):
json> {
... "id": "Room1",
... "type": "Room"
... }
Entity created.
Specify the output format with --format or geonic config set format <fmt>.
| Format | Description |
|---|---|
json |
Pretty-printed JSON (default) |
table |
ASCII table |
geojson |
GeoJSON FeatureCollection |
Use --key-values on entities list and entities get to request simplified key-value format from the API.
Use --dry-run on any command to print the equivalent curl command instead of executing the request. The output can be copied and run directly in a terminal.
$ geonic entities list --type Sensor --dry-run
curl \
-H 'Content-Type: application/ld+json' \
-H 'Accept: application/ld+json' \
-H 'Authorization: Bearer <token>' \
'http://localhost:3000/ngsi-ld/v1/entities?type=Sensor'Works with all operations including POST with body:
$ geonic entities create '{"id":"Room1","type":"Room"}' --dry-run
curl \
-X POST \
-H 'Content-Type: application/ld+json' \
-H 'Accept: application/ld+json' \
-d '{"id":"Room1","type":"Room"}' \
'http://localhost:3000/ngsi-ld/v1/entities'The CLI stores configuration in ~/.config/geonic/config.json.
# Set the default server
geonic config set url http://localhost:3000
# Set default output format
geonic config set format table
# View all settings
geonic config listOverride the config directory with the GEONIC_CONFIG_DIR environment variable:
GEONIC_CONFIG_DIR=/path/to/config geonic entities listRequires Node.js >= 20.
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Lint
npm run lint
# Type check
npm run typecheck
# Watch mode (rebuild on change)
npm run devUse npm link to register the geonic command globally as a symlink:
npm linkAfter linking, rebuild to reflect code changes:
npm run build
geonic helpTo unlink:
npm unlink -g @geolonia/geonicdb-cliMIT