Woche der Wärmepumpe

Während der Woche der Wärmepumpe haben Sie bundesweit die Möglichkeit, die innovative Wärmepumpentechnologie näher kennenzulernen. Mit über 50 Informationsveranstaltungen beteiligt sich Viessmann Climate Solutions an der Aktionswoche und lädt Sie herzlich ein – vor Ort oder online – dabei zu sein.

Mehr erfahren →
Woche der Wärmepumpe
abbrechen
Suchergebnisse werden angezeigt für 
Anzeigen  nur  | Stattdessen suchen nach 
Meintest du: 
Beantwortet! Gehe zur Lösung.

HowTo send a command via the API ? Or what is the correct syntax?

I'm trying to send a command via the API, for example I want to activate the feature "oneTimeCharge".

I tried to send such POST request:

 

https://api.viessmann-platform.io/iot/v1/equipment/installations/My-Installation_ID/gateways/My-Gate... 

 

Sending the above with a valid  Bearer Token does return:

 

{
    "viErrorId": "req-06063841ce214195b3fa08643a51cd60",
    "statusCode": 422,
    "errorType": "VALIDATION_ERROR",
    "message": "VALIDATION_ERROR",
    "validationErrors": [
        {
            "path": [
                "commandBody"
            ],
            "type": "any.invalid",
            "message": "invalid value, most likely wrong format"
        }
    ],
    "extendedPayload": {
        "commandBody": "EMPTY_MODEL"
    }
}
 
or with the header Content-Type="application/x-www-form-urlencoded"
{
    "viErrorId": "req-25befbaad52e473c921fe9a0e8439be7",
    "statusCode": 500,
    "errorType": "INTERNAL_ERROR",
    "message": "Internal server error"
}
 

 

Where is my mistake?

2 AKZEPTIERTE LÖSUNGEN

Akzeptierte Lösungen

You need to send a json request payload with every command. This is also true for commands with "empty" parameters, so you need to send just an empty json object. Also, make sure to have the correct request payload mime type, i.e. the "Content-Type" header has to be "application/json". Postman sets this header automatically for you if you enter a request payload and select "raw" and "json" from the two dropdown boxes like shown in the attached screenshot:

 

 

Lösung in ursprünglichem Beitrag anzeigen

viessmann_command.PNG

The problem was solved by @phildaub23 while the Developer part of the forum was created!

 

I used a.) a wrong URL (https://api.viessmann-platform.io...instead of https://api.viessmann.com..

 and b.) missed the empty body ("{}") part.

In JavaScript that looks like.

 

headers["Authorization"] = "Bearer "+ token;
var url ="https://api.viessmann.com/iot/v1/equipment/installations/"+ installationID +"/gateways/" +gatewaySerial + "/devices/0/features/heating.dhw.oneTimeCharge/commands/activate";
//logger.info("url: {}", url);
var returnvalue = HTTP.sendHttpPostRequest(url,"application/json", "{}",headers,2*1000);

 

 

Lösung in ursprünglichem Beitrag anzeigen

4 ANTWORTEN 4

Did you use POST and "Content-Type: application/json"? In this case params  is "{}" of course.

 

 

Thanks for the answer.

I did use POST and tried it also with the header Content-Type application/json. 

So far I did not put in any PARAMS for the POST request, using just the url as posted above.

The result is always as the above posted (first) error message.

I'm using POSTMAN  to test-send such messages.

You need to send a json request payload with every command. This is also true for commands with "empty" parameters, so you need to send just an empty json object. Also, make sure to have the correct request payload mime type, i.e. the "Content-Type" header has to be "application/json". Postman sets this header automatically for you if you enter a request payload and select "raw" and "json" from the two dropdown boxes like shown in the attached screenshot:

 

 

viessmann_command.PNG

The problem was solved by @phildaub23 while the Developer part of the forum was created!

 

I used a.) a wrong URL (https://api.viessmann-platform.io...instead of https://api.viessmann.com..

 and b.) missed the empty body ("{}") part.

In JavaScript that looks like.

 

headers["Authorization"] = "Bearer "+ token;
var url ="https://api.viessmann.com/iot/v1/equipment/installations/"+ installationID +"/gateways/" +gatewaySerial + "/devices/0/features/heating.dhw.oneTimeCharge/commands/activate";
//logger.info("url: {}", url);
var returnvalue = HTTP.sendHttpPostRequest(url,"application/json", "{}",headers,2*1000);

 

 

Top-Lösungsautoren