Skip to content

GitLab API: search blob in an specific branch

I am trying to find the files which contain the text DUMMY_TEXT.

I have different branches and I want to iterate through all of them.

In this example, I am trying to get the files from the branch with name branch_name_2

https://gitlab.example.de/api/v4/projects/88996/search?scope=blobs&search=DUMMY_TEXT&per_page=100&page=1&private_token=<%my_private_token%>&ref=branch_name_2

I am getting always as response the files of branch master (see response "ref": "master").

Response:

      {
    "basename": "XXX",
    "data": DUMMY_TEXT" 
    "filename": "dummy_text_file.md",
    "id": null,
    "ref": "master",
    "startline": 1,
    "project_id": 88996
  }

Any ideas why I am doing wrong?

Edited by MrPinedita