Workflow that returns Assets from specific view
Hi guys,
any idea on how to design a workflow where I can get all the assets which are under certain view?
I used viewApi and tried to parse them but the configuration from there is not the same one as the one from rest api (https://lego-dev.collibra.com/docs/restv2/index.html#/Output%20Module/getTableViewConfigByViewId)
Any help would be greatly appreciated
Patricia Sobotkova
Posted 3 years ago · Edited 1 year ago·Last reply 3 years ago
14 comments
stefan_busch
·3 years ago · EditedI think the problem is the the config returned by the viewApi.
I saved it into an attribute of an asset and if you look at the key names of the config JSON generated by the viweApi you will see that they do not match with what the output module expects (for example from the viewApi you will get the key “limit” instead of “displayLength” which is used from the output module).
Former User
·3 years ago · EditedMay be that be a reason why it is unsupported/undocumented as well
stefan_busch
·3 years ago · EditedI think the problem is the the config returned by the viewApi.
I saved it into an attribute of an asset and if you look at the key names of the config JSON generated by the viweApi you will see that they do not match with what the output module expects (for example from the viewApi you will get the key “limit” instead of “displayLength” which is used from the output module).
Patricia Sobotkova
OP3 years ago · EditedYeah I have the same issue so I guess I will have to create some mappings to make the output…
I dont really understand why they differ in the first place or why they are not compatible so I wanted to see if someone had a different idea
Patricia Sobotkova
OP3 years ago · EditedUnfortunately it returns the same error in Console and on the UI - Output connector ‘JSON_DATA_TABLE’ is not compatible with view configuration ‘[type, outputRequest, uiSettings]’.
Former User
·3 years ago · EditedI guess best would be to reach out to Collibra support then. This looks strange to me.
Former User
·3 years ago · EditedHello Patricia
Please use the output module api. Example below.
You can define the view config in a variable in the form (non-readable) (most perhaps in the start button.) Also you can generate the view config json from the view id using the rest api itself, like you normally do.
def outputResult = outputModuleApi.exportJSON(
ExportJSONRequest.builder()
.viewConfig(tableViewConfig.toString()).build())
def jsonSlurper = new JsonSlurper()
response = jsonSlurper.parseText(outputResult)
response.aaData.each {
//your requirements here
}
Former User
·3 years ago · EditedThere is an API to generate the table view config with the view id.
If you can make sure that the view id would remain same, then you would need to call the api to generate the tableviewconfig first and put it in a file and the second step would be to call the export json method like I described above.
Also Collibra recommends to call the Java code Api if you wanna do it in workflows and that is because of the performance reasons.
You can ofcourse call the rest api too but any specific reason why would you want to do it if the all the subsequent java apis are there already?
Former User
·3 years ago · EditedAh!! Indeed. ViewAp i core is not supported anymore.
Former User
·3 years ago · EditedCould you please try to remove the newLines from (View config) json that you get and convert it to string and then use it
viewConf = viewApi.getView(string2Uuid(viewId)).getConfig()
configJson = outputModuleApi.exportJSON(ExportJSONRequest.builder().viewConfig(viewConf.toString()).build())
outputInJson = new groovy.json.JsonSlurperClassic().parseText(configJson
Former User
·3 years ago · EditedHello Patricia
Please use the output module api. Example below.
You can define the view config in a variable in the form (non-readable) (most perhaps in the start button.) Also you can generate the view config json from the view id using the rest api itself, like you normally do.
def outputResult = outputModuleApi.exportJSON(
ExportJSONRequest.builder()
.viewConfig(tableViewConfig.toString()).build())
def jsonSlurper = new JsonSlurper()
response = jsonSlurper.parseText(outputResult)
response.aaData.each {
//your requirements here
}
Patricia Sobotkova
OP3 years ago · Edited@umit.bhargava.rabobank.com
Thanks, the issue is that we have a lot of views and I would like to do it automatic - also when they change not just get the output once… is there a way to call rest api from workflow itself?
Patricia Sobotkova
OP3 years ago · EditedIt is because when I tried following:
viewConf = viewApi.getView(string2Uuid(viewId)).getConfig()
configJson = outputModuleApi.exportJSON(ExportJSONRequest.builder().viewConfig(viewConf).build())
outputInJson = new groovy.json.JsonSlurperClassic().parseText(configJson)
if(configJson.iTotalRecords){
for(asset in configJson){
loggerApi.info(“asset - ${asset}”)
}
}
I get an error: javax.script.ScriptException: com.collibra.common.api.exception.ApiIllegalArgumentException: com.collibra.common.exception.CollibraIllegalArgumentException: outputConnectorNotCompatibleWithViewConfig
Patricia Sobotkova
OP3 years ago · EditedYeah, they are not made public but I still can get the configuration is just not the same as the one from the REST Api
any idea on how to process?