Login success but failed (401) when call permission group API

Dear Team,

This is metabase log, I logged into Metabase successfully (200 code for /api/session) but failed with 401 code when call permission group API in my Java API. With postman, everything is ok.
GET /api/permissions/group/2502
Headers:
Content-Type: application/json
Cookie: metabase.SESSION=dd3fc7eb-83f3-4a08-a8bb-4addcd982371

Much appreciate if you having some comments on this situation.

Thanks,
Toan Do

Hi @dvtoan
The best way to learn the API, is to just use Metabase while having your browser developer Network-tab open and looking at the request, and what data is being send/received.
That endpoint requires admin/manager level permissions.

Hi @flamber ,

I tried with both postman and browser, it's ok.
Yes, I configured an Admin user to call that API.

Do you see any other possible case that causing the failure 401?

Thanks,
Toan Do

@dvtoan If "it's ok" means it is working, then I don't understand your question.
Use your browser, open Network-tab and copy as cURL. Then compare that to what you're doing in Postman. The Metabase frontend is only using the API to do things.
Look in the logs for more details, perhaps the group ID doesn't exist - Admin > Troubleshooting > Logs.

@flamber : I mean when I call that API with postman and browser is everything is working fine with same response:

{
    "id": 2502,
    "name": "user_group_1",
    "members": []
}

But when calling that API from my java application which deployed on 3 different server, then one of them got 401 failure although logged in success with /api/session.

Also, I went to Admin > Troubleshooting > Logs to check the log, then still having 401 failure for that API.

@dvtoan I can 100% guarantee you that you'll be getting exactly the same response from the same server using the same API request.
If you are having problems with one of your servers, then something on that server is different.

Thanks @flamber , let me check further.