NGSI Go Quick Start Guide

Add a broker

You register an alias to access the broker.

ngsi broker add --host letsfiware --brokerHost http://localhost:1026 --ngsiType v2

Get broker version by using an alias

You can get the version by using the alias letsfiware.

ngsi version -h letsfiware
{
"orion" : {
  "version" : "3.1.0",
  "uptime" : "0 d, 0 h, 0 m, 10 s",
  "git_hash" : "260505c911ecf204ebcf0bd31788013c225da6dd",
  "compile_time" : "Wed Jun 9 12:59:59 UTC 2021",
  "compiled_by" : "root",
  "compiled_in" : "e11ec65d5407",
  "release_date" : "Wed Jun 9 12:59:59 UTC 2021",
  "machine" : "x86_64",
  "doc" : "https://fiware-orion.rtfd.io/en/3.1.0/",
  "libversions": {
     "boost": "1_66",
     "libcurl": "libcurl/7.61.1 OpenSSL/1.1.1g zlib/1.2.11 nghttp2/1.33.0",
     "libmicrohttpd": "0.9.70",
     "openssl": "1.1",
     "rapidjson": "1.1.0",
     "mongoc": "1.17.4",
     "bson": "1.17.4"
  }
}
}

Once you access the broker, you can omit to specify the broker.

ngsi version

If you want to check the current default settings, you can run the following command.

ngsi settings list

Create a entity

ngsi create entity --keyValues \
--data ' {
      "id":"urn:ngsi-ld:Product:110",
      "type":"Product",
      "name": "Lemonade",
      "size": "S",
      "price": 99
}'

Get a entity

ngsi get entity --id urn:ngsi-ld:Product:110 --type Product
{"id":"urn:ngsi-ld:Product:110","type":"Product","name":{"type":"Text","value":"Lemonade","metadata":{}},"price":{"type":"Number","value":99,"metadata":{}},"size":{"type":"Text","value":"S","metadata":{}}}

Update attribute

ngsi update attr --id urn:ngsi-ld:Product:110 --attr price --data 11

Get a entity (keyValues)

ngsi get entity --id urn:ngsi-ld:Product:110 --keyValues
{"id":"urn:ngsi-ld:Product:110","name":"Lemonade","price":11,"size":"S","type":"Product"}
ngsi wc entities --type Product
10

Delete a entity

ngsi delete entity --id urn:ngsi-ld:Product:110
ngsi wc entities --type Product
9