Groups and Subgroups creation in GitLab using API

Hi All,

I would like to create groups and subgroups using API. But,
It’s failing when I was trying to create more than one subgroup in the main group

–data ‘{“path”: “maingroup”, “name”: “subgroup1”, “parent_id”: “maingroup_ID”}’
–data ‘{“path”: “maingroup”, “name”: “subgroup2”, “parent_id”: “maingroup_ID”}’

was able to create subgroup1 using API, but when I try to create subgroup2 then getting below error.

{message: Failed to save group {:name=>["has already been taken]}

Can someone please help me on this ?