{"id":15035545,"url":"https://github.com/gitlab4j/gitlab4j-api","last_synced_at":"2025-05-13T15:10:25.207Z","repository":{"id":14230728,"uuid":"16937765","full_name":"gitlab4j/gitlab4j-api","owner":"gitlab4j","description":"GitLab4J API (gitlab4j-api) provides a full featured Java client library for working with GitLab repositories via the GitLab REST API","archived":false,"fork":false,"pushed_at":"2025-05-09T13:47:57.000Z","size":4774,"stargazers_count":1098,"open_issues_count":168,"forks_count":468,"subscribers_count":31,"default_branch":"main","last_synced_at":"2025-05-09T14:58:07.593Z","etag":null,"topics":["gitlab","gitlab-api","gitlab4j-api","hacktoberfest","java","java-gitlab-api"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gitlab4j.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-02-18T05:09:14.000Z","updated_at":"2025-05-09T13:48:01.000Z","dependencies_parsed_at":"2023-11-16T07:33:11.240Z","dependency_job_id":"97e3c487-b23a-48a3-adc3-95aaa4759793","html_url":"https://github.com/gitlab4j/gitlab4j-api","commit_stats":null,"previous_names":[],"tags_count":289,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitlab4j%2Fgitlab4j-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitlab4j%2Fgitlab4j-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitlab4j%2Fgitlab4j-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitlab4j%2Fgitlab4j-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitlab4j","download_url":"https://codeload.github.com/gitlab4j/gitlab4j-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253969247,"owners_count":21992263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gitlab","gitlab-api","gitlab4j-api","hacktoberfest","java","java-gitlab-api"],"created_at":"2024-09-24T20:28:53.271Z","updated_at":"2025-05-13T15:10:20.118Z","avatar_url":"https://github.com/gitlab4j.png","language":"Java","readme":"# GitLab4J\u0026trade; API (gitlab4j-api)\u003cbr /\u003eJava Client Library for the GitLab REST API\r\n\r\n[![Maven Central](https://img.shields.io/maven-central/v/org.gitlab4j/gitlab4j-api.svg)](http://mvnrepository.com/artifact/org.gitlab4j/gitlab4j-api)\r\n[![Build Status](https://github.com/gitlab4j/gitlab4j-api/actions/workflows/ci-build.yml/badge.svg?branch=main)](https://github.com/gitlab4j/gitlab4j-api/actions/workflows/ci-build.yml)\r\n[![javadoc.io](https://javadoc.io/badge2/org.gitlab4j/gitlab4j-api/javadoc.io.svg)](https://javadoc.io/doc/org.gitlab4j/gitlab4j-api)\r\n\r\nGitLab4J\u0026trade; API (gitlab4j-api) provides a full featured and easy to consume Java library for working with GitLab repositories via the GitLab REST API.  Additionally, full support for working with GitLab webhooks and system hooks is also provided.\r\n\r\n---\r\n## GitLab Server Version Support\r\n\r\nGitLab4J-API supports both GitLab Community Edition [(gitlab-ce)](https://gitlab.com/gitlab-org/gitlab-ce/) and GitLab Enterprise Edition [(gitlab-ee)](https://gitlab.com/gitlab-org/gitlab-ee/).\r\n\r\n**NOTICE**:  \r\nAs of GitLab 11.0 support for the GitLab API v3 has been removed from the GitLab server (see https://about.gitlab.com/2018/06/01/api-v3-removal-impending/). Support for GitLab API v3 will be removed from this library sometime in 2019. If you are utilizing the v3 support, please update your code to use GitLab API v4.\r\n\r\n---\r\n## Using GitLab4J-API\r\n\r\n### **Java 11 Requirement**\r\nAs of GitLab4J-API 6.0.0, Java 11+ is now required to use GitLab4J-API.\r\n\r\n### **Javadocs**\r\nJavadocs are available here: [![javadoc.io](https://javadoc.io/badge2/org.gitlab4j/gitlab4j-api/javadoc.io.svg)](https://javadoc.io/doc/org.gitlab4j/gitlab4j-api)\r\n\r\n\r\n### **Project Set Up**\r\nTo utilize GitLab4J\u0026trade; API in your Java project, simply add the following dependency to your project's build file:\u003cbr /\u003e \r\n\r\n**Gradle: build.gradle**\r\n```java\r\ndependencies {\r\n    ...\r\n    implementation group: 'org.gitlab4j', name: 'gitlab4j-api', version: '6.0.0-rc.10'\r\n}\r\n```\r\n\r\n**Maven: pom.xml**\r\n```xml\r\n\u003cdependency\u003e\r\n    \u003cgroupId\u003eorg.gitlab4j\u003c/groupId\u003e\r\n    \u003cartifactId\u003egitlab4j-api\u003c/artifactId\u003e\r\n    \u003cversion\u003e6.0.0-rc.10\u003c/version\u003e\r\n\u003c/dependency\u003e\r\n```\r\n\r\n**Jbang:**\r\n\r\n [Jbang](https://www.jbang.dev/) is very convinient to run scripts writen in Java having dependencies on third party libraries.\r\n\r\n Just add this line at the top of your script:\r\n\r\n```java\r\n//DEPS org.gitlab4j:gitlab4j-api:6.0.0-rc.10\r\n```\r\n\r\n**Ivy and SBT**\u003cbr/\u003e\r\nThere have been reports of problems resolving some dependencies when using Ivy or SBT, for help resolving those issues see:\u003cbr/\u003e\r\n\u003ca href=\"https://github.com/eclipse-ee4j/jaxrs-api/issues/571\"\u003eJAX-RS API Issue #571\u003c/a\u003e\u003cbr/\u003e\r\n\u003ca href=\"https://github.com/eclipse-ee4j/jaxrs-api/issues/572\"\u003eJAX-RS API Issue #572\u003c/a\u003e\r\n\r\n### **Lastest version**\r\n\r\nWhile we are frequently creating releases, you might be interested by a feature that has not been published yet.\r\nYou can use jars created by [jitpack](https://jitpack.io/) to get the newest version.\r\n\r\n**Usage with gradle:**\r\n\r\n```gradle\r\nrepositories {\r\n    mavenCentral()\r\n    maven {\r\n        url \"https://jitpack.io\"\r\n        content {\r\n            includeGroup \"com.github.gitlab4j.gitlab4j-api\"\r\n        }\r\n    }\r\n}\r\n\r\ndependencies {\r\n    // ...\r\n    implementation 'com.github.gitlab4j.gitlab4j-api:gitlab4j-api:main-SNAPSHOT'\r\n    // ...\r\n}\r\n```\r\n\r\n**Usage with maven:**\r\n\r\n```xml\r\n\u003crepositories\u003e\r\n  \u003crepository\u003e\r\n    \u003cid\u003ejitpack.io\u003c/id\u003e\r\n    \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\r\n  \u003c/repository\u003e\r\n\u003c/repositories\u003e\r\n\r\n\u003cdependencies\u003e\r\n  \u003cdependency\u003e\r\n    \u003cgroupId\u003ecom.github.gitlab4j.gitlab4j-api\u003c/groupId\u003e\r\n    \u003cartifactId\u003egitlab4j-api\u003c/artifactId\u003e\r\n    \u003cversion\u003emain-SNAPSHOT\u003c/version\u003e\r\n  \u003c/dependency\u003e\r\n  \u003c!-- ... --\u003e\r\n\u003c/dependencies\u003e\r\n```\r\n\r\n**Usage with jbang:**\r\n\r\nYou just need to declare the dependency like this, instead of using the maven coordinates:\r\n\r\n```java\r\n//DEPS https://github.com/gitlab4j/gitlab4j-api/tree/main#gitlab4j-api:SNAPSHOT\r\n```\r\n\r\n**Using a specific commit**\r\n\r\nVersion `main-SNAPSHOT` indicates that you would like to get the latest of the `main` branch.\r\nYou can also point to a specific commit:\r\n\r\n```gradle\r\ndependencies {\r\n    implementation 'com.github.gitlab4j.gitlab4j-api:gitlab4j-api:ab6b84c6b0'\r\n}\r\n```\r\n\r\n```xml\r\n\u003cdependency\u003e\r\n    \u003cgroupId\u003ecom.github.gitlab4j.gitlab4j-api\u003c/groupId\u003e\r\n    \u003cartifactId\u003egitlab4j-api\u003c/artifactId\u003e\r\n    \u003cversion\u003eab6b84c6b0\u003c/version\u003e\r\n\u003c/dependency\u003e\r\n```\r\n\r\n```java\r\n//DEPS https://github.com/gitlab4j/gitlab4j-api/tree/ab6b84c6b096ea3079d25115a59c272a4ae602aa\r\n```\r\n\r\n---\r\n\r\n### **Models jar**\r\n\r\nFor some usages, the HTTP layer based on Jersey can't be used.\r\nThose projects might want to use the Jackson-based model classes, and implement the REST call themself.\r\n\r\n**Gradle: build.gradle**\r\n```java\r\ndependencies {\r\n    ...\r\n    implementation 'org.gitlab4j:gitlab4j-models:6.0.0-rc.10'\r\n}\r\n```\r\n\r\n**Maven: pom.xml**\r\n```xml\r\n\u003cdependency\u003e\r\n    \u003cgroupId\u003eorg.gitlab4j\u003c/groupId\u003e\r\n    \u003cartifactId\u003egitlab4j-models\u003c/artifactId\u003e\r\n    \u003cversion\u003e6.0.0-rc.10\u003c/version\u003e\r\n\u003c/dependency\u003e\r\n```\r\n\r\n---\r\n\r\n### **Usage Examples**\r\n\r\nGitLab4J-API is quite simple to use, all you need is the URL to your GitLab server and the Personal Access Token from your GitLab Account Settings page.  Once you have that info it is as simple as:\r\n```java\r\n// Create a GitLabApi instance to communicate with your GitLab server\r\nGitLabApi gitLabApi = new GitLabApi(\"http://your.gitlab.server.com\", \"YOUR_PERSONAL_ACCESS_TOKEN\");\r\n\r\n// Get the list of projects your account has access to\r\nList\u003cProject\u003e projects = gitLabApi.getProjectApi().getProjects();\r\n```\r\n\r\nYou can also login to your GitLab server with username, and password:\r\n```java\r\n// Log in to the GitLab server using a username and password\r\nGitLabApi gitLabApi = GitLabApi.oauth2Login(\"http://your.gitlab.server.com\", \"username\", \"password\");\r\n```\r\nAs of GitLab4J-API 4.6.6, all API requests support performing the API call as if you were another user, provided you are authenticated as an administrator:\r\n```java\r\n// Create a GitLabApi instance to communicate with your GitLab server (must be an administrator)\r\nGitLabApi gitLabApi = new GitLabApi(\"http://your.gitlab.server.com\", \"YOUR_PERSONAL_ACCESS_TOKEN\");\r\n\r\n// sudo as as a different user, in this case the user named \"johndoe\", all future calls will be done as \"johndoe\"\r\ngitLabApi.sudo(\"johndoe\")\r\n\r\n// To turn off sudo mode\r\ngitLabApi.unsudo();\r\n```\r\n\r\n---\r\n### **Setting Request Timeouts**\r\nAs of GitLab4J-API 4.14.21 support has been added for setting the conect and read timeouts for the API client:\r\n```java\r\nGitLabApi gitLabApi = new GitLabApi(\"http://your.gitlab.com\", \"YOUR_PERSONAL_ACCESS_TOKEN\", proxyConfig);\r\n\r\n// Set the connect timeout to 1 second and the read timeout to 5 seconds\r\ngitLabApi.setRequestTimeout(1000, 5000);\r\n```\r\n\r\n---\r\n### **Connecting Through a Proxy Server**\r\nAs of GitLab4J-API 4.8.2 support has been added for connecting to the GitLab server using an HTTP proxy server:\r\n```java\r\n// Log in to the GitLab server using a proxy server (with basic auth on proxy)\r\nMap\u003cString, Object\u003e proxyConfig = ProxyClientConfig.createProxyClientConfig(\r\n        \"http://your-proxy-server\", \"proxy-username\", \"proxy-password\");\r\nGitLabApi gitLabApi = new GitLabApi(\"http://your.gitlab.com\", \"YOUR_PERSONAL_ACCESS_TOKEN\", null, proxyConfig);\r\n\r\n// Log in to the GitLab server using a proxy server (no auth on proxy)\r\nMap\u003cString, Object\u003e proxyConfig = ProxyClientConfig.createProxyClientConfig(\"http://your-proxy-server\");\r\nGitLabApi gitLabApi = new GitLabApi(\"http://your.gitlab.com\", \"YOUR_PERSONAL_ACCESS_TOKEN\", null, proxyConfig);\r\n\r\n// Log in to the GitLab server using an NTLM (Windows DC) proxy\r\nMap\u003cString, Object\u003e ntlmProxyConfig = ProxyClientConfig.createNtlmProxyClientConfig(\r\n        \"http://your-proxy-server\", \"windows-username\", \"windows-password\", \"windows-workstation\", \"windows-domain\");\r\nGitLabApi gitLabApi = new GitLabApi(\"http://your.gitlab.com\", \"YOUR_PERSONAL_ACCESS_TOKEN\", null, ntlmProxyConfig);\r\n```\r\nSee the Javadoc on the GitLabApi class for a complete list of methods accepting the proxy configuration (clientConfiguration parameter)\r\n\r\n---\r\n### **GitLab API V3 and V4 Support**\r\nAs of GitLab4J-API 4.2.0 support has been added for GitLab API V4. If your application requires GitLab API V3,\r\nyou can still use GitLab4J-API by creating your GitLabApi instance as follows:\r\n```java\r\n// Create a GitLabApi instance to communicate with your GitLab server using GitLab API V3\r\nGitLabApi gitLabApi = new GitLabApi(ApiVersion.V3, \"http://your.gitlab.server.com\", \"YOUR_PRIVATE_TOKEN\");\r\n```\r\n\r\n**NOTICE**:  \r\nAs of GitLab 11.0 support for the GitLab API v3 has been removed from the GitLab server (see https://about.gitlab.com/2018/06/01/api-v3-removal-impending/). Support for GitLab API v3 will be removed from this library sometime in 2019. If you are utilizing the v3 support, please update your code to use GitLab API v4.\r\n\r\n---\r\n### **Logging of API Requests and Responses**\r\nAs of GitLab4J-API 4.8.39 support has been added to log the requests to and the responses from the\r\nGitLab API.  Enable logging using one of the following methods on the GitLabApi instance:\r\n```java\r\nGitLabApi gitLabApi = new GitLabApi(\"http://your.gitlab.server.com\", \"YOUR_PERSONAL_ACCESS_TOKEN\");\r\n\r\n// Log using the shared logger and default level of FINE\r\ngitLabApi.enableRequestResponseLogging();\r\n\r\n// Log using the shared logger and the INFO level\r\ngitLabApi.enableRequestResponseLogging(java.util.logging.Level.INFO);\r\n\r\n// Log using the specified logger and the INFO level\r\ngitLabApi.enableRequestResponseLogging(yourLoggerInstance, java.util.logging.Level.INFO);\r\n\r\n// Log using the shared logger, at the INFO level, and include up to 1024 bytes of entity logging\r\ngitLabApi.enableRequestResponseLogging(java.util.logging.Level.INFO, 1024);\r\n\r\n// Log using the specified logger, at the INFO level, and up to 1024 bytes of entity logging\r\ngitLabApi.enableRequestResponseLogging(yourLoggerInstance, java.util.logging.Level.INFO, 1024);\r\n```\r\n\r\n---\r\n### **Results Paging**\r\nGitLab4J-API provides an easy to use paging mechanism to page through lists of results from the GitLab API.\r\nHere are a couple of examples on how to use the Pager:\r\n```java\r\n// Get a Pager instance that will page through the projects with 10 projects per page\r\nPager\u003cProject\u003e projectPager = gitLabApi.getProjectApi().getProjects(10);\r\n\r\n// Iterate through the pages and print out the name and description\r\nwhile (projectPager.hasNext()) {\r\n    for (Project project : projectPager.next()) {\r\n        System.out.println(project.getName() + \" -: \" + project.getDescription());\r\n    }\r\n}\r\n```\r\n\r\nAs of GitLab4J-API 4.9.2, you can also fetch all the items as a single list using a Pager instance:\r\n```java\r\n// Get a Pager instance so we can load all the projects into a single list, 10 items at a time:\r\nPager\u003cProject\u003e projectPager = gitlabApi.getProjectsApi().getProjects(10);\r\nList\u003cProject\u003e allProjects = projectPager.all();\r\n```\r\n\r\n---\r\n### **Java 8 Stream Support**\r\nAs of GitLab4J-API 4.9.2, all GitLabJ-API methods that return a List result have a similarlly named method that returns a Java 8 Stream.  The Stream returning methods use the following naming convention:  ```getXxxxxStream()```.\r\n  \r\n\r\n**IMPORTANT**  \r\nThe built-in methods that return a Stream do so using ___eager evaluation___, meaning all items are pre-fetched from the GitLab server and a Stream is returned which will stream those items.  **Eager evaluation does NOT support parallel reading of data from ther server, it does however allow for parallel processing of the Stream post data fetch.**\r\n\r\nTo stream using ___lazy evaluation___, use the GitLab4J-API methods that return a ```Pager``` instance, and then call the ```lazyStream()``` method on the ```Pager``` instance to create a lazy evaluation Stream. The Stream utilizes the ```Pager``` instance to page through the available items. **A lazy Stream does NOT support parallel operations or skipping.** \r\n\r\n\r\n#### **Eager evaluation example usage:**\r\n\r\n```java\r\n// Stream the visible projects printing out the project name.\r\nStream\u003cProject\u003e projectStream = gitlabApi.getProjectApi().getProjectsStream();\r\nprojectStream.map(Project::getName).forEach(name -\u003e System.out.println(name));\r\n\r\n// Operate on the stream in parallel, this example sorts User instances by username\r\n// NOTE: Fetching of the users is not done in parallel,\r\n// only the sorting of the users is a parallel operation.\r\nStream\u003cUser\u003e stream = gitlabApi.getUserApi().getUsersStream();\r\nList\u003cUser\u003e users = stream.parallel().sorted(comparing(User::getUsername)).collect(toList());\r\n```\r\n\r\n#### **Lazy evaluation example usage:**\r\n\r\n```java\r\n// Get a Pager instance to that will be used to lazily stream Project instances.\r\n// In this example, 10 Projects per page will be pre-fetched.\r\nPager\u003cProject\u003e projectPager = gitlabApi.getProjectApi().getProjects(10);\r\n\r\n// Lazily stream the Projects, printing out each project name, limit the output to 5 project names\r\nprojectPager.lazyStream().limit(5).map(Project::getName).forEach(name -\u003e System.out.println(name));\r\n```\r\n\r\n\r\n---\r\n### **Java 8 Optional Support**\r\nGitLab4J-API supports Java 8 Optional\u0026lt;T\u0026gt; for API calls that result in the return of a single item. Here is an example on how to use the Java 8 Optional\u0026lt;T\u0026gt; API calls:\r\n```java\r\nOptional\u003cGroup\u003e optionalGroup =  gitlabApi.getGroupApi().getOptionalGroup(\"my-group-path\");\r\nif (optionalGroup.isPresent())\r\n    return optionalGroup.get();\r\n\r\nreturn gitlabApi.getGroupApi().addGroup(\"my-group-name\", \"my-group-path\");\r\n```\r\n\r\n---\r\n### **Issue Time Estimates**\r\nGitLab issues allow for time tracking. The following time units are currently available:\r\n\r\n* months (mo)\r\n* weeks (w)\r\n* days (d)\r\n* hours (h)\r\n* minutes (m)\r\n\r\nConversion rates are 1mo = 4w, 1w = 5d and 1d = 8h. \r\n\r\n---\r\n## Making API Calls\r\nThe API has been broken up into sub API classes to make it easier to consume and to separate concerns. The GitLab4J sub API classes typically have a one-to-one relationship with the API documentation at [GitLab API](https://docs.gitlab.com/ce/api/). Following is a sample of the GitLab4J sub API class mapping to the GitLab API documentation:\r\n\r\n```org.gitlab4j.api.GroupApi``` -\u003e https://docs.gitlab.com/ce/api/groups.html\u003cbr/\u003e\r\n```org.gitlab4j.api.MergeRequestApi``` -\u003e https://docs.gitlab.com/ce/api/merge_requests.html\u003cbr/\u003e\r\n```org.gitlab4j.api.ProjectApi``` -\u003e https://docs.gitlab.com/ce/api/projects.html\u003cbr/\u003e\r\n```org.gitlab4j.api.UserApi``` -\u003e https://docs.gitlab.com/ce/api/users.html\u003cbr/\u003e\r\n\r\n### **Available Sub APIs**\r\n\r\nThe following is a list of the available sub APIs along with a sample use of each API. See the \u003ca href=\"https://javadoc.io/doc/org.gitlab4j/gitlab4j-api\" target=\"_top\"\u003eJavadocs\u003c/a\u003e for a complete list of available methods for each sub API.\r\n\r\n---\r\n\u0026nbsp;\u0026nbsp;[ApplicationsApi](#applicationsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[ApplicationSettingsApi](#applicationsettingsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[AuditEventApi](#auditeventapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[AwardEmojiApi](#awardemojiapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[BoardsApi](#boardsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[CommitsApi](#commitsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[ContainerRegistryApi](#containerregistryapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[DeployKeysApi](#deploykeysapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[DiscussionsApi](#discussionsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[EnvironmentsApi](#environmentsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[EpicsApi](#epicsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[EventsApi](#eventsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[GroupApi](#groupapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[HealthCheckApi](#healthcheckapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[ImportExportApi](#importexportapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[IssuesApi](#issuesapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[JobApi](#jobapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[LabelsApi](#labelsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[LicenseApi](#licenseapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[LicenseTemplatesApi](#licensetemplatesapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[LabelsApi](#labelsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[MergeRequestApi](#mergerequestapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[MilestonesApi](#milestonesapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[NamespaceApi](#namespaceapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[NotesApi](#notesapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[NotificationSettingsApi](#notificationsettingsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[PackagesApi](#packagesapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[PipelineApi](#pipelineapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[ProjectApi](#projectapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[ProtectedBranchesApi](#protectedbranchesapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[ReleasesApi](#releasesapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[RepositoryApi](#repositoryapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[RepositoryFileApi](#repositoryfileapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[ReourceLabelEventsApi](#resourcelabeleventsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[RunnersApi](#runnersapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[SearchApi](#searchapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[ServicesApi](#servicesapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[SessionApi](#sessionapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[SnippetsApi](#snippetsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[SystemHooksApi](#systemhooksapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[TagsApi](#tagsapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[TodosApi](#todosapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[UserApi](#userapi)\u003cbr/\u003e\r\n\u0026nbsp;\u0026nbsp;[WikisApi](#wikisapi)\r\n\r\n\r\n### Sub API Examples\r\n----------------\r\n#### ApplicationsApi\r\n```java\r\n// Add an OAUTH Application to GitLab\r\nApplicationScope[] scopes = {ApplicationScope.SUDO, ApplicationScope.PROFILE};\r\ngitLabApi.getApplicationsApi().createApplication(\"My OAUTH Application\", \"https//example.com/myapp/callback\", scopes);\r\n```\r\n\r\n#### ApplicationSettingsApi\r\n```java\r\n// Get the current GitLab server application settings\r\nApplicationSettings appSettings = gitLabApi.getApplicationSettingsApi().getAppliationSettings();\r\n```\r\n\r\n#### AuditEventApi\r\n```java\r\n// Get the current GitLab server audit events for entity\r\n// This uses the ISO8601 date utilities the in org.gitlab4j.api.utils.ISO8601 class\r\nDate since = ISO8601.toDate(\"2017-01-01T00:00:00Z\");\r\nDate until = new Date(); // now\r\nList\u003cAuditEvent\u003e auditEvents = gitLabApi.getAuditEventApi().getAuditEvents(since, until, EntityType.USER, 1);\r\n```\r\n\r\n#### AwardEmojiApi\r\n```java\r\n// Get a list of AwardEmoji belonging to the specified issue (group ID = 1, issues IID = 1)\r\nList\u003cAwardEmoji\u003e awardEmojis = gitLabApi.getAwardEmojiApi().getIssuAwardEmojis(1, 1);\r\n```\r\n\r\n#### BoardsApi\r\n```java\r\n// Get a list of the Issue Boards belonging to the specified project\r\nList\u003cBoard\u003e boards = gitLabApi.getBoardsApi().getBoards(projectId);\r\n```\r\n\r\n#### CommitsApi\r\n```java\r\n// Get a list of commits associated with the specified branch that fall within the specified time window\r\n// This uses the ISO8601 date utilities the in org.gitlab4j.api.utils.ISO8601 class\r\nDate since = ISO8601.toDate(\"2017-01-01T00:00:00Z\");\r\nDate until = new Date(); // now\r\nList\u003cCommit\u003e commits = gitLabApi.getCommitsApi().getCommits(1234, \"new-feature\", since, until);\r\n```\r\n\r\n#### ContainerRegistryApi\r\n```java\r\n// Get a list of the registry repositories belonging to the specified project\r\nList\u003cRegistryRepository\u003e registryRepos = gitLabApi.ContainerRegistryApi().getRepositories(projectId);\r\n```\r\n\r\n#### DeployKeysApi\r\n```java\r\n// Get a list of DeployKeys for the authenticated user\r\nList\u003cDeployKey\u003e deployKeys = gitLabApi.getDeployKeysApi().getDeployKeys();\r\n```\r\n\r\n#### DiscussionsApi\r\n```java\r\n// Get a list of Discussions for the specified merge request\r\nList\u003cDiscussion\u003e discussions = gitLabApi.getDiscussionsApi().getMergeRequestDiscussions(projectId, mergeRequestIid);\r\n```\r\n\r\n#### EnvironmentsApi\r\n```java\r\n// Get a list of Environments for the specified project\r\nList\u003cEnvironment\u003e environments = gitLabApi.getEnvironmentsApi().getEnvironments(projectId);\r\n```\r\n\r\n#### EpicsApi\r\n```java\r\n// Get a list epics of the requested group and its subgroups.\r\nList\u003cEpic\u003e epics = gitLabApi.getEpicsApi().getEpics(1);\r\n```\r\n\r\n#### EventsApi\r\n```java\r\n// Get a list of Events for the authenticated user\r\nDate after = new Date(0); // After Epoch\r\nDate before = new Date(); // Before now\r\nList\u003cEvent\u003e events = gitLabApi.getEventsApi().getAuthenticatedUserEvents(null, null, before, after, DESC);\r\n```\r\n\r\n#### GroupApi\r\n```java\r\n// Get a list of groups that you have access to\r\nList\u003cGroup\u003e groups = gitLabApi.getGroupApi().getGroups();\r\n```\r\n\r\n#### HealthCheckApi\r\n```java\r\n// Get the liveness endpoint health check results. Assumes ip_whitelisted per:\r\n// https://docs.gitlab.com/ee/administration/monitoring/ip_whitelist.html\r\nHealthCheckInfo healthCheck = gitLabApi.getHealthCheckApi().getLiveness();\r\n```\r\n\r\n#### ImportExportApi\r\n```java\r\n// Schedule a project export for the specified project ID\r\ngitLabApi.getImportExportApi().scheduleExport(projectId);\r\n\r\n// Get the project export status for the specified project ID\r\nExportStatus exportStatus = gitLabApi.getImportExportApi().getExportStatus(projectId);\r\n```\r\n\r\n#### IssuesApi\r\n```java\r\n// Get a list of issues for the specified project ID\r\nList\u003cIssue\u003e issues = gitLabApi.getIssuesApi().getIssues(1234);\r\n```\r\n\r\n#### JobApi\r\n```java\r\n// Get a list of jobs for the specified project ID\r\nList\u003cJob\u003e jobs = gitLabApi.getJobApi().getJobs(1234);\r\n```\r\n\r\n#### LabelsApi\r\n```java\r\n// Get a list of labels for the specified project ID\r\nList\u003cLabel\u003e labels = gitLabApi.getLabelsApi().getLabels(1234);\r\n```\r\n\r\n#### LicenseApi\r\n```java\r\n// Retrieve information about the current license\r\nLicense license = gitLabApi.getLicenseApi().getLicense();\r\n```\r\n\r\n#### LicenseTemplatesApi\r\n```java\r\n// Get a list of open sourcse license templates\r\nList\u003cLicenseTemplate\u003e licenses = gitLabApi.getLicenseTemplatesApi().getLicenseTemplates();\r\n```\r\n\r\n#### MergeRequestApi\r\n```java\r\n// Get a list of the merge requests for the specified project\r\nList\u003cMergeRequest\u003e mergeRequests = gitLabApi.getMergeRequestApi().getMergeRequests(1234);\r\n```\r\n\r\n#### MilestonesApi\r\n```java\r\n// Get a list of the milestones for the specified project\r\nList\u003cMilestone\u003e milestones = gitLabApi.getMilestonesApi().getMilestones(1234);\r\n```\r\n \r\n#### NamespaceApi\r\n```java\r\n// Get all namespaces that match \"foobar\" in their name or path\r\nList\u003cNamespace\u003e namespaces = gitLabApi.getNamespaceApi().findNamespaces(\"foobar\");\r\n```\r\n\r\n#### NotesApi\r\n```java\r\n// Get a list of the issues's notes for project ID 1234, issue IID 1\r\nList\u003cNote\u003e notes = gitLabApi.getNotesApi().getNotes(1234, 1);\r\n```\r\n\r\n#### NotificationSettingsApi\r\n```java\r\n// Get the current global notification settings\r\nNotificationSettings settings = gitLabApi.getNotificationSettingsApi().getGlobalNotificationSettings();\r\n```\r\n\r\n#### PackagesApi\r\n```java\r\n// Get all packages for the specified project ID\r\nList\u003cPackages\u003e packages = gitLabApi.getPackagesApi().getPackages(1234);\r\n```\r\n\r\n#### PipelineApi\r\n```java\r\n// Get all pipelines for the specified project ID\r\nList\u003cPipeline\u003e pipelines = gitLabApi.getPipelineApi().getPipelines(1234);\r\n```\r\n\r\n#### ProjectApi\r\n```java\r\n// Get a list of accessible projects \r\npublic List\u003cProject\u003e projects = gitLabApi.getProjectApi().getProjects();\r\n```\r\n```java\r\n// Create a new project\r\nProject projectSpec = new Project()\r\n    .withName(\"my-project\")\r\n    .withDescription(\"My project for demonstration.\")\r\n    .withIssuesEnabled(true)\r\n    .withMergeRequestsEnabled(true)\r\n    .withWikiEnabled(true)\r\n    .withSnippetsEnabled(true)\r\n    .withPublic(true);\r\n\r\nProject newProject = gitLabApi.getProjectApi().createProject(projectSpec);\r\n```\r\n\r\n#### ProtectedBranchesApi\r\n```java\r\nList\u003cProtectedBranch\u003e branches = gitLabApi.getProtectedBranchesApi().getProtectedBranches(project.getId());\r\n```\r\n\r\n#### ReleasesApi\r\n```java\r\n// Get a list of releases for the specified project\r\nList\u003cRelease\u003e releases = gitLabApi.getReleasesApi().getReleases(projectId);\r\n```\r\n\r\n#### RepositoryApi\r\n```java\r\n// Get a list of repository branches from a project, sorted by name alphabetically\r\nList\u003cBranch\u003e branches = gitLabApi.getRepositoryApi().getBranches(projectId);\r\n```\r\n```java\r\n// Search repository branches from a project, by name\r\nList\u003cBranch\u003e branches = gitLabApi.getRepositoryApi().getBranches(projectId, searchTerm);\r\n```\r\n\r\n#### RepositoryFileApi\r\n```java\r\n// Get info (name, size, ...) and the content from a file in repository\r\nRepositoryFile file = gitLabApi.getRepositoryFileApi().getFile(\"file-path\", 1234, \"ref\");   \r\n```\r\n\r\n#### ResourceLabelEventsApi\r\n```java\r\n// Get the label events for the specified merge request\r\nList\u003cLabelEvent\u003e labelEvents = gitLabApi.getResourceLabelEventsApi()\r\n        .getMergeRequestLabelEvents(projectId, mergeRequestIid);\r\n```\r\n\r\n#### RunnersApi\r\n```java\r\n// Get All Runners.\r\nList\u003cRunner\u003e runners = gitLabApi.getRunnersApi().getAllRunners();\r\n```\r\n\r\n#### SearchApi\r\n```java\r\n// Do a global search for Projects\r\nList\u003cProject\u003e projects = gitLabApi.getSearchApi().globalSearch(SearchScope.PROJECTS, \"text-to-search-for\");\r\n```\r\n\r\n#### ServicesApi\r\n```java\r\n// Activate/Update the Slack Notifications service\r\nSlackService slackService =  new SlackService()\r\n        .withMergeRequestsEvents(true)\r\n        .withWebhook(\"https://hooks.slack.com/services/ABCDEFGHI/KJLMNOPQR/wetrewq7897HKLH8998wfjjj\")\r\n        .withUsername(\"GitLab4J\");\r\ngitLabApi.getServicesApi().updateSlackService(\"project-path\", slackService);\r\n```\r\n\r\n#### SessionApi\r\n```java\r\n// Log in to the GitLab server and get the session info\r\ngitLabApi.getSessionApi().login(\"your-username\", \"your-email\", \"your-password\");\r\n```\r\n\r\n#### SnippetsApi\r\n```java\r\n// Get a list of the authenticated user's snippets\r\nList\u003cSnippet\u003e snippets = gitLabApi.getSnippetsApi().getSnippets();\r\n```\r\n\r\n#### SystemHooksApi\r\n```java\r\n// Get a list of installed system hooks\r\nList\u003cSystemHook\u003e hooks = gitLabApi.getSystemHooksApi().getSystemHooks();\r\n```\r\n\r\n#### TagsApi\r\n```java\r\n// Get a list of tags for the specified project ID\r\nList\u003cTag\u003e tags = gitLabApi.getTagsApi().getTags(projectId);\r\n```\r\n\r\n#### TodosApi\r\n```java\r\n// Get a list of all pending todos for the current user\r\nList\u003cTodo\u003e todos = gitLabApi.getTodosApi().gePendingTodos();\r\n```\r\n\r\n#### UserApi\r\n```java\r\n// Get the User info for user_id 1\r\nUser user = gitLabApi.getUserApi().getUser(1);\r\n\r\n// Create a new user with no password who will recieve a reset password email\r\nUser userConfig = new User()\r\n    .withEmail(\"jdoe@example.com\")\r\n    .withName(\"Jane Doe\")\r\n    .withUsername(\"jdoe\");\r\nString password = null;\r\nboolean sendResetPasswordEmail = true;\r\ngitLabApi.getUserApi().createUser(userConfig, password, sendResetPasswordEmail);\r\n```\r\n\r\n#### WikisApi\r\n```java\r\n// Get a list of pages in project wiki\r\nList\u003cWikiPage\u003e wikiPages = gitLabApi.getWikisApi().getPages();\r\n```\r\n","funding_links":[],"categories":["Java"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitlab4j%2Fgitlab4j-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitlab4j%2Fgitlab4j-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitlab4j%2Fgitlab4j-api/lists"}