Gitlab Commit API returns Bad Request Error

I am trying to push some file as an update to gitlab using Gitlab v4 REST API but seeing issues.

Request Body:

const reqBody = {
            uri: `${GITLAB_URL}/projects/123/repository/commits`,
            headers: {
                'PRIVATE-TOKEN': GITLAB_TOKEN,
                'Content-Type': 'application/json'
            data: {
                'branch': 'testBranch',
                'commit_message': 'testing MR commit',
                'actions': [
                        'action': 'update',
                        'file_path': 'dir/file_abc.eyaml',
                        'content': 'updatedFileContent'
const resp = await;

While running this, I see the response as:

"400 - "{\"error\":\"branch is missing, branch is empty, commit_message is missing, actions is missing\"}""

Am I missing something in the request body? I have been following this Gitlab API reference: .


1 Like

I am facing the same problem. Were you able to solve this issue?