Using plone.api to create groups (solved!)

I'm trying to use plone.api to create groups. This example, taken from the documentation, doesn't produce any errors but also doesn't create the 'board_members' group.

This is a plain vanilla, fresh Plone 5.0.5 install using the unified installer to which I've only added Products.WebServerAuth to [eggs] in buildout. I'm launching this script with

sudo -u plone_daemon /opt/Plone-wsa/zeocluster/bin/client2 -O Plone run /var/tmp/example.py

/var/tmp/example.py is:

from plone import api

group = api.group.create(
        groupname='board_members',
        title='Board members',
        description='Just a description',
        roles=['Reader', ],
        groups=['Site Administrators', ],
)

For what it's worth, I've used other plone.api methods successfully, e.g. I've used api.group.get_groups() and api.user.get_users() without problem.

Thanks!

In irc, tkimnguyen pointed out that I needed to commit the transaction:

import transaction
transaction.commit()

Which works! (This is documented, I just missed it. Thanks, tkimnguyen!)