SmartConnector Forum
Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.
Link copied. Please paste this link to share this article on your social media post.
Hello,
For sharing SBO data to 3rd party, I create a SoapEwsRestProvider and config it in SmartConnector.
Because there are a lot of sharing data, so the efficient way is we can provide a batch of values to 3rd party on request. But follow the SmartConnector RESTful EWS Gateway document, SoapEwsRestProvider does not support GET /Values action . Do we have another way to let others get multi-data on a request? Thanks in advance!
Best Regards
Jessie
Link copied. Please paste this link to share this article on your social media post.
Hi Jessie,
For doing something like this, you will want to use the subscription mechanism built in with the following workflow:
With the /Subscriptions Endpoint do a:
REQUEST 1:
POST /Subscriptions/Create with a body like:
{
"DurationInMinutes": 15,
"SubscriptionType": "ValueItemChanged",
"Ids": [
"01/Server 1/AV1",
"01/Server 1/AV2",
"01/Server 1/etc..."
]
}
RESPONSE 1:
This will return a body with an ID. When you want to check these values
REQUEST 2:
POST /Notifications/Create
{
"SubscriptionId": "ID From above response",
"ChangesOnly": true
}
RESPONSE 2:
This will return a notification ID. Then you do:
REQUEST 3:
GET /Notifications/{ID FROM ABOVE RESPONSE, without the {}}/Items
RESPONSE 3:
This will return a list of all values that have changes since the last notification response (since the notification has ChangesOnly = true. The first time you do this always, you will get the current value of ALL objects asked for, and subsuquent requests will return just the changes from the last notification.
Now basically just keep doing the POST /Notifications/Create and the GET /Notifications/{id}/Items over and over again. If you always want all the values, simply change ChangesOnly to false instead of true. But the vast majority of use cases can simply get the values that have changed, and determine the rest have remained the same .
Before the subscription expires, you will want to do a:
PUT /Subscriptions/{id}/Renew where the ID is the id returned from RESPONSE 1 with a body of:
{
"minutes": 15
}
In order to keep your subscription alive, you can also terminate your subscription early if you want via the user of:
PUT /Subscriptions/{id}/Terminate where ID is the id returned from response 1.
If you end up getting a bad response from the web server on your subscription, just recreate it and start over.
Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Hi Jessie,
For doing something like this, you will want to use the subscription mechanism built in with the following workflow:
With the /Subscriptions Endpoint do a:
REQUEST 1:
POST /Subscriptions/Create with a body like:
{
"DurationInMinutes": 15,
"SubscriptionType": "ValueItemChanged",
"Ids": [
"01/Server 1/AV1",
"01/Server 1/AV2",
"01/Server 1/etc..."
]
}
RESPONSE 1:
This will return a body with an ID. When you want to check these values
REQUEST 2:
POST /Notifications/Create
{
"SubscriptionId": "ID From above response",
"ChangesOnly": true
}
RESPONSE 2:
This will return a notification ID. Then you do:
REQUEST 3:
GET /Notifications/{ID FROM ABOVE RESPONSE, without the {}}/Items
RESPONSE 3:
This will return a list of all values that have changes since the last notification response (since the notification has ChangesOnly = true. The first time you do this always, you will get the current value of ALL objects asked for, and subsuquent requests will return just the changes from the last notification.
Now basically just keep doing the POST /Notifications/Create and the GET /Notifications/{id}/Items over and over again. If you always want all the values, simply change ChangesOnly to false instead of true. But the vast majority of use cases can simply get the values that have changed, and determine the rest have remained the same .
Before the subscription expires, you will want to do a:
PUT /Subscriptions/{id}/Renew where the ID is the id returned from RESPONSE 1 with a body of:
{
"minutes": 15
}
In order to keep your subscription alive, you can also terminate your subscription early if you want via the user of:
PUT /Subscriptions/{id}/Terminate where ID is the id returned from response 1.
If you end up getting a bad response from the web server on your subscription, just recreate it and start over.
Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Hi Jeffrey,
Follow your instruction, It works now. Thank you very... much!
Best Regards
Jessie
Link copied. Please paste this link to share this article on your social media post.
Hi Jeffrey,
Additional question: what's the reasonable setting for Subscriptions if we would share more than 10,000 points or maybe 20,000 points to others. DurationInMinutes is still set to 15? what's the maximum number of Ids in a POST Subscriptions/Create? Thanks!
Best Regards
Jessie
Link copied. Please paste this link to share this article on your social media post.
HI Jessie,
As far as the subscription length, there is an issue with SBO that it only supports 1 subscription length, it is either 15 or 30 minutes (I forget exactly). So that is what you would need to use.
As far as the amount of points, there is no 'maximum' per say for SmartConnector, but there might be a limitation from the EWS side of things (the REST interface, sends EWS requests to SBO behind the scenes). Since you are able to have open multiple subscriptions, I would say you probably don't wanna do more than 500-1000 points per subscription (but you can always spread it out even more as you want to.) Experimentation will be best here.
Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Thank you Jeffrey!
Link copied. Please paste this link to share this article on your social media post.
For REQUEST 2, regardless of "ChangesOnly" parameter set to true or false, the result are the same - only get the changed value. Then how to get all subscription values? Thanks!
Link copied. Please paste this link to share this article on your social media post.
Hi Jesse,
I looked into it, and it seems that as an EWS Server, SBO doesn't honor the mechanism the REST provider is using to supply the 'ChangesOnly' property (honestly, it looks like an SBO defect that they are unlikely to fix anytime soon). So, in order to get this functionality, you will need repeat request 1, 2, and 3 (1,2,3,1,2,3,1,2,3) over and over again instead doing it like 1,2,3,2,3,2,3. I would also recommend, canceling the original subscription each time with the PUT /Subscriptions/{id}/Terminate request each time as well, as to not bog down SBO with tons of subscriptions that are not really in use.
That said, if you do only care about the changes, then the original post holds true.
Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Hi Jeff,
Got it and Thanks!
BRs
Jessie
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.