2

I want to find a project on Gitlab using the sshUrlToRepo or httpUrlToRepo field as a filter.

I'm trying to use the GraphQL API to do this, but am not having much success. My query, so far, looks like this:

query {
  projects(search: "url_sub_str") {
    nodes {
      id
      sshUrlToRepo
      httpUrlToRepo
    }

  }
}

This seems to filter based on url_sub_str but it's not an exact match. Is there a way to query a Gitlab project using a git remote URL of either the ssh or http variety?

Note, I'm not wedded to a GraphQL approach, a regular REST call would also do. But, ideally, I don't want to have to query a load of projects and do the search client-side. Thanks.

1 Answer 1

0

I would suggest if you want the exact match using

query {
  project(fullPath: "path_str") {
      id
      sshUrlToRepo
      httpUrlToRepo
  }
}

where path_str is everything between the hostname and .git https://gitlab.com/{path_str}.git

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.