Orion-LD issues no notification send to subscription - fiware

Update 2
The issues might be the use of the the Orion-LD (1.0.0), when i use the 0.8.0 all the example is working.
https://github.com/kosgobakis/orion-ldSubcription
My setup is:
The Things Network (LoraWAN)
IoT Agent for LoraWAN supporting TTN and NGSI-LD GitHub
Orion-LD
Quantumleap + cratedb
Minimal web server to provide JSONLD
Provision of the sensor to the IoT Agent
curl -iL -X POST \
localhost:4041/iot/devices \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
-d '{
"devices": [
{
"device_id": "eui-70b3d57ed004a537",
"entity_name": "urn:ngsi-ld:TemperatureSensor:temperaturesensor001",
"entity_type": "LoraDevice",
"timezone": "Europe/Athens",
"attributes": [
{
"object_id": "temperature_3",
"name": "temperatureCh3",
"type": "Float",
"metadata": {"unitCode": {"type": "Property","value": "CEL"}}
},
{
"object_id": "temperature_5",
"name": "temperatureCh5",
"type": "Float",
"metadata": {"unitCode": {"type": "Property","value": "CEL"}}
}
],
"internal_attributes": {
"lorawan": {
"application_server": {
"host": "eu1.cloud.thethings.network",
"username": "XXXX#ttn",
"password": "XXXX",
"provider": "TTN"
},
"dev_eui": "XXXXX",
"app_eui": "XXXXXX",
"application_id": "XXXXXX#ttn",
"application_key": "XXXXXX",
"data_model": "application_server"
}
},
"protocol": "LORAJSON"
}
]
}'
I successfully receive data from the TTN Network (Simulation of sensor at TTN->IoTAgent->Orion-LD)
curl -X GET 'http://localhost:1026/ngsi-ld/v1/entities/?type=LoraDevice' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
-H 'Link: <http://context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Accept: application/json' |jq .
[
{
"id": "urn:ngsi-ld:TemperatureSensor:temperaturesensor001",
"type": "LoraDevice",
"temperatureCh3": {
"type": "Property",
"value": 27.2,
"observedAt": "2022-01-04T18:54:14.447Z",
"unitCode": "CEL"
},
"temperatureCh5": {
"type": "Property",
"value": 25.5,
"observedAt": "2022-01-04T18:54:14.447Z",
"unitCode": "CEL"
}
}
]
I use the following curl to create a new subscription to the Orion-LD
curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/subscriptions/' \
-H 'Content-Type: application/ld+json' \
-H 'NGSILD-Tenant: openiot' \
--data-raw '{
"description": "Notify me of all changes",
"type": "Subscription",
"entities": [{"type": "LoraDevice"}],
"notification": {
"attributes": ["temperatureCh3"],
"format": "normalized",
"endpoint": {
"uri": "http://quantumleap:8668/v2/notify",
"accept": "application/json"
}
},
"#context": "http://context/ngsi-context.jsonld"
}'
and verify that i have create the subscription
curl -X GET 'http://localhost:1026/ngsi-ld/v1/subscriptions/' \
-H 'NGSILD-Tenant: openiot'|jq .
{
"id": "urn:ngsi-ld:Subscription:61d53fc5fb688acae04cd92f",
"type": "Subscription",
"description": "Notify me of all changes",
"entities": [
{
"type": "LoraDevice"
}
],
"notification": {
"attributes": [
"temperatureCh3"
],
"format": "normalized",
"endpoint": {
"uri": "http://quantumleap:8668/v2/notify",
"accept": "application/json"
}
},
"#context": "http://context/ngsi-context.jsonld"
}
]
Send new measurement (Orion-LD log: Servicing NGSI-LD request 006: POST /ngsi-ld/v1/entityOperations/upsert/), check that the Orion-LD has the new data, but no notification send to the quantumleap
[
{
"id": "urn:ngsi-ld:TemperatureSensor:temperaturesensor001",
"type": "LoraDevice",
"temperatureCh3": {
"type": "Property",
"value": 27.3,
"observedAt": "2022-01-05T06:53:17.572Z",
"unitCode": "CEL"
},
"temperatureCh5": {
"type": "Property",
"value": 25.5,
"observedAt": "2022-01-05T06:53:17.572Z",
"unitCode": "CEL"
}
}
]
I have spend some time changing the subscription request but with no success.
Is something wrong with my subscription request?
Using MongoDB Compass here is the context of the DB
orion-openiot.entities
{
"_id": {
"id": "urn:ngsi-ld:TemperatureSensor:temperaturesensor001",
"type": "https://ngsi-ld-tutorials.readthedocs.io/en/latest/datamodels.html#loraSensors",
"servicePath": "/"
},
"attrNames": ["https://ngsi-ld-tutorials.readthedocs.io/en/latest/datamodels.html#temperature1", "https://ngsi-ld-tutorials.readthedocs.io/en/latest/datamodels.html#temperature2"],
"attrs": {
"https://ngsi-ld-tutorials=readthedocs=io/en/latest/datamodels=html#temperature1": {
"value": 27.3,
"type": "Property",
"md": {
"unitCode": {
"value": "CEL"
},
"observedAt": {
"value": 1641365597.572
}
},
"mdNames": ["unitCode", "observedAt"],
"creDate": 1641365539.6579854,
"modDate": 1641365597.5791261
},
"https://ngsi-ld-tutorials=readthedocs=io/en/latest/datamodels=html#temperature2": {
"value": 25.5,
"type": "Property",
"md": {
"unitCode": {
"value": "CEL"
},
"observedAt": {
"value": 1641365597.572
}
},
"mdNames": ["unitCode", "observedAt"],
"creDate": 1641365539.6579854,
"modDate": 1641365597.5791261
}
},
"creDate": 1641365441.9127274,
"modDate": 1641365597.5791261,
"lastCorrelator": ""
}
orion-openiot.csubs
{
"_id": "urn:ngsi-ld:Subscription:61d53fc5fb688acae04cd92f",
"expiration": 2147483647,
"reference": "http://quantumleap:8668/v2/notify",
"custom": false,
"mimeType": "application/json",
"throttling": 0,
"servicePath": "/",
"description": "Notify me of all changes",
"status": "active",
"entities": [{
"id": "",
"isPattern": "",
"type": "https://ngsi-ld-tutorials.readthedocs.io/en/latest/datamodels.html#loraSensors",
"isTypePattern": false
}],
"attrs": ["https://ngsi-ld-tutorials.readthedocs.io/en/latest/datamodels.html#temperature1"],
"metadata": [],
"blacklist": false,
"ldContext": "http://context/ngsi-context.jsonld",
"createdAt": 1641365445.068897,
"modifiedAt": 1641365445.068897,
"conditions": [],
"expression": {
"q": "",
"mq": "",
"geometry": "",
"coords": "",
"georel": "",
"geoproperty": ""
},
"format": "normalized"
}
Update 1
I run the latest version of the IoTAgent
{"libVersion":"2.18.0-next","port":"4041","baseRoot":"/"}
and a minimal web server to provide JSONLD (http://context/xxxx.jsonld)
When created a minimal jsonld file like you suggested.
The IoT Agent send the following POST to Orion-LD
{
"url": "http://orion:1026/ngsi-ld/v1/entityOperations/upsert/?options=update",
"method": "POST",
"headers": {
"fiware-service": "openiot",
"fiware-servicepath": "/",
"Content-Type": "application/ld+json",
"NGSILD-Tenant": "openiot",
"NGSILD-Path": "/"
},
"json": [
{
"#context": "http://context/minimal.jsonld",
"temperatureCh3": {
"type": "Property",
"value": 436.8,
"unitCode": "CEL",
"observedAt": "2022-01-07T15:24:28.273Z"
},
"temperatureCh5": {
"type": "Property",
"value": 25.5,
"unitCode": "CEL",
"observedAt": "2022-01-07T15:24:28.273Z"
},
"id": "urn:ngsi-ld:TemperatureSensor:temperaturesensor001",
"type": "LoraDevice"
}
]
}
When i run
curl -G -X GET 'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:temperaturesensor001' \
-H 'fiware-service: openiot' \
-H 'Link: <http://context/minimal.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Accept: application/ld+json' | jq .
{
"#context": "http://context/minimal.jsonld",
"id": "urn:ngsi-ld:TemperatureSensor:temperaturesensor001",
"type": "LoraDevice",
"temperatureCh3": {
"value": 436.8,
"type": "Property",
"unitCode": "CEL",
"observedAt": "2022-01-07T15:24:28.273Z"
},
"temperatureCh5": {
"value": 25.5,
"type": "Property",
"unitCode": "CEL",
"observedAt": "2022-01-07T15:24:28.273Z"
}
}
And when i do not supply the correct jsonld file
curl -L -X GET \
'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:temperaturesensor001' \
-H 'fiware-service: openiot' \
-H 'Link: <https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.4.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Accept: application/ld+json'| jq .
i get the full URI
{
"#context": "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.4.jsonld",
"id": "urn:ngsi-ld:TemperatureSensor:temperaturesensor001",
"type": "https://example.com/LoraDevice",
"https://example.com/ch3": {
"value": 436.8,
"type": "Property",
"unitCode": "CEL",
"observedAt": "2022-01-07T15:24:28.273Z"
},
"https://example.com/ch5": {
"value": 25.5,
"type": "Property",
"unitCode": "CEL",
"observedAt": "2022-01-07T15:24:28.273Z"
}
}

The first thing to check is whether the IoT Agent version you are using is supporting NGSI-LD:
curl -X GET \
'http://localhost:4041/iot/about'
Should return:
{
"libVersion": "2.6.0-next",
"port": "4041",
"baseRoot": "/",
"version": "1.6.0-next"
}
The lib-version needs to be 2.15.0 or higher to expose NGSI-LD support. If necessary you can rebuild a latest from the Dockerfile in the IoTagent-LoRaWAN repo to make sure you have all the latest bug fixes from the IoT Agent node lib.
But I think the missing link here is the local #context file you need to provide to supply NGSI-LD data (and indeed any JSON-LD data). This file defines your world in terms of IRIs.
Your LoRaWAN IoT Agent config.js will need an entry to some file on a public server like:
{
contextBroker: {
host: '192.168.1.1',
port: '1026',
ngsiVersion: 'ld',
jsonLdContext: 'http://path/to/your/context.json-ld'
},
Or IOTA_CB_NGSI_VERSION and IOTA_JSON_LD_CONTEXT supplied by environment variables. The file path/to/your/context.json-ld will need to hold key-value entries like:
{
"#context": {
"type": "#type",
"id": "#id",
"ngsi-ld": "https://uri.etsi.org/ngsi-ld/",
"example": "https://example.com/",
"LoraDevice": "example:LoraDevice",
"temperatureCh3": "https://example.com/ch3",
"temperatureCh5": "https://example.com/ch5"
}
}
i.e. one entry for each entity type and one entry for each attribute.
It looks like your #context file is referring to https://fiware.github.io/data-models/context.jsonld which doesn't hold IRI values for your new property names.
When you are provisioning the subscription:
curl -X GET 'http://localhost:1026/ngsi-ld/v1/subscriptions/' \
-H 'NGSILD-Tenant: openiot'|jq .
{
"id": "urn:ngsi-ld:Subscription:61d53fc5fb688acae04cd92f",
"type": "Subscription",
"description": "Notify me of all changes",
"entities": [
{
"type": "LoraDevice"
}
],
"notification": {
"attributes": [
"temperatureCh3"
],
"format": "normalized",
"endpoint": {
"uri": "http://quantumleap:8668/v2/notify",
"accept": "application/json"
}
},
"#context": "http://path/to/your/context.json-ld"
}
]
The attribute names defined in http://path/to/your/context.json-ld are expanded to IRIs. If no matching entry is found then the default context https://uri.etsi.org/ngsi-ld/default-context/ is used (as defined by the #vocab element) , which is not what you want. Define temperatureCh3 and LoraDevice properly and the subscription will work.
As a check, try retrieving an entity without supplying any of your terms in the #context
curl -L -X GET \
'http://localhost:1026/ngsi-ld/v1/entities/urn:ngsi-ld:TemperatureSensor:temperaturesensor001' \
-H 'Link: <https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.4.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Accept: application/ld+json'
All attributes (which are not defined in the core #context) should now return using IRIs - if short names are returned, then the relevant mapping is missing.

I tried to reproduce the problem, pushed a new functest to Orion-LD's develop branch for this purpose:
https://github.com/FIWARE/context.Orion-LD/pull/983
I'm unable to reproduce, so, could you please take a look at the functest I implemented (free from iot-agents, QLs, etc - just the broker, a notification receiver, and curl commands) and propose changes. See if we're able to reproduce the error. Cause if not, if I can't reproduce, then I can't fix ...
Here you can see the functest: https://github.com/FIWARE/context.Orion-LD/pull/983/files#diff-921fc6ab850278cc281e7662f6170be2e3474f95a800000779c1dd9c6c377dd6R1

Related

Orion-QL subscription configuration

I have devices with many IoT-sensors. I want to batch read from these devices and batch write this data to CrateDB. 100 data is obtained from the sensors every 1 second.
How can I take, for example, 5 seconds of batch data (500 data) at once with the Quantum Leap agent and write it to CrateDB?Should I do this configuration in Orion-QL subscription (throttling etc)?
With NGSI-v2 batch update is achieved using the /v2/op/update endpoint e.g. :
curl -L -X POST 'http://localhost:1026/v2/op/update' \
-H 'Content-Type: application/json' \
--data-raw '{
"actionType":"update",
"entities":[
{
"id":"urn:ngsi-ld:Product:001", "type":"Product",
"price":{"type":"Integer", "value": 1199}
},
{
"id":"urn:ngsi-ld:Product:002", "type":"Product",
"price":{"type":"Integer", "value": 1199},
"size": {"type":"Text", "value": "L"}
}
]
}'
With NGSI-LD you can use /ngsi-ld/v1/entityOperations/upsert:
curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/entityOperations/upsert' \
-H 'Content-Type: application/json' \
-H 'Link: <http://path-to-context/ngsi-context.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"' \
-H 'Accept: application/ld+json' \
--data-raw '[
{
"id": "urn:ngsi-ld:TemperatureSensor:002",
"type": "TemperatureSensor",
"category": {
"type": "Property",
"value": "sensor"
},
"temperature": {
"type": "Property",
"value": 21,
"unitCode": "CEL"
}
},
{
"id": "urn:ngsi-ld:TemperatureSensor:003",
"type": "TemperatureSensor",
"category": {
"type": "Property",
"value": "sensor"
},
"temperature": {
"type": "Property",
"value": 27,
"unitCode": "CEL"
}
}
]'
You didn't state if your multisensor was capable of sending NGSI calls - if it can't send NGSI, but able to send batch readings in some other format, then you just need a microservice to do the conversion for you - an example can be found here on GitHub - commentary on the code can be found in the Video Tutorials from FIWARE Foundation.
Once you have safely send your device data in NGSI format, you can tackle the second half of your question. There are QuantumLeap tutorials for both NGSI-v2 and NGSI-LD, the key to them both is creating a subscription notifying of any changes.
NGSI-v2
curl -iX POST \
'http://localhost:1026/v2/subscriptions/' \
-H 'Content-Type: application/json' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
-d '{
"description": "Notify QuantumLeap of count changes of any Motion Sensor",
"subject": {
"entities": [
{
"idPattern": "Motion.*"
}
],
"condition": {
"attrs": [
"count"
]
}
},
"notification": {
"http": {
"url": "http://quantumleap:8668/v2/notify"
},
"attrs": [
"count"
],
"metadata": ["dateCreated", "dateModified"]
}
}'
NGSI-LD
curl -L -X POST 'http://localhost:1026/ngsi-ld/v1/subscriptions/' \
-H 'Content-Type: application/ld+json' \
-H 'NGSILD-Tenant: openiot' \
--data-raw '{
"description": "Notify me of all feedstock changes",
"type": "Subscription",
"entities": [{"type": "FillingLevelSensor"}],
"watchedAttributes": ["filling"],
"notification": {
"attributes": ["filling", "location"],
"format": "normalized",
"endpoint": {
"uri": "http://quantumleap:8668/v2/notify",
"accept": "application/json"
}
},
"#context": "http://path-to-context/ngsi-context.jsonld"
}'
The throttling parameter is not necessary unless you only want to sample the incoming data.

when we upload .rvt files, we always got the error message "TranslationWorker-InternalFailure". the file is not corrupted we have checked

{
"type": "manifest",
"hasThumbnail": "false",
"status": "failed",
"progress": "complete",
"region": "US",
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6YWRhbV8yMDE3LTA1LTI4X3RhdGFzdGVlbDEvcnN0X2Jhc2ljX3NhbXBsZV9wcm9qZWN0LnJ2dA",
"version": "1.0",
"derivatives": [
{
"name": "LMV Bubble",
"hasThumbnail": "false",
"status": "failed",
"progress": "complete",
"messages": [
{
"type": "error",
"message": "Tr worker fail to download.",
"code": "TranslationWorker-InternalFailure"
}
],
"outputType": "svf"
}
]
}
According to your urn, there would be a great possibility that your model is RVT. So, please retry with this request payload:
curl -X POST \
https://developer.api.autodesk.com/modelderivative/v2/designdata/job \
-H 'Authorization: Bearer ' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-H 'x-ads-force: true' \
-d '{
"input": {
"urn": "dXJuOmFkc2sub2JqZWN0czpvcy5vYmplY3Q6YWRhbV8yMDE3LTA1LTI4X3RhdGFzdGVlbDEvcnN0X2Jhc2ljX3NhbXBsZV9wcm9qZWN0LnJ2dA"
},
"output": {
"formats": [
{
"type": "svf",
"views": [
"2d",
"3d"
]
}
]
}
}'
Note. Now Forge Model Derivative API only supports RVT files come from Revit 2016-2020.

How to issue command to Orion

I have a camera and I want to send it a command to take a snapshot. My setup is Orion <--> iotagent-json <--> mosquitto <--> device.
However, when I try to issue a command the iotagent does not receive anything.
The request I used for provisioning the device (to the agent):
curl -X POST \
http://localhost1:4041/iot/devices \
-H 'Content-Type: application/json' \
-H 'fiware-service: actuatoriot' \
-H 'fiware-servicepath: /' \
-d '{
"devices": [
{
"device_id": "actuatorCamera002",
"entity_name": "urn:ngsi-ld:ActuatorCamera:002",
"entity_type": "Actuator",
"protocol": "PDI-IoTA-UltraLight",
"transport": "MQTT",
"timezone": "Europe/Berlin",
"commands": [
{ "object_id": "screen", "name": "Screen", "type": "command"}
]
}
]
}'
The device created on Agent:
{
"device_id":"actuatorCamera002",
"service":"actuatoriot",
"service_path":"/",
"entity_name":"urn:ngsi-ld:ActuatorCamera:002",
"entity_type":"Actuator",
"transport":"MQTT",
"attributes":[
],
"lazy":[
],
"commands":[
{
"object_id":"screen",
"name":"Screen",
"type":"command"
}
],
"static_attributes":[
],
"protocol":"PDI-IoTA-UltraLight"
}
The entity created on Orion:
{
"id": "urn:ngsi-ld:ActuatorCamera:002",
"type": "Actuator",
"Screen_info": {
"type": "commandResult",
"value": "aaa",
"metadata": {}
},
"Screen_status": {
"type": "commandStatus",
"value": "UNKNOWN",
"metadata": {}
},
"TimeInstant": {
"type": "ISO8601",
"value": " ",
"metadata": {}
}
}
I have tried sending PATCH requests on the entity values but nothing seems to be getting pushed to the iotagent-json.
(I have been using the iotagent and Orion for sensor measurements and everything works fine.)
EDIT:
GET v2/registrations
[
{
"id": "5d3af2188d657958a5cefec1",
"expires": "2019-08-25T12:29:12.00Z",
"dataProvided": {
"entities": [
{
"id": "urn:ngsi-ld:ActuatorCamera:002",
"type": "Actuator"
}
],
"attrs": [
"Screen"
]
},
"provider": {
"http": {
"url": "http://localhost:4041"
},
"supportedForwardingMode": "all",
"legacyForwarding": true
},
"status": "active"
}
]
Thanks to fgalan's comment I was able to find out I was using a wrong command name when issuing the PATCH.
The correct request for issuing a command was:
curl -X PATCH \
http://<contextBrokerIp>:1026/v2/entities/urn:ngsi-ld:ActuatorCamera:002/attrs \
-H 'fiware-service: actuatoriot' \
-H 'fiware-servicepath: /' \
-d '{
"Screen": {
"type" : "command",
"value" : ""
}
}'

WSO2 identity server: phone fields using SCIM don't accept numbers

I'm using wso2 identity server version 5.0.0 with user store on mysql.
When I try to insert user with phone numbers, the phone number are not stored.
curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","password":"rossipsw","emails":"rossim#aaaa.it" ,"phoneNumbers":[{"value":"8811","type":"work"},{"value":"3473344555","type":"mobile"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
the result is:
Connection #0 to host localhost left intact
{"id":"f6ce5310-a2ee-4976-9579-0299029183bb","schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","phoneNumbers":[{"type":"work"},{"type":"mobile"}],"emails":"rossim#aaaa.it","meta":{"lastModified":"2015-08-19T16:09:50","location":"https://192.168.3.43:9443/wso2/scim/Users/f6ce5310-a2ee-4976-9579-0299029183bb","created":"2015-08-19T16:09:50"}}
if I put a char in the phone number, it works fine:
curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","password":"rossipsw","emails":"rossim#aaaa.it" ,"phoneNumbers":[{"value":"_8811","type":"work"},{"value":"_3473344555","type":"mobile"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
the result is:
Connection #0 to host localhost left intact
{"id":"3ce83aca-6f70-4274-a2c3-5429132d6001","schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","phoneNumbers":[{"value":"_8811","type":"work"},{"value":"_3473344555","type":"mobile"}],"emails":"rossim#aaaa.it","meta":{"lastModified":"2015-08-19T16:12:50","location":"https://192.168.3.43:9443/wso2/scim/Users/3ce83aca-6f70-4274-a2c3-5429132d6001","created":"2015-08-19T16:12:50"}}
Why? a phone number... is a number!
Phone number can be stored when enter the number within back slashes. Example : \"3473344555\"
Please find the modified curl command which works fine.
curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","password":"rossipsw","emails":"rossim#aaaa.it" ,"phoneNumbers":[{"value":\"8811\","type":"work"},{"value":\"3473344555\","type":"mobile"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
Result :
{"id":"a5520dfc-aa7c-4b4b-aba2-57df7b87e2e4","schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":
"rossiusr","phoneNumbers":[{"value":"8811","type":"work"},{"value":"3473344555","type":"mobile"}],"emails":"rossim#aaaa.it","meta":{"lastModified"
:"2016-01-19T11:04:32","location":"https://localhost:9443/wso2/scim/Users/a5520dfc-aa7c-4b4b-aba2-57df7b87e2e4","created":"2016-01-19T11:04:32"}}*
Connection #0 to host localhost left intact
This is a CURL POST Request example To add Bulk users into the WSO2 Identity Server,
curl --location --request POST 'https://localhost:9443/scim2/Bulk' \
--header 'Content-Type: application/scim+json' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data-raw '{
emphasized text"failOnErrors":1,
"schemas": ["urn:ietf:params:scim:api:messages:2.0:BulkRequest"],
"Operations": [
{
"method": "POST",
"path": "/Users",
"bulkId": "bulkId01",
"data": {
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
"userName": "Test",
"password":"Mohsen123",
"name": {
"givenName": "Test01",
"familyName": "Tes01t"
},
"emails": [
{
"type": "home",
"value": "home#test.com",
"primary": true
},
{
"type": "work",
"value": "work#test.com"
},
{
"type": "other",
"value": "other#test.com"
}
]
}
},
{
"method": "POST",
"path": "/Users",
"bulkId": "bulkId02",
"data": {
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
],
"name": {
"givenName": "Test02",
"familyName": "Test02"
},
"userName": "Test02",
"password": "Mohsen123",
"emails": [
{
"type": "home",
"value": "home#test.com",
"primary": true
},
{
"type": "work",
"value": "work#test.com"
},
{
"type": "other",
"value": "other#test.com"
}
],
"phoneNumbers":[
{
"value":"8811",
"type":"work"
},
{
"value":"3473344555",
"type":"mobile"
}
],
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"employeeNumber": "1234A",
"costCenter": "hello",
"country": "country",
"dob":"dateOfBirth",
"manager": {
"value": "Admin"
}
}
}
}
]
}

Invalid characters for orion Context Broker

I make some calls to context broker to create elements, but sometimes I get the following error:
{
"errorCode": {
"code": "400",
"details": "Illegal value for JSON field",
"reasonPhrase": "Bad Request"
}
}
I have done some tests and I have discovered that there are some characters which you get that error.
I found that with "(", ")", "'", ">" , "<",... characters in the value of an attribute return that error.
This is an example of an entity creation that return the error :
(curl localhost:1026/v1/updateContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d #- | python -mjson.tool) <<EOF
{
"contextElements": [
{
"type": "Room",
"isPattern": "false",
"id": "Room1",
"attributes": [
{
"name": "temperature",
"type": "float",
"value": "23"
},
{
"name": "pressure",
"type": "integer",
"value": "720"
},
{
"name": "floor",
"type": "string",
"value": "3 (B)"
}
]
}
],
"updateAction": "APPEND"
}
EOF
Invalid characters (along with rationale and suggestion to encode them) are explained in this section in the Orion user manual.