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

How can I get the real account information of the committer from the '/projects/:id/repository/commits' API?

Open YongMingMao opened this issue 1 year ago • 4 comments
trafficstars

POM:

 <dependency>
            <groupId>org.gitlab4j</groupId>
            <artifactId>gitlab4j-api</artifactId>
            <version>5.5.0</version>
</dependency>

API: GET /projects/:id/repository/commits my Code :

 List<Commit> commits = gitLabApi.getCommitsApi().getCommits(p.getId(), b.getName(),BEGIN_DATE,END_DATE);

as you can see from the screenshot: image

the field 'author' is null ,and the values of the authorEmail and authorName come from the user's local settings, rather than the actual user email and username on GitLab image

thanks ~

YongMingMao avatar Mar 25 '24 10:03 YongMingMao

can I get uid from this API?

YongMingMao avatar Mar 26 '24 01:03 YongMingMao

It seems that there is something wrong.

Can you enable logging of HTTP request/response to understand what is going on?

Here is how:

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

Thank you in advance

jmini avatar Mar 26 '24 09:03 jmini

the actual user email and username on GitLab

Thanks for your reply! Here is more information: After adding

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

the log is(Sensitive information has been blocked):

581 - Received server response on thread main
581 < 200
581 < Cache-Control: max-age=0, private, must-revalidate
581 < Connection: keep-alive
581 < Content-Length: 2206
581 < Content-Type: application/json
581 < Date: Tue, 26 Mar 2024 10:28:58 GMT
581 < Etag: W/"03abf0f7c35788df23024f95386fe820"
581 < Link: <http://gitlab.####.local/api/v4/projects/14516/repository/commits?id=14516&page=1&per_page=96&ref_name=master&since=2024-03-21T16%3A00%3A00%2B00%3A00&until=2024-03-22T15%3A59%3A59%2B00%3A00>; rel="first", <http://gitlab.######.local/api/v4/projects/14516/repository/commits?id=14516&page=1&per_page=96&ref_name=master&since=2024-03-21T16%3A00%3A00%2B00%3A00&until=2024-03-22T15%3A59%3A59%2B00%3A00>; rel="last"
581 < Referrer-Policy: strict-origin-when-cross-origin
581 < Server: nginx
581 < Strict-Transport-Security: max-age=31536000
581 < Vary: Origin
581 < X-Content-Type-Options: nosniff
581 < X-Frame-Options: SAMEORIGIN
581 < X-Next-Page: 
581 < X-Page: 1
581 < X-Per-Page: 96
581 < X-Prev-Page: 
581 < X-Request-Id: jKNU3gN9mS7
581 < X-Runtime: 0.040357
581 < X-Total: 5
581 < X-Total-Pages: 1

image if you need more information ,let me know. Thanks for your help

YongMingMao avatar Mar 26 '24 10:03 YongMingMao