Hi JM,

I had a similar requirement a few weeks back. Pierre from Jembi helped with python scripting to convert all the user invites in csv to Json. It was then relatively easy to have multiple invites sent out in one command. 

If it helps, I have attached the script below and copied Pierre. He had mentioned working on this as a contribution to the community.

Best regards,
Busoye 

import requests
import json
import csv

resp = ''
with open('invites.csv') as csvfile:
	invitereader=csv.reader(csvfile, delimiter=',')
	for row in invitereader:
		resp= '{"email": "'+row[0]+'","organisationUnits": [{"id": "'+row[1]+'" }],"userCredentials": {"username": "'+row[3]+'"},"groups": [{"id": "'+row[2]+'" }]},'
		print resp
		url = 'http://train.dhis.hisp.org/unisa/api/users/invite'
		headers = {'content-type': 'application/json'}
		response = requests.post(url, data=resp, auth=('admin', 'district'),headers=headers)
		print response

On 24 Oct 2014, at 16:01, Jim Grace <jimgr...@gmail.com> wrote:

Hi JM,

Both your questions sound like good ideas to me, but unfortunately neither is supported in the current software.

Cheers,
Jim

On Fri, Oct 24, 2014 at 8:52 AM, Juan Manuel Alcantara Acosta <jmalcanta...@gmail.com> wrote:
Hello Devs

I recently had create 250+ user account invitations and I had some problems along the way. Some users got codes that were rejected by the system, I didn't find a reason for that but it happened to just a few users. Others just couldn't  find the emails for multiple reasons and asked to resend them. So, I have a couple of questions:

- Is there a way to re-send the emails perhaps with a new code? Of course other than deleting the invitations and creating them again. I imagine I'll have to do this at least a couple of times to get every user to activate their accounts and I'd like to avoid having to manually delete 200+ accounts every time I have to renew the invitations.

- Is it possible to create multiple invitations with a single payload?

Best regards,
JM
_______________________________________________
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

_______________________________________________
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

_______________________________________________
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

Reply via email to