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.
Link copied. Please paste this link to share this article on your social media post.
All of the functionality that the UK team had should be in there: plus full authentication, API throttling, and Swagger integration.
That said, we did take a different approach and made the API truly "RESTful" and not just a port of EWS to REST.
The implementation is layered with a generic API and configurable "Data Providers" which will get data from different sources. Two Data Providers are currently included: one for native SmartConnector EWS Server and another for any EWS Server over SOAP. (A native SBO provider is currently in the works that will functionally replace the SOAP one for SmartStruxure communications). The beauty with this approach is that once you've coded to the API, nothing on the client needs to change since the API is agnostic to the Data Provider.
Here is some content from the guide that should help get you started...
Provisioning endpoints is performed via the SmartConnector portal. If you are not familiar with the SmartConnector Portal you should review section 5 of the SmartConnector Installation and Configuration Guide.
There are no restrictions to the number or type of REST endpoints you wish to provision in SmartConnector. Regardless of the type, the process is the same however some configuration parameters will differ depending on the type of Data Provider used.
To provision a REST Endpoint in SmartConnector, perform the following:
SmartConnector will not immediately start the REST Endpoint because the configuration is not yet complete. If you click the “Validate” button, you will see what SmartConnector detects as issues. The actual issues will depend on which Data Provider you chose in step 6 above.
To complete the configuration, navigate to the “Endpoint Configuration” page for the REST Endpoint you wish to configure. If you are following from the prior section, you will be on this page after completing the “Add” steps above.
The following parameters will be present regardless of the type of Data Provider you selected above. Those parameters which are specific to a Data Provider type are enumerated in the sections which follow.
When you click the “Details” tab, SmartConnector will display the details for the Data Provider you selected.
Expanding the “Http Configuration” node,
There are more Http Configuration settings depending on which Data Provider you are using:
Link copied. Please paste this link to share this article on your social media post.
If you're connecting to SBO, you must use SoapEwsRestProvider.
For SoapEwsRestProvider
Server Address = EWS endpoint (e.g. http://localhost:8081/EcoStruxure/DataExchange)
For MongooseEwsRestProvider
Ews Server Id = ID of the server in SmartConnector's DB (that's found on the EWS Server page)
Link copied. Please paste this link to share this article on your social media post.
Authentication isn't configured. Authentication is done by means of a Bearer Token and must be supplied in an auth header by the client.
For testing purposes, the Swagger page allows you to enter credentials and try things out. Go to the Status page in the Portal. Click the Active Endpoints tab and then click the "Documentation" link. A customized Swagger page will open in a new tab like below:
Use credentials for an EWS User in SBO and you should authenticate (red borders become green) when you click Login. Then you can use any of the actions on the page. Swagger will automatically add the auth header to every request.
Link copied. Please paste this link to share this article on your social media post.
Of course. Authentication uses OAuth2 and it goes like this.
The client sends a POST to the Endpoint's authentication route. That route is configurable (Bearer Token Endpoint Path) but the default is "GetToken".
The body of the route contains the credentials in the form:
grant_type=password&username=USERNAME&password=PASSWORD
The server responds with the Bearer Token. The client then adds the token in subsequent requests in an "Authorization" header like this:
Authorization: Bearer BEARER_TOKEN_VALUE
The client can continue to use that token until it expires. Expiration is configurable (Access Token Expire Time Span Minutes) but the default is 5 minutes.
Link copied. Please paste this link to share this article on your social media post.
Hi Steven,
If you are interested, I wrote a thread showing how to generate, configure, and use an autogenerated REST client using the Swagger documentation:
Generate client in Visual Studio for SmartConnector RESTful Endpoints
Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
Steven,
That document is currently in review and should be posted to this forum no later than the middle of the month.
Link copied. Please paste this link to share this article on your social media post.
Thanks Mark, I am just trying to set up and test the REST Api. Previously I have used one the UK team built and I want to compare the functionality but I can't seem to work out where to set up the connection to the SBO server. Is it in the REST Endpoint configuration or somewhere else?
Link copied. Please paste this link to share this article on your social media post.
All of the functionality that the UK team had should be in there: plus full authentication, API throttling, and Swagger integration.
That said, we did take a different approach and made the API truly "RESTful" and not just a port of EWS to REST.
The implementation is layered with a generic API and configurable "Data Providers" which will get data from different sources. Two Data Providers are currently included: one for native SmartConnector EWS Server and another for any EWS Server over SOAP. (A native SBO provider is currently in the works that will functionally replace the SOAP one for SmartStruxure communications). The beauty with this approach is that once you've coded to the API, nothing on the client needs to change since the API is agnostic to the Data Provider.
Here is some content from the guide that should help get you started...
Provisioning endpoints is performed via the SmartConnector portal. If you are not familiar with the SmartConnector Portal you should review section 5 of the SmartConnector Installation and Configuration Guide.
There are no restrictions to the number or type of REST endpoints you wish to provision in SmartConnector. Regardless of the type, the process is the same however some configuration parameters will differ depending on the type of Data Provider used.
To provision a REST Endpoint in SmartConnector, perform the following:
SmartConnector will not immediately start the REST Endpoint because the configuration is not yet complete. If you click the “Validate” button, you will see what SmartConnector detects as issues. The actual issues will depend on which Data Provider you chose in step 6 above.
To complete the configuration, navigate to the “Endpoint Configuration” page for the REST Endpoint you wish to configure. If you are following from the prior section, you will be on this page after completing the “Add” steps above.
The following parameters will be present regardless of the type of Data Provider you selected above. Those parameters which are specific to a Data Provider type are enumerated in the sections which follow.
When you click the “Details” tab, SmartConnector will display the details for the Data Provider you selected.
Expanding the “Http Configuration” node,
There are more Http Configuration settings depending on which Data Provider you are using:
Link copied. Please paste this link to share this article on your social media post.
And I just noticed that the last two parameters are transposed (and this is why the doc is in review)!
It should read:
Http Configuration Settings
Http Configuration Settings
Link copied. Please paste this link to share this article on your social media post.
So the Ews Server Id would be something like "http://<SboServerIp>/Ecostruxure/DataExchange" ?
What about the Ews Server credentials? Where are they configured?
Link copied. Please paste this link to share this article on your social media post.
If you're connecting to SBO, you must use SoapEwsRestProvider.
For SoapEwsRestProvider
Server Address = EWS endpoint (e.g. http://localhost:8081/EcoStruxure/DataExchange)
For MongooseEwsRestProvider
Ews Server Id = ID of the server in SmartConnector's DB (that's found on the EWS Server page)
Link copied. Please paste this link to share this article on your social media post.
Reading your instructions again I figured that out that much but cannot see anywhere to enter the SBO credentials. Are these passed in by the REST client?
Link copied. Please paste this link to share this article on your social media post.
Authentication isn't configured. Authentication is done by means of a Bearer Token and must be supplied in an auth header by the client.
For testing purposes, the Swagger page allows you to enter credentials and try things out. Go to the Status page in the Portal. Click the Active Endpoints tab and then click the "Documentation" link. A customized Swagger page will open in a new tab like below:
Use credentials for an EWS User in SBO and you should authenticate (red borders become green) when you click Login. Then you can use any of the actions on the page. Swagger will automatically add the auth header to every request.
Link copied. Please paste this link to share this article on your social media post.
Is there a way for the client to acquire/generate a bearer token?
Link copied. Please paste this link to share this article on your social media post.
Of course. Authentication uses OAuth2 and it goes like this.
The client sends a POST to the Endpoint's authentication route. That route is configurable (Bearer Token Endpoint Path) but the default is "GetToken".
The body of the route contains the credentials in the form:
grant_type=password&username=USERNAME&password=PASSWORD
The server responds with the Bearer Token. The client then adds the token in subsequent requests in an "Authorization" header like this:
Authorization: Bearer BEARER_TOKEN_VALUE
The client can continue to use that token until it expires. Expiration is configurable (Access Token Expire Time Span Minutes) but the default is 5 minutes.
Link copied. Please paste this link to share this article on your social media post.
Hi Steven,
If you are interested, I wrote a thread showing how to generate, configure, and use an autogenerated REST client using the Swagger documentation:
Generate client in Visual Studio for SmartConnector RESTful Endpoints
Regards,
-Jeff
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.