Some time ago I posted a question ('Published by' details via GraphQL) about how to make visisble who published for instance a glossary term.
I noticed that like this you can't show who may have deleted the asset.
Does anyone have a clue how to retrieve this details via graphQL (or in a different manner)?
Kind regards,
Albert
Best answer by Maksim Zhelyazkov
Hello Albert,
in regular ONE GraphQL you cannot find information about a deleted assset as it is simply gone once it is deleted. The information you are after lives in the Audit module, which keeps log of every operation that users perform in the MMM. You can get that info via the Audit GraphQL endpoint, but there are two conditions for it:
Delete events are recorded by default only for select number of entities. For the rest, you have to add the trait audit:auditEnabled if you want to record the delete events. This is because the audit database can grow quickly the more action is keeps on record, thus affecting application performance.
Audit endpoint is accessible through playground only since version 15.4.0-patch14. If you are on an earlier version you will not be able to access the audit endpoint from Playground, but you may be able to from ONE desktop via the JSON call step.
If you want read more about reaching the Audit GraphQL endpoint and see some example operations, check out our "Audit API" documentation as it has detailed description. I am sharing below a screenshot of a query you can use to see the deleted assets via the Audit GraphQL:
Note: Keep in mind that when you delete an item from the UI, ONE does not immediately remove the node from the metadata. Instead, it starts a workflow that sets a delete flag internally for the asset node. This is why the action is called “Finish_Success” instead of a “Delete”. Only items permanently deleted from the metadata would have a status “deleted”.
in regular ONE GraphQL you cannot find information about a deleted assset as it is simply gone once it is deleted. The information you are after lives in the Audit module, which keeps log of every operation that users perform in the MMM. You can get that info via the Audit GraphQL endpoint, but there are two conditions for it:
Delete events are recorded by default only for select number of entities. For the rest, you have to add the trait audit:auditEnabled if you want to record the delete events. This is because the audit database can grow quickly the more action is keeps on record, thus affecting application performance.
Audit endpoint is accessible through playground only since version 15.4.0-patch14. If you are on an earlier version you will not be able to access the audit endpoint from Playground, but you may be able to from ONE desktop via the JSON call step.
If you want read more about reaching the Audit GraphQL endpoint and see some example operations, check out our "Audit API" documentation as it has detailed description. I am sharing below a screenshot of a query you can use to see the deleted assets via the Audit GraphQL:
Note: Keep in mind that when you delete an item from the UI, ONE does not immediately remove the node from the metadata. Instead, it starts a workflow that sets a delete flag internally for the asset node. This is why the action is called “Finish_Success” instead of a “Delete”. Only items permanently deleted from the metadata would have a status “deleted”.
Thanks for your reply! This really puts me on the right track, so I can continue my investigation. I'm quite sure there will be some follow-up questions…
In my case I will use a JSON Call in One Desktop anyway, filtering on ID, for a specific metadata entity/assetType. Besides the name I would also need the date or datetime of the deletion (so status finish_succes). In the output I see a time attribute, consisting of 13 digits. Is that a Julian date?
The time attribute is not Julian, it is Unix epoch timestamps in milliseconds. If you want human-readable string directly in a report, you can convert it on client side. Depending on your use case, you can convert it via SQL statement, Javascript, Excel Sheet or directly in ONE desktop expression. As a quick test you can also do it in the browser too. Open DevTools → Console → paste new Date(number).toLocaleString()
Indeed I have a follow-up question. I have been doing some trial-and-error on this: my plan seems syntactically correct, but doesn't produce the output that I was hoping for. Can you maybe have a look at the JSON call step. Can you see where things go wrong? I have attached the files. Peculiar about file deletedAssets1 is that when you open it in Notepad, you will notice that it contains rows, but empty.
The error 400 you see in your response debug file is because of bad request. I saw in the request debug that you are quering the main MMM endpoint. As I said in my last response, the delete assets live in the Audit module. You have to query the audit url, ie. https://audit-[host]/graphql.
When defining the query in the JSON-call I tried to combine details from your example and the example from the documentation portal (Audit API :: Ataccama ONE). Both examples indicate module MMM, hence I also used in the step.
You mentioned that via graphQL version 15.4 is needed and that I could try the Desktop JSON call. Do you mean that it is also not possible with our version 14.5 in Desktop?
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.