Hi Toine,
I’ve updated my script with variables for username, password and power station. This is the only difference between my working script and the one above. Could you give this a try:
#!/bin/bash
USERNAME="me@mail.com"
PASSWORD=“MYPASSWORD”
POWERSTATION=“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”RESULT=$(curl https://www.semsportal.com/api/v2/Common/CrossLogin --silent --header “Content-Type: application/json” --header “Connect: keep-alive” --header “User-Agent: PVMaster/2.1.0 (iPhone; iOS 13.0; Scale/2.00)” --header “Accept-Language: en;q=1” --header “Token: {"version":"v2.1.0","client":"ios","language":"en"}” --data-binary “{"account":"$USERNAME","pwd":"$PASSWORD"}”)
HEADER=$(echo “$RESULT”|jq “.data”|tr ‘\n’ ’ ')
RETURN=$(curl https://www.semsportal.com/api/v2/PowerStation/GetMonitorDetailByPowerstationId --silent --header “Content-Type: application/json” --header “Accept: /” --header “User-Agent: PVMaster/2.1.0 (iPhone; iOS 13.0; Scale/2.00)” --header “Accept-Language: DE;q=1” --header 'Token: '“$HEADER” --data-binary “{"powerStationId":"$POWERSTATION"}”)
echo “$RETURN” | jq “.data”
I’ve also added my shell-script as a file. You need to rename it of course to semsapi.sh and make it executable.
semsapi.txt (950 Bytes)
Hope this helps.
RogerG