How to fetch commits from a specific branch using Gitlab API?


I need to fetch only commits made in a specific branch like I do via CLI:

git log origin/master..origin/specific_branch

Howerver, when I call Gitlab API “List repository commits” (GET /projects/:id/repository/commits) resource, it fetches commits made before the branch creation. Moreover, the parameters since and until accept only dates in ISO format, which prevents me to use refs like I do via CLI.

Is there a way to achieve this?

const host = process.env.GITLAB_HOST;
const project_id = 325;
const branch = “master”;
const GL = new GitlabAPI(host, project_id);

const commits = await GL.commits(branch);