I was trying to duplicate just the metadata of the program to create a similar looking program but an new emply one. I found a feature request which is present here [[DHIS2-15279] Clone program - Jira (Jira). I also found out that the feature has been released in 2.41.0 According to dhis2-releases/releases/2.41/ReleaseNote-2.41.0.md at master · dhis2/dhis2-releases · GitHub. However, I couldn’t find any information in documentation regarding DHIS2-15279. I also self explored 2.41 but couldn’t find any function regaring the feature. Could someone guide me to how to do it.
I am also open to using any other tools or scripts if someone has written it. I want to duplicate my program with all the datasets and validators intact. The duplicated program must be a new empty one.
Thank you for sharing the Jira ticket. As you can see, the ticket is still in ‘Testing’ phase so it’s not yet implemented in any version. In the ticket’s comments, there’s a link that explains how the feature will work (in the backend): docs.dhis2.org - using-the-api - metadata - #copy-program
Although the process won’t be as easy as the ‘Program copy’ feature mentioned above, I think you could achieve this by using the Import/Export app. If you’d like to test this, use the Metadata export and Metadata dependency export to get the program details and dependencies. After that you will rename the unique properties for programIndicators’ (name, shortName), progam’s name…etc
{
“httpStatus”: “Conflict”,
“httpStatusCode”: 409,
“status”: “ERROR”,
“message”: “ERROR: duplicate key value violates unique constraint "programstage_name_key"\n Detail: Key (name)=(Birth) already exists.”,
“errorCode”: “E1004”
}
Am i doing something wrong? How does it work? Do I need to send something in body? I can’t find anything in documentation.