and what kind of API contract that REST API should implement. Can you please point me to some blog/tutorial which talks about how to achieve this?
There are several commands related to roster:
$ ejabberdctl help --tags roster
Available commands with tag roster:
add_rosteritem localuser localhost user host nick group subs
Add an item to a user's roster (supports ODBC)
delete_rosteritem localuser localhost user host
Delete an item from a user's roster (supports ODBC)
get_roster user host
Get roster of a local user
process_rosteritems action subs asks users contacts
List/delete rosteritems that match filter
push_alltoall host group
Add all the users to all the users of Host in Group
push_roster file user host
Push template roster from file to a user
push_roster_all file
Push template roster from file to all those users
You can find more details about those commands in:
https://docs.ejabberd.im/developer/ejabberd-api/admin-api/
Trying to find which module to use
All those commands are implemented in mod_admin_extra. So, you can simply enable this module in ejabberd.yml and the commands will be available for execution.