Verwendung der API, um einem Asset ein Listenfeld hinzuzufügen - Data360_Govern - Neuheiten

Data360 Govern – Hilfe

Product type
Software
Portfolio
Verify
Product family
Data360
Product
Precisely Data Integrity Suite > Govern
Data360 Govern
Version
Neuheiten
Language
Deutsch
Product name
Data360 Govern
Title
Data360 Govern – Hilfe
Copyright
2024
First publish date
2014
Tipp: Falls Sie noch nicht mit der Data360 Govern-API vertraut sind, finden Sie unter API-Dokumentation eine allgemeine Einführung.

In den Beispiel-Anforderungen in diesem Abschnitt der Hilfe wird die Curl-Syntax verwendet, um alle erforderlichen Informationen, einschließlich Anforderungsheadern, Methoden, Endpunkten und Daten, sowie alle obligatorischen und optionalen Parameter darzustellen: Zusätzlich werden für jede Anforderung dieselben Header-Informationen in einem separaten Block angezeigt, die Sie bei der Verbindung mit der Data360 Govern-API über einen API-Client verwenden können.

Ihnen stehen zwei Asset-Typen für Business-Assets zur Verfügung: List1 und List2. Sie möchten dem Asset-Typ „List1“ ein neues Listenfeld hinzufügen.

1. Asset-Typen identifizieren

Verwenden Sie eine GET /api/v2/assets/types-Anforderung, um eine Liste aller Asset-Typen in Ihrem System abzurufen.

Beispielanforderung

curl -X GET --header 'Accept: application/json' --header 'Authorization: key;secret' 'https://example.data3sixty.com/api/v2/assets/types'

Im folgenden Beispiel werden die Header-Informationen für dieselbe Anforderung angezeigt, die bei der Verbindung mit der Data360 Govern-API über einen API-Client verwendet wird:

GET https://example.data3sixty.com/api/v2/assets/types HTTP/1.1Authorization: <API Key>;<API Secret> 		 Accept: application/json

Beispielantwort

[ {    "uid": "92ed38e0-73bd-4598-857b-a7724aa596d7",    "Name": "List1",    "Class": {      "ID": 1,      "Name": "Business Asset",      "Description": "Business assets."  },  "Path": "List1"  }, {    "uid": "a943957f-1737-43e4-85db-2bd3927f4e69",    "Name": "List2",    "Class": {      "ID": 2,      "Name": "Business Asset",      "Description": "Business assets."  },  "Path": "List2"  } ]

Diese Antwort gibt Folgendes an:

  • Die UID für den Asset-Typ „List1“ lautet: 92ed38e0-73bd-4598-857b-a7724aa596d7
  • Die UID für den Asset-Typ „List2“ lautet: a943957f-1737-43e4-85db-2bd3927f4e69

2. Ermitteln vorhandener Assets für den Asset-Typ

Rufen Sie mithilfe des Asset-Typs uid , den Sie in Schritt 1 ermittelt haben, und einer GET-Anforderung eine Liste der vorhandenen List2-Assets ab.

Beispielanforderung

In dieser Beispielanforderung wird die UID des Asset-Typs „List2“ verwendet, die in Schritt 1 abgerufen wurde:

curl -X GET --header 'Accept: application/json' --header 'Authorization: key;secret' 'https://example.data3sixty.com/api/v2/assets/a943957f-1737-43e4-85db-2bd3927f4e69'

Im folgenden Beispiel werden die Header-Informationen für dieselbe Anforderung angezeigt, die bei der Verbindung mit der Data360 Govern-API über einen API-Client verwendet wird:

GET https://example.data3sixty.com/api/v2/assets/a943957f-1737-43e4-85db-2bd3927f4e69 HTTP/1.1Authorization: <API Key>;<API Secret> Accept: application/json

Beispielantwort

Die Antwort zeigt, dass der Asset-Typ „List2“ drei Assets aufweist:

{   "items": [     {       "AssetId": 17284,       "AssetUid": "b664eb76-42d2-476e-8298-09643097e572",       "XrefId": null,       "AssetTypeId": 489,       "AssetTypeUid": "a943957f-1737-43e4-85db-2bd3927f4e69",       "UpdatedOn": "2023-09-21T13:21:34.907Z",       "CreatedOn": "2023-09-21T13:21:34.907Z",       "Color": null,       "Path": "[Asset_Name1]",       "DisplayPath": "Asset_Name1",       "Name": "Asset_Name1"     },     {       "AssetId": 17285,       "AssetUid": "3c60e0a1-3f6c-4c9c-a218-db86c81c0ff6",       "XrefId": null,       "AssetTypeId": 489,       "AssetTypeUid": "a943957f-1737-43e4-85db-2bd3927f4e69",       "UpdatedOn": "2023-09-21T14:43:56.980Z",       "CreatedOn": "2023-09-21T14:43:56.980Z",       "Color": null,       "Path": "[Asset_Name2]",       "DisplayPath": "Asset_Name2",       "Name": "Asset_Name2"     },     {       "AssetId": 17286,       "AssetUid": "a17ab40d-6214-4ed6-bd01-8c3f7a7c9cf5",       "XrefId": null,       "AssetTypeId": 489,       "AssetTypeUid": "a943957f-1737-43e4-85db-2bd3927f4e69",       "UpdatedOn": "2023-09-21T14:44:09.797Z",       "CreatedOn": "2023-09-21T14:44:09.797Z",       "Color": null,       "Path": "[Asset_Name3]",       "DisplayPath": "Asset_Name3",       "Name": "Asset_Name3"     }   ],   "pageSize": 200,   "pageNum": 1,   "total": 3 }

3. Hinzufügen eines Listenfelds

Fügt dem Asset-Typ „List1“ ein Listenfeld hinzu. Legen Sie mit dem in Schritt 2 zurückgegebenen uid -Wert für Asset_Name1 einen Standardwert fest.

Beispielanforderung

curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \     "Action": "Merge", \     "Fields": [ \       { \         "Name": "list_field", \         "FriendlyName": "list_field", \    "Category": "List", \         "Type": { \           "Lookup": { \             "Description": { \               "Form": "Example form", \               "Display": "Example display" \             }, \             "AllowAllValue": false, \             "AllowAllLabel": "string", \             "Format": { \               "Display": "{Name}", \               "Edit": "{Name}" \             }, \             "List": { \               "Uid": "a943957f-1737-43e4-85db-2bd3927f4e69", \               "Class": "BusinessAsset", \               "AllowMultipleValues": true \             }, \             "Validation": { \               "IsRequired": false \             }, \             "DefaultValue": "b664eb76-42d2-476e-8298-09643097e572", \             "ColumnOrder": 0, \             "ColumnWidth": 0, \             "SortOrder": 0, \             "IsDisplayable": true, \             "IsEditable": true, \             "IsListable": true, \             "IsPartOfKey": false, \             "IsPrimaryFilter": true, \             "ShowIfEmpty": true \           } \         } \       } \     ], \     "AssetTypeUid": "92ed38e0-73bd-4598-857b-a7724aa596d7" \   }' 'https://example.data3sixty.com/api/v2/fields'

Im folgenden Beispiel werden die Header-Informationen für dieselbe Anforderung angezeigt, die bei der Verbindung mit der Data360 Govern-API über einen API-Client verwendet wird:

PUT https://example.data3sixty.com/api/v2/fields HTTP/1.1Authorization: <API Key>;<API Secret> 	  Accept: application/json

Beispielantwort

{   "Uid": "92ed38e0-73bd-4598-857b-a7724aa596d7",   "Success": true,   "Message": "Fields successfully updated." } 

Dem Asset-Typ „List1“ wird ein neues Listenfeld mit der Bezeichnung list_field hinzugefügt. Der angegebene Standardwert ist Asset_Name1, auf den in der Anforderung durch den zugehörigen UID-Wert verwiesen wird: "DefaultValue": "b664eb76-42d2-476e-8298-09643097e572".