gitlab4j-api icon indicating copy to clipboard operation
gitlab4j-api copied to clipboard

projectFilter.withIdAfter not work

Open echolius opened this issue 1 year ago • 5 comments
trafficstars

ProjectFilter projectFilter = new ProjectFilter(); projectFilter.withIdAfter(allProjects.stream().mapToInt(Project::getId).max().orElse(0)); List<Project> projects = gitLabApi().getProjectApi().getProjects(projectFilter);

withIdAfter search is not work , projects return all .

echolius avatar Feb 28 '24 06:02 echolius

gitlab4j-api-4.18.0.jar

echolius avatar Feb 28 '24 06:02 echolius

4.18.0 seems really old. Can you check with a newer version?

To debug this, you should display the HTTP request sent by the client. You can use:

GitLabApi(..., ....)
            .withRequestResponseLogging(Level.INFO);

Then try to understand if the request is wrong (and what should be changed). It could be that GitLab itself has an issue.

jmini avatar Feb 28 '24 09:02 jmini

4.18.0 seems really old. Can you check with a newer version?

To debug this, you should display the HTTP request sent by the client. You can use:

GitLabApi(..., ....)
            .withRequestResponseLogging(Level.INFO);

Then try to understand if the request is wrong (and what should be changed). It could be that GitLab itself has an issue.

image

parameter is in, but return all . Actually is empty result.

echolius avatar Feb 28 '24 09:02 echolius

Are you sure everything is OK with your authentication?

The docs says:

Get a list of all visible projects across GitLab for the authenticated user. When accessed without authentication, only public projects with simple fields are returned.

source: https://docs.gitlab.com/ee/api/projects.html


For me the id_after works as expected:

curl --location 'https://<server>/api/v4/projects?id_after=2210' \
--header 'PRIVATE-TOKEN: *******'

Without the parameter I see more projects, when I use id_after the projects are filtered.


The only case where I got an empty result array is when my page parameter is too high:

curl --location 'https://<server>/api/v4/projects?id_after=2210&per_page=50&page=39' \
--header 'PRIVATE-TOKEN: *******'

jmini avatar Feb 28 '24 10:02 jmini

Without the parameter I see more projects, when I use id_after the projects are filtered.

You can give max id try and page=1 . is expect an empty result?

echolius avatar Mar 01 '24 03:03 echolius