anonymize problems

I can’t get anonymisation to work If I put it in a lua file:

function OnStableStudy(studyId, tags, metadata) local command = {} local modified = RestApiPost('/studies/' .. studyId .. '/anonymize', DumpJson(command)) end

I always get: Lua: Error in RestApiPost() for URI: /studies/747fc6c6-bd2a6043-b56cf4e3-6c186911-2f25bced/anonymize

it’s probably my lua inexperience :slight_smile: can anybody help?

oh btw i can anonymize the study without a problem if i use curl it’s just something i can’t get right in my lua. There should be {} in the raw post body but if i dump the command to string i see []

Answering my own question:

Like this it does work:

`

– tags to keep during anonymization
local keep = {‘StudyDescription’, ‘SeriesDescription’}
function OnStableStudy(studyId, tags, metadata)
if (metadata[‘ModifiedFrom’] == nil and metadata[‘AnonymizedFrom’] == nil) then

– tags to keep during anonymization
local keep = {‘StudyDescription’, ‘SeriesDescription’}

– anonimyze the study
local command = {}
command[‘Keep’] = keep
local modified = ParseJson(RestApiPost(‘/studies/’ … studyId … ‘/anonymize’, DumpJson(command)))

end
end
`