Importing Validation Rules through the Web API

Hi Guys

Could anyone please be kind enough to share the steps to import Validation Rules through the Web API? Please also provide a sample url and possibly a template csv file (if necessary).

Your assistance will be much appreciated.

Regards

···


Farai Mutero

Hi Farai,

the meta-data import process is documented here:

http://www.dhis2.org/doc/snapshot/en/user/html/ch25s05.html

First, you need to construct your XML (or possibly JSON), something like this:

<?xml version='1.0' encoding='UTF-8'?>

absoluteless_than_or_equal_to

#{pEOVd4Z3TAS.Prlt0C1RF0s}

People asked at Penta3 if Exclusive breastfeeding, <1 year Fixed[33.292]

true

#{n6aMJNLdvep.Prlt0C1RF0s}

Penta3, <1 year Fixed[25.292]

true

MonthlyQuestion asked at Penta3 vs number of Penta3

Please note the wrapper element. After that you can POST your xml to the metaData web api resource with something like this if using curl and naming the file metaData.xml:

curl -H "Content-Type: application/xml" -u admin:district -d @metaData.xml "[http://your-server-url/api/metaData](http://your-server-url/api/metaData)" -X POST

regards,
Lars


···

On Thu, Jun 27, 2013 at 5:25 PM, Farai Mutero fmutero@gmail.com wrote:

Hi Guys

Could anyone please be kind enough to share the steps to import Validation Rules through the Web API? Please also provide a sample url and possibly a template csv file (if necessary).

Your assistance will be much appreciated.

Regards


Farai Mutero


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Thanks Lars and Ranga for the info. Now I’m clear.

Regards

Farai

···

On Mon, Jul 15, 2013 at 9:03 PM, Lars Helge Øverland larshelge@gmail.com wrote:

Hi Farai,

the meta-data import process is documented here:

http://www.dhis2.org/doc/snapshot/en/user/html/ch25s05.html

First, you need to construct your XML (or possibly JSON), something like this:

<?xml version='1.0' encoding='UTF-8'?>

absoluteless_than_or_equal_to

#{pEOVd4Z3TAS.Prlt0C1RF0s}

People asked at Penta3 if Exclusive breastfeeding, <1 year Fixed[33.292]

true

#{n6aMJNLdvep.Prlt0C1RF0s}

Penta3, <1 year Fixed[25.292]

true

MonthlyQuestion asked at Penta3 vs number of Penta3

Please note the wrapper element. After that you can POST your xml to the metaData web api resource with something like this if using curl and naming the file metaData.xml:

curl -H "Content-Type: application/xml" -u admin:district -d @metaData.xml "[http://your-server-url/api/metaData](http://your-server-url/api/metaData)" -X POST


regards,
Lars





Farai Mutero

On Thu, Jun 27, 2013 at 5:25 PM, Farai Mutero fmutero@gmail.com wrote:

Hi Guys

Could anyone please be kind enough to share the steps to import Validation Rules through the Web API? Please also provide a sample url and possibly a template csv file (if necessary).

Your assistance will be much appreciated.

Regards


Farai Mutero


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Great. Just realized that when you create new validation rules there is not much point in setting last updated, created attributes. Code is also not mandatory. Check out this minimal example.

<?xml version='1.0' encoding='UTF-8'?>

absoluteless_than_or_equal_to

#{pEOVd4Z3TAS.Prlt0C1RF0s}

People asked at Penta3 if Exclusive breastfeeding, <1 year Fixed

true

#{n6aMJNLdvep.Prlt0C1RF0s}

Penta3, <1 year Fixed

true

Monthly

Question asked at Penta3 vs number of Penta3

···

On Mon, Jul 15, 2013 at 10:10 PM, Farai Mutero fmutero@gmail.com wrote:

Thanks Lars and Ranga for the info. Now I’m clear.

Regards

Farai

On Mon, Jul 15, 2013 at 9:03 PM, Lars Helge Øverland larshelge@gmail.com wrote:

Hi Farai,

the meta-data import process is documented here:

http://www.dhis2.org/doc/snapshot/en/user/html/ch25s05.html

First, you need to construct your XML (or possibly JSON), something like this:

<?xml version='1.0' encoding='UTF-8'?>

absoluteless_than_or_equal_to

#{pEOVd4Z3TAS.Prlt0C1RF0s}

People asked at Penta3 if Exclusive breastfeeding, <1 year Fixed[33.292]

true

#{n6aMJNLdvep.Prlt0C1RF0s}

Penta3, <1 year Fixed[25.292]

true

MonthlyQuestion asked at Penta3 vs number of Penta3

Please note the wrapper element. After that you can POST your xml to the metaData web api resource with something like this if using curl and naming the file metaData.xml:

curl -H "Content-Type: application/xml" -u admin:district -d @metaData.xml "[http://your-server-url/api/metaData](http://your-server-url/api/metaData)" -X POST


regards,
Lars





Farai Mutero

On Thu, Jun 27, 2013 at 5:25 PM, Farai Mutero fmutero@gmail.com wrote:

Hi Guys

Could anyone please be kind enough to share the steps to import Validation Rules through the Web API? Please also provide a sample url and possibly a template csv file (if necessary).

Your assistance will be much appreciated.

Regards


Farai Mutero


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp