Right, so in that case I don’t think it is possible directly from the API.
You could write a script that clones the repo, adds the submodule like you would on the command-line and then pushes back to GitLab. The clone and push could be done via the API, but TBH I’d be inclined to just call git
directly from a shell script or a library. Potentially you could do this from within your CI/CD pipeline, and just write it into your .gitlab-ci.yml
file, if that makes sense in your workflow.
You’ll need a personal access token for this BTW.