The example requests in this topic use Curl syntax to show all of the information that is required in a request, including request headers, methods, endpoints, and data, as well as mandatory and optional parameters. Additionally, for each request, the same header information is displayed in a separate block for use when connecting to the Data360 Govern API via an API client.
You have two Business Asset asset types: List1 and List2. You want to add a new list field to the List1 asset type.
1. Identify asset types
Use a GET /api/v2/assets/types
request to retrieve a list of all asset types in your system.
Example request
curl -X GET --header 'Accept: application/json' --header 'Authorization: key;secret' 'https://example.data3sixty.com/api/v2/assets/types'
The following example shows the header information for the same request for use when connecting to the Data360 Govern API via an API client:
GET https://example.data3sixty.com/api/v2/assets/types HTTP/1.1Authorization: <API Key>;<API Secret>
Accept: application/json
Example response
[
{ "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" }
]
This response indicates that:
- The UID for the 'List1' asset type is:
92ed38e0-73bd-4598-857b-a7724aa596d7
- The UID for the 'List2' asset type is:
a943957f-1737-43e4-85db-2bd3927f4e69
2. Identify existing assets for the asset type
Using the asset type uid
that you identified in step one, use a GET request to obtain a list of existing List2 assets.
Example request
This example request uses the UID of the 'List2' asset type that was obtained in step 1:
curl -X GET --header 'Accept: application/json' --header 'Authorization: key;secret' 'https://example.data3sixty.com/api/v2/assets/a943957f-1737-43e4-85db-2bd3927f4e69'
The following example shows the header information for the same request for use when connecting to the Data360 Govern API via an API client:
GET https://example.data3sixty.com/api/v2/assets/a943957f-1737-43e4-85db-2bd3927f4e69 HTTP/1.1Authorization: <API Key>;<API Secret>
Accept: application/json
Example response
The response shows that the 'List2' asset type has three assets:
{
"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. Add a list field
Add a list field to the 'List1' asset type. Use the uid
value for Asset_Name1
returned in step two to specify a default value.
Example request
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'
The following example shows the header information for the same request for use when connecting to the Data360 Govern API via an API client:
PUT https://example.data3sixty.com/api/v2/fields HTTP/1.1Authorization: <API Key>;<API Secret>
Accept: application/json
Example response
{
"Uid": "92ed38e0-73bd-4598-857b-a7724aa596d7",
"Success": true,
"Message": "Fields successfully updated."
}
A new list field called list_field
is added to the 'List1' asset type. The specified default value is Asset_Name1
, which is referenced by its UID value in the request: "DefaultValue": "b664eb76-42d2-476e-8298-09643097e572"
.