Github search api get line number

Hi,

I can search Github using REST API just fine, I also pass "Accept" : "application/vnd.github.v3.text-match+json" to get the snippet of the matched code.
But I don’t seem to get the line number of the matches, I get Indices but that is not position of the matched code in whole file.

How can I get line number of that matched texts?

Thanks

Hey there @uniql0 :wave:

Appreciate you taking the time to write in and join our Community! Also happy to help here but would love to know if you’re running your curl against a public or private repo?

If public, could you please let us know which repo?

It would also be great to see the full curl you’re using to reproduce the behavior and verify what’s expected.

Hi, I have a similar requirement. I want to get the line number of the matched text from github search API.
For example, following text-match-metadata, if I make a curl request like this:

curl -H 'Accept: application/vnd.github.v3.text-match+json' \
'https://api.github.com/search/issues?q=windows+label:bug+language:python+state:open&sort=created&order=asc'

I will get the matched text as response:

{
  "text_matches": [
    {
      "object_url": "https://api.github.com/repositories/215335/issues/132",
      "object_type": "Issue",
      "property": "body",
      "fragment": "comprehensive windows font I know of).\n\nIf we can find a commonly distributed windows font that supports them then no problem (we can use html font tags) but otherwise the '(21)' style is probably better.\n",
      "matches": [
        {
          "text": "windows",
          "indices": [
            14,
            21
          ]
        },
        {
          "text": "windows",
          "indices": [
            78,
            85
          ]
        }
      ]
    },
    {
      "object_url": "https://api.github.com/repositories/215335/issues/comments/25688",
      "object_type": "IssueComment",
      "property": "body",
      "fragment": " right after that are a bit broken IMHO :). I suppose we could have some hack that maxes out at whatever the font does...\n\nI'll check what the state of play is on Windows.\n",
      "matches": [
        {
          "text": "Windows",
          "indices": [
            163,
            170
          ]
        }
      ]
    }
  ]
}

From fragment property I would get the code fragment that matches the text, however I want to get line number along with code fragment. Is there any way?

Hey everyone I need some help. Someone has used this platform, github, to install software to hack me and have access to everything. It’s rooted to the device via an apache code of some sorts, but I have no control over my phones administrative actions or any of my accounts. Sometimes they will lock me out of my bank account and then let me back in just for games I guess, idk. Please someone help me!!!