Skip to content

AVEVA/sample-adh-assets_rest_api-dotnet

Repository files navigation

CONNECT data services Assets .NET REST API Sample

Version: 1.1.4

Build Status

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.

About this sample

This sample uses REST API calls to work with assets and asset types in ADH. It follows a set of steps to demonstrate the usage of various asset endpoints.

  1. Obtain an OAuth token for ADH, using a client-credentials client
  2. Create an SDS type
  3. Create an SDS stream
  4. Insert data into the stream
  5. Create an ADH asset
  6. Create an ADH asset type
  7. Create an asset from an asset type
  8. Retrieve an asset
  9. Retrieve a resolved asset
  10. Update an asset
  11. Retrieve the updated asset
  12. Retrieve data from an asset
  13. Retrieve status for an asset
  14. Search for an asset by asset type id
  15. Clean up assets, asset types, stream, and type

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.

CONNECT data services 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",
  "ApiVersion": "v1"
}

Running the sample

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

dotnet restore
dotnet run

Running the automated test

To test the sample, run

dotnet restore
dotnet test

Tested against DotNet 6.0.
For the ADH Assets samples page ReadMe
For the main ADH samples page ReadMe
For the main AVEVA samples page ReadMe

About

No description, website, or topics provided.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages