blackducksoftware / hub-rest-api-python

HUB REST API Python bindings
Apache License 2.0
89 stars 104 forks source link

Assign a new role to a user in a project #191

Closed 3cpt closed 3 years ago

3cpt commented 3 years ago

Projects.py#L380

Saw this comment. Any idea or suggestion? As a workaround, I tried to do the POST manually, but I get a 412.

Thanks

Coulicoula commented 3 years ago

Try to set the Headers content-type with: headers['Content-Type'] = 'application/vnd.blackducksoftware.internal-1+json' => It should avoid the 412. By crafting the post request myself, I can add role to a user already in a project

3cpt commented 3 years ago

Didn't try that option, but I tried the Assigning a Role to a User endpoint (/api/users/{userId}/roles) that is available in the REST API documentation, and it works too.