MediaWiki API authentication when sending requests

Hi,

i was wondering if anyone has any experience with the mediawiki api?

i’m having trouble sending requests when not in the browser.
The browser is automatically authenticated when i’m logging in, but i cannot seem to get
authentication working in my program (java).

i know there is a mediawiki api documention, but it does not help me. and i’ve been googling for the past hours.

Does anyone have an example code or a simple api-call-string for me where i can see how to provide the login-data/token when actually trying to get information out of the wiki.

For example a call in the browser like this works:
http://mediawiki.domain/api.php?action=parse&prop=sections&page=Benutzer:MyUsername&section=2&prop=wikitext