MickMake / GoSungrow

GoLang implementation to access the iSolarCloud API updated by SunGrow inverters.
https://mickmake.com/
GNU General Public License v2.0
149 stars 43 forks source link

Method Not Allowed #9

Open LordMax2 opened 1 year ago

LordMax2 commented 1 year ago

Hi!

I am trying to use postman to make an interface, but I get this response:

{
    "error": "Method Not Allowed",
    "message": "Request method 'GET' not supported",
    "path": "/getCloudList",
    "req_serial_num": "2022091605354858891fde42b2eb84cb",
    "status": 405,
    "timestamp": "2022-09-16 00:46:10"
}

The route I am trying to get a response from is: https://gateway.isolarcloud.eu/v1/commonService/getCloudList

I have ofc the ps_id, appkey = 93D72E60331ABDCDC7B39ADC2D1F32B3, sys_code = 900, and a token

Thanks in advance! Best regards Max

LordMax2 commented 1 year ago

I am trying to make a widget on my own home assistant looking like your HA plugin and the iSolarCloud app, do you know which API calls I need to do and which values I need to make it similar?

LordMax2 commented 1 year ago

I have done some more error checking and my conclusion is that my POST requests gets this error:

{
    "result_code": "000",
    "result_data": null,
    "result_msg": "er_unknown_exception"
}

Any idea?

MickMake commented 1 year ago

It's a pretty simple thing. The process is:

  1. Obtain a token from /v1/userService/login - have a look at iSolarCloud/AppService/login/data.go
  2. Use that token in all subsequent calls.

It is possible to refresh the token, but it seems to last from a couple of days to a month.

LordMax2 commented 1 year ago

Thanks for the response!

I still cannot get it to work properly, I get the same error, my postman looks like this:

image

Does the parameters need to be in a certain order? Or am I missing something, the token I am using is the one from the login response under: response > result_data > privliges > token

I have also tried to make the request look like this:

image

With both GET and POST but I dont get a proper response.. If I GET this last screenshot I get "Internal server error" (with my user_id and ps_id ofc). And POST is the same as the first image..

geoffishere commented 1 year ago

It should look like this

image

LordMax2 commented 1 year ago

Worked perfecly!

I have another question :D, which requests do you do to get this data image

I think it looks amazing and Id love to build it into my home controlelr :D