How to add a user/roles to DNG programmatically through API? Using Python requests
I've been running into issues as to how to add users through the API. I've been looking at this website: https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi#Members_collection and specifically the section "Members collection: POST". I've copied the data in the request body example and edited it to fit my services. I then added it to an xml file and as a string. I've tried posting both of them but I keep getting a 400 "If the request body is invalid" error. Could anyone point me in the right direction for this?
s = requests.Session()
eaders3 = {
'Accept': 'application/rdf+xml',
'OSLC-core-version': '2.0',
'Content-Type': 'application/x-www-form-urlencoded',
#'Content-Type': 'application/xml;charset=UTF-8',
}
with open('pa-members-to-add.xml', 'rb') as f:
data = f.read().replace(b'\n', b'')
print(s.post(url3, headers=headers3, data=data))
One answer
The user must already exist. No AFAIK you can't create a user using this API - for Liberty user registry you can use repotools-jts -importUsers , see https://www.ibm.com/docs/en/elm/7.0.2?topic=reference-importusers or for LDAP the users must exist in LDAP and then I guess (haven't tried it) =importUsers can assign licenses.
Comments
Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 16 '22, 12:00 p.m.Ian Barnard
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 16 '22, 12:08 p.m.Jacob Harland
Jun 16 '22, 12:27 p.m.Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jun 20 '22, 2:27 a.m.