Giter Site home page Giter Site logo

sample-adh-change_broker_rest_api-dotnet's Introduction

AVEVA Data Hub Change Broker Service .NET REST API Sample

Build Status

Version 1.0.4

Developed against DotNet 6.0

Requirements

The .NET Core CLI is referenced in this sample, and should be installed to run the sample from the command line.

Definitions

  • ADH: AVEVA DataHub
  • SDS: Sequential Data Store

About this repository

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:

  1. Obtain an OAuth token for ADH using a client-credentials client
  2. Create SDS Types
  3. Create SDS Streams
  4. Create an ADH Signup against the created resources (streams)
  5. Make an API request to GetSignup to activate the signup
  6. Make an API request to GetSignupResources to view accessible and inaccessible resources in the signup
  7. Make updates to the Streams (post data to stream)
  8. Make an API request to GetUpdates and ensure that data updates are received
  9. Create a new SDS Stream and make an API request to UpdateSignupResources to include the new stream
  10. Make an API request to GetSignupResources using query parameters to view signup with updated resources
  11. Update streams using non-Insert operations
  12. 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).
  13. Create additional signups and make an API request to GetAllSignups with query parameters to view all signups
  14. 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.

Configuring the sample

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.

Running the sample

To run this example from the command line once the appsettings.json is configured, run

cd ChangeBrokerRestApi
dotnet restore
dotnet run

Running the automated test

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

sample-adh-change_broker_rest_api-dotnet's People

Contributors

avv-nkrisa avatar cbardini avatar dependabot[bot] avatar derekendres avatar steve-tanasse avatar

Watchers

 avatar

Forkers

balasista

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.