Create Nexus User Through REST API -
i working nexus oss 2.11.x , create new users through rest api. following command correctly retrieves list of users, confirming able call api:
curl -u $nexus_user:$nexus_pass $nexus_local/service/local/users
based on api documentation, i've constructed json user object:
export user='{"data":{"email":"testing@example.com","firstname":"test","lastname":"ing","userid":"testing","status": "active","roles":["repository-any-read"],"password": "test123$"}}'
and submit post request:
curl -i -h "accept: application/json" -h "contenttype: application/json; charset=utf-8" -v -d "$user" -u $nexus_user:$nexus_pass $nexus_local/service/local/users
the response comes http 201 (created) - get /service/local/users
gives me original user list. user not in list provided ui, , log (available in ui) not indicate activity took place. $nexus_user account in "nexus administrator" role.
does have suggestion i'm overlooking here?
i used above code , had same problem:
http/1.1 201 created
and nothing happened. after debuging noticed simple typo above problem. instead:
-h "contenttype: application/json; charset=utf-8"
should be:
-h "content-type: application/json; charset=utf-8"
(notice dash in content-type
) , started working.
Comments
Post a Comment