Created
September 24, 2015 20:17
-
-
Save marcelbirkner/37e4b5c1715d0613e087 to your computer and use it in GitHub Desktop.
Access GitLab REST API with Groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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