Commit 9aca9687 by jpalanca

Add README.md

parents
FIWARE deployment
=================
`docker-compose up`
Note:
It's recommended to expand the virtual memory of the OS executing docker:
1. Put `sysctl -w vm.max_map_count=262144` at `/etc/sysctl.conf`
2. Reboot
Port to interact with FIWARE:
1026 -> Orion (general)
4200 -> CrateDB (to check temporal data)
3003 y 3000 -> Grafana
Examples
========
Create product
--------------
curl -X POST \
http://localhost:1026/v2/entities \
-H 'Content-Type: application/json' \
-H 'fiware-service: sensores' \
-H 'fiware-servicepath: /' \
-d '{
"id": "urn:ngsi-ld:Product:001",
"type": "Product",
"name": {
"type": "Text",
"value": "Lumber"
},
"size": {
"type": "Text",
"value": "S"
},
"quantity": {
"type": "Integer",
"value": 1
}
}'
Verify product
--------------
curl -X GET \
http://localhost:1026/v2/entities/urn:ngsi-ld:Product:001 \
-H 'fiware-path: /' \
-H 'fiware-service: sensores'
Subscribe quantity to quantumleap
---------------------------------
curl -X POST \
http://localhost:1026/v2/subscriptions/ \
-H 'Content-Type: application/json' \
-H 'fiware-service: sensores' \
-H 'fiware-servicepath: /' \
-d '{
"description": "Notify QuantumLeap of count changes of any Sensor",
"subject": {
"entities": [
{
"idPattern": ".*"
}
],
"condition": {
"attrs": [
"quantity"
]
}
},
"notification": {
"http": {
"url": "http://quantumleap:8668/v2/notify"
},
"attrs": [
"quantity"
],
"metadata": ["dateCreated", "dateModified"]
},
"throttling": 1
}'
Subscribe quantity and size to quantumleap
------------------------------------------
curl -X POST \
http://localhost:1026/v2/subscriptions/ \
-H 'Content-Type: application/json' \
-H 'fiware-service: sensores' \
-H 'fiware-servicepath: /' \
-d '{
"description": "Notify QuantumLeap of count changes of any Sensor",
"subject": {
"entities": [
{
"idPattern": ".*"
}
],
"condition": {
"attrs": [
"quantity", "size"
]
}
},
"notification": {
"http": {
"url": "http://quantumleap:8668/v2/notify"
},
"attrs": [
"quantity"
],
"metadata": ["dateCreated", "dateModified"]
}
}'
Modify quantity
---------------
curl -X PUT \
http://localhost:1026/v2/entities/urn:ngsi-ld:Product:001/attrs/quantity/value \
-H 'Content-Type: text/plain' \
-H 'fiware-path: /' \
-H 'fiware-service: sensores' \
-d $1
Modify quantity and size
------------------------
curl -iX PATCH \
--url 'http://localhost:1026/v2/entities/urn:ngsi-ld:Product:001/attrs' \
-H 'Content-Type: application/json' \
-H 'fiware-path: /' \
-H 'fiware-service: sensores' \
--data ' {
"quantity":{"type":"Integer", "value": '$1'},
"size": {"type":"Text", "value": "'$2'"}
}'
Active subscriptions
--------------------
curl -X GET \
http://localhost:1026/v2/subscriptions/ \
-H 'fiware-service: sensores' \
-H 'fiware-servicepath: /'
Query temporal serie of quantity
--------------------------------
curl -X GET \
'http://localhost:8668/v2/entities/urn:ngsi-ld:Product:001/attrs/quantity?lastN=1000' \
-H 'Accept: application/json' \
-H 'Fiware-Service: sensores' \
-H 'Fiware-ServicePath: /' \
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment