Version: 1.1.6
Developed against Python 3.9.1.
- Python 3.7+
- Register a Client-Credentials Client in your CONNECT data services tenant and create a client secret to use in the configuration of this sample. (Video Walkthrough)
- Install required modules:
pip install -r requirements.txt
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. The assets API reference documentation can be found here.
- Obtain an OAuth token for ADH, using a client-credentials client
- Create an SDS type
- Create an SDS stream
- Insert data into the stream
- Create an ADH asset
- Create an ADH asset type
- Create an asset from an asset type
- Retrieve an asset
- Retrieve a resolved asset
- Update an asset
- Retrieve the updated asset
- Retrieve data from an asset
- Retrieve status for an asset
- Search for an asset by asset type id
- Clean up assets, asset types, stream, and type
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.
{
"Resource": "https://uswe.datahub.connect.aveva.com",
"ApiVersion": "v1",
"TenantId": "PLACEHOLDER_REPLACE_WITH_TENANT_ID",
"NamespaceId": "PLACEHOLDER_REPLACE_WITH_NAMESPACE_ID",
"ClientId": "PLACEHOLDER_REPLACE_WITH_APPLICATION_IDENTIFIER",
"ClientSecret": "PLACEHOLDER_REPLACE_WITH_APPLICATION_SECRET"
}
To run this example from the command line once the appsettings.json
is configured, run
python program.py
To test the sample, run
pip install pytest
python -m pytest test.py
Tested against Python 3.9.1
For the ADH Assets samples page ReadMe
For the main ADH samples page ReadMe
For the main AVEVA samples page ReadMe