简体   繁体   中英

How do I add a user to groups by using the Bugzilla API?

Here is my code:

data = {
    'groups': [{'add':{'S8','ALL'}}]
    }
    r = requests.put(bugzilla_host + '/rest.cgi/user/user_name?token=' + token, data=data)

And I get the following error:

> {"error":true,"message":"Can't use string (\"add\") as a HASH ref
> while \"strict refs\" in use at Bugzilla/User.pm line
> 419.\n","code":100500,"documentation":"https://bugzilla.readthedocs.org/en/5.0/api/"}

我发现我应该将data=data更改为json=data

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM