Forum eedomus http://forum.eedomus.fr/ |
|
Données photovoltaique APSYSTEM OpenAPI http://forum.eedomus.fr/viewtopic.php?f=15&t=12565 |
Page 1 sur 1 |
Auteur: | Tymmoty67 [ 20 Mars 2025 16:26 ] |
Sujet du message: | Données photovoltaique APSYSTEM OpenAPI |
Bonjour à tous, Je dispose d'une instalation photovoltaique avec une paserelle APSystem, qui propose un de récupérer les valeurs de production via une open API. cependant, je n'ai jamais rélisé de requette HTTP, et meme avec la documentation de APSystem je n'arrive pas à créer mon Header et à calculer la signature et encore moins renseigner le tout dans eedomus. Est-ce que quelqu'un pourrais m'aider ?, ci-dessous le bout de notice imcompréhensible pour moi : 2[b].2.1 Headers: Fixed request header information[/b] You need to put the common parameters into the headers of each API request. Parameter Required Type Description X-CA-AppId Y string The identity id of the OpenAPI account (AppId). X-CA-Timestamp Y string The timestamp you request the API. X-CA-Nonce Y string Uuid, a 32-bit string, such as: “5e36eab8295911ee90751eff13c2920b” X-CA-Signature-Method Y string Algorithm “HmacSHA256” or “HmacSHA1” X-CA-Signature Y string The signature to verify your request. 2.2.2 Calculate the signature Step 1: Get the parameters from the API request Get the parameters below: HTTPMethod (GET, POST, DELETE) Headers (X-CA-AppId, X-CA-Timestamp, X-CA-Nonce, X-CA-Signature-Method) RequestPath (The last name of the path) Step 2: Combine the parameters into one String Combine the parameters with the orders below: stringToSign = X-CA-Timestamp + “/” + X-CA-Nonce + “/” + X-CA-AppId + “/” + RequestPath + “/” + HTTPMethod + “/” + X-CA-Signature-Method Step 3: Calculate the signature with the algorithm Currently, we have support two algorithms to sign the parameters. You can choose one of them to calculate the signature. - HmacSHA256 APsystems OpenAPI User Manual 6 - HmacSHA1 Sign the stringToSign with the APP Secret: HmacSHA256 Mac hmacSha256 = Mac.getInstance("HmacSHA256"); byte[] appSecretBytes = appSecret.getBytes(Charset.forName("UTF-8")); hmacSha256.init(new SecretKeySpec(appSecretBytes, 0, appSecretBytes.length, "HmacSHA256")); byte[] md5Result = hmacSha256.doFinal(stringToSign.getBytes(Charset.forName("UTF-8"))); String signature = Base64.getEncoder().encodeToString(md5Result) Merci beaucoup pour votre aide. Tymmoty67 |
Page 1 sur 1 | Le fuseau horaire est UTC+1 heure |
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/ |