You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current Readme lacks the information how to dynamic input URL Template variables provided by the thing description. I needed to reverse engineer the code to find out that the TDHTTPReqeust has additional params for that.
Here an example how i implemented the degregister Roboter part in my code using this params successfully:
privatebooleanderegisterOperator(ThingDescriptiontd, StringrobotUri, Stringtoken) {
try {
// Find the "removeOperator" action in the Thing DescriptionOptional<ActionAffordance> deregisterAction = td.getActionByName("removeOperator");
if (deregisterAction.isPresent()) {
Optional<Form> deregisterForm = deregisterAction.get().getFirstFormForOperationType(TD.invokeAction);
if (deregisterForm.isPresent()) {
// Retrieve the required input schema and prepare the payloadMap<String, Object> deregisterPayload = newHashMap<>();
deregisterPayload.put("token", token); // Replace with the actual token used during registrationTDHttpRequestrequest = newTDHttpRequest(deregisterForm.get(), TD.invokeAction, deregisterAction.get().getUriVariables().get(), deregisterPayload);
TDHttpResponseresponse = request.execute();
if (response.getStatusCode() == 200 || response.getStatusCode() == 204) {
System.out.println("Operator deregistred successfully with token: " + token);
returntrue;
} else {
System.out.println("Failed to deregister operator. HTTP status: " + response.getStatusCode());
returnfalse;
}
}
}
} catch (Exceptione) {
System.out.println("Error while deregistering operator from robot " + robotUri + ": " + e.getMessage());
}
returnfalse;
}
The text was updated successfully, but these errors were encountered:
The current Readme lacks the information how to dynamic input URL Template variables provided by the thing description. I needed to reverse engineer the code to find out that the
TDHTTPReqeust
has additional params for that.Here an example how i implemented the degregister Roboter part in my code using this params successfully:
The text was updated successfully, but these errors were encountered: