I am trying to connect with the AISWEI Solar API. I was sent a API user manual and a Token by email. When i log into my account online I also see an APP Key which consists of a 9 digit number and a alphanumeric string after that. My issue is that i have tried various HTTP request from python and ARC clients. I still seem to get no response back from their servers. I am trying to use the getPlantList conmmand.

Going by the API document, i first thought the request URL was a typo but if I type is as is, I get a 400 - bad request instead of a 404 - not found. So I assume the URL is correct.
Has anyone used this API or can assist me in fixing my code?
Below is my python code:
import requests
def get_plant_list(token, page=1, size=20):
url = 'https://api.general.aisweicloud.com/planlist'
params = {
'token': token,
'page': str(page),
'size': str(size)
}
try:
response = requests.get(url, params=params, verify=False)
if response.status_code == 200:
return response.json()
else:
print(f"Request failed with status code: {response.status_code}")
return None
except requests.exceptions.RequestException as e:
print("An error occurred while making the request:", e)
return None
token = 'XXXXXXXXXXXXX'
plant_list = get_plant_list(token)
if plant_list:
print(plant_list)
Also I have share the API Manual here:
Sorry I don't know how to upload PDFs here.
Ok, getting data from the AISWEI Solar API...
There is a Pro (Business) version and a Consumer version of the API. The Consumer version only had an interval of 20 minutes (while the site at solplanet.net did have 10 minutes interval. You can upgrade to the Pro version via the App. The API's differ slightly.
Below is code for both Pro and Consumer versions of the API (done via the $pro variable). The getfromapi function will show that you need to sign your calls to the API. This is done by taking the header + url values and sign the value with the AppSecret. It's very important that the parameters in the url are in alphabetical order. Note: If something goes wrong, the API will throw back an error in the header X-Ca-Error-Message. So make sure to check the headers if it doesn't work.
First you need to get the ApiKey for your inverter. This should be under
detailsat the site (different login-page for Consumer and Business). You can also find the AppKey and AppSecret there under your account (Account > Safety settings > API authorization codefor Business andAccount > Account and security > Safety settingsfor Consumer). If it's not there you can contact solplanet.net to activate it. For the Pro API you also need a token which you also can get via e-mail to solplanet.net (which have excellent service).Following code is for PHP (python3 is below that). I run it via a cron-job every 5 minutes to retrieve data and push it to a mysql database for a local dashboard. Everything runs on a Raspberry Pi 3 B. It first retrieves the status of the inverter (last updated and status). The it retrieves the production values of today (or given date). Consumer at 20 minutes interval and Business at 10 minutes interval. And lastly it retrieves the month production (all days of a month) for the daily-table.
I hope you have some use for the code and can implement it in your own program. If you have any question, let me now.
Extra note: The time and ludt (last update time) is always in timezone for China for me with no timezone information (maybe because this was a zeversolar inverter). So I convert it here to my own timezone (with timezone information). Check for yourself if the time/ludt is returned correctly.
Edit: Ok, it's been a while since I programmed in python so I called on the help of my friend chatGPT :D The following is (after some adjustments) working correctly for me (besides the database stuff but that falls outside of this question).
Results for me in: