Created
January 17, 2019 14:32
-
-
Save chamerling/9fe793149be09a3dcc547717da91121b to your computer and use it in GitHub Desktop.
Massive user creation for OpenPaaS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Login into OP as admin, open the browser console and copy/paste this script after having updated the domainId value | |
// define it from your instance | |
const domainId = '5bacec0db1a8481f6b30e806'; | |
function getBody(i, domainId) { | |
return `{"accounts":[{"type":"email","emails":["user-${i}@open-paas.org"]}],"domains":[{"domain_id":"${domainId}"}],"password":"secret"}`; | |
} | |
for(var i = 0; i < 1000; i++) { | |
// do not care about promise result | |
fetch(`http://localhost:8080/api/domains/${domainId}/members`, { | |
method: 'POST', | |
headers: new Headers({ | |
'Content-Type': 'application/json' | |
}), | |
body: getBody(i) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment