← Back to team overview

dhis2-devs team mailing list archive

Re: re-sinding user account invitations

 

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

Follow ups

References