Step 1: Sign in. You will get a TOEKN in response if email and password are correct.
requests.post(
"http://{}/api/auth/signin".format(SERVER_URL),
json={
"email": USERNAME,
"password": PASSWORD,
}
)
Step 2: Put the TOKEN in the API request headers.
requests.post(
"{}/api/user/code".format(SERVER_URL),
headers = {
"X-Token": TOKEN,
"X-Username": TOKEN,
},
json={
"modules": CODE_TEXT,
"branch": BRANCH_NAME,
},
)
Here is a list about all API I could found (written in Python). Most of them are tested. https://github.com/Qionglu735/screeps_tool/blob/master/screeps_api.py#L185