Developed against DotNet 6.0
The .NET Core CLI is referenced in this sample, and should be installed to run the sample from the command line.
- ADH: AVEVA DataHub
- SDS: Sequential Data Store
The sample code in this repository demonstrates REST API calls to ADH for creating a Signup to receive resource updates. Signups allow clients to subscribe resources (for example, streams) and get updates for those resources.
The sample will perform the following procedures:
- Obtain an OAuth token for ADH using a client-credentials client
- Create SDS Types
- Create SDS Streams
- Create an ADH Signup against the created resources (streams)
- Make an API request to GetSignup to activate the signup
- Make an API request to GetSignupResources to view accessible and inaccessible resources in the signup
- Make updates to the Streams (post data to stream)
- Make an API request to GetUpdates and ensure that data updates are received
- Create a new SDS Stream and make an API request to UpdateSignupResources to include the new stream
- Make an API request to GetSignupResources using query parameters to view signup with updated resources
- Update streams using non-Insert operations
- Make an API request to GetUpdates using the bookmark from the previous GetUpdates response to demonstrate update retrieval of other operation types (for example, Replace, Update, Remove and RemoveWindow).
- Create additional signups and make an API request to GetAllSignups with query parameters to view all signups
- Cleanup signups, streams, and type
NOTE: Communication with SDS will be done via the .NET OCS Clients Library. Communication with Change Broker will be done using Http.
The sample is configured using the file appsettings.placeholder.json. Before editing, rename this file to appsettings.json
. This repository's .gitignore
rules should prevent the file from ever being checked in to any fork or branch, to ensure credentials are not compromised.
AVEVA Data Hub is secured by obtaining tokens from its identity endpoint. Client credentials clients provide a client application identifier and an associated secret (or key) that are authenticated against the token endpoint. You must replace the placeholders in your appsettings.json
file with the authentication-related values from your tenant and a client-credentials client created in your ADH tenant.
{
"NamespaceId": "PLACEHOLDER_REPLACE_WITH_NAMESPACE_ID",
"TenantId": "PLACEHOLDER_REPLACE_WITH_TENANT_ID",
"Resource": "https://uswe.datahub.connect.aveva.com",
"ClientId": "PLACEHOLDER_REPLACE_WITH_CLIENT_ID",
"ClientSecret": "PLACEHOLDER_REPLACE_WITH_CLIENT_SECRET",
}
Within the sample, there are configurable options for number of streams to create, the signup name, query parameters, and number of additional signups to create. Please note: the maximum value for the count query parameter is 1,000 for get all signups and 10,000 for get signup resources.
To run this example from the command line once the appsettings.json
is configured, run
cd ChangeBrokerRestApi
dotnet restore
dotnet run
To test the sample, run
cd ChangeBrokerRestApiTest
dotnet restore
dotnet test
Tested against DotNet 6.0.
For the ADH Change Broker samples page ReadMe
For the main ADH samples page ReadMe
For the main AVEVA samples page ReadMe