We understand that from time to time, we will have a transformation on a virtual data resource that inherits multiple different field levels (such as organization, account, and instance levels). At times, it can get tricky to manage all the different levels by pulling each one of them from their respective level (e.g., /organizations/elements/{keyOrId}/transformations/{objectName}
. Here is a quick article to show you how to properly check on all the defined fields of a transformation and their respective levels.
So let's say I have a transformation created (print screen below), and I have three fields mapped. Two of my fields are mapped to the Organization Level (AccountNumber and BillingCity) and one of them is mapped to the Account Level (id).
Normally, you would perform a GET call to Accounts to get the transformation and their respective fields set on that given level, and then you would perform a second call to Organization to do the same thing. Obviously, this approach is not very practical and scalable, therefore, we have developed an internal API (undocumented) that would allow you to get all the fields and their respective levels with one single API call. Here is the cURL:
curl -X GET \
https://console.cloud-elements.com/elements/api-v2/common-resources/{commonResourceObjectName} \
-H 'authorization: User {cloudElementsUserToken}, Organization{cloudElementsOrganizationToken}' \
-H 'cache-control: no-cache'
You should get back a response body similar to the payload shown below. It will contain all the defined fields and their respective associatedLevel
:
{
"name":"test_accounts",
"elementInstanceIds":[
],
"fields":[
{
"type":"string",
"path":"BillingCity",
"associatedLevel":"organization",
"associatedId":56449
},
{
"type":"string",
"path":"Id",
"associatedLevel":"account",
"associatedId":158073
},
{
"type":"string",
"path":"AccountNumber",
"associatedLevel":"organization",
"associatedId":56449
}
]
}