Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
YongMingMao opened this issue Mar 25, 2024 · 3 comments

Comments

@YongMingMao
Copy link

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
Copy link
Author

can I get uid from this API?

@jmini
Copy link
Collaborator

jmini commented Mar 26, 2024

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

@YongMingMao
Copy link
Author

YongMingMao commented Mar 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants