Skip to content

Instantly share code, notes, and snippets.

@marcelbirkner
Created September 24, 2015 20:17
Show Gist options
  • Save marcelbirkner/37e4b5c1715d0613e087 to your computer and use it in GitHub Desktop.
Save marcelbirkner/37e4b5c1715d0613e087 to your computer and use it in GitHub Desktop.
Access GitLab REST API with Groovy
// GitLab Settings
def gitUrl = 'http://git/api/v3'
def privateToken = 'xYxYxYxYxYxYxYxYxYxY'
def currentPage = 1
def projectsPerPage = 100
// Reading projects from GitLab REST API
def projectList = new URL("${gitUrl}/projects/all?page=${currentPage}&per_page=${projectsPerPage}&private_token=${privateToken}")
def projects = new groovy.json.JsonSlurper().parse(projectList.newReader())
projects.each {
println it.name
}
@zzarkouna
Copy link

hello, merci beaucoup c'est très simple
mais en cas de post?

@marcelbirkner
Copy link
Author

Hi @zzarkouna,

maybe the Groovy HTTP Builder will help you. Have a look here.
https://github.com/jgritman/httpbuilder/wiki/POST-Examples

Bonne journée,
Marcel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment