SmartGridready / SGrJava

SmartGridready communication handler in Java
0 stars 0 forks source link

Add support for string value mappings on REST-API datapoints. #65

Closed ergo-furrer closed 3 months ago

mkrebs81 commented 3 months ago

PoC implementation in Branch https://github.com/SmartGridready/SGrJava/tree/rest-api-post-formdata

ergo-furrer commented 3 months ago

Thanks for the Info, I will have a look.

mkrebs81 commented 3 months ago

I just have tested my implementation with the Shelly Gen1 local API. I can set a relay to true/false using GET requests.

so far that seems to work.

the POST requests using form data do not work correctly yet, I will conduct more testing today.

mkrebs81 commented 3 months ago

I was able to fix the POST request content type handling in my latest commit.

I will now look into the "URIBuilder". that looks promising regarding query and form parameters.

mkrebs81 commented 3 months ago

I have created a PoC implementation in https://github.com/SmartGridready/SGrJava/tree/rest-api-query-params

It uses my suggested specification changes in https://github.com/SmartGridready/SGrSpecifications/tree/rest-query-params and should solve URL encoding, query and form parameters at once.

@ergo-furrer @ArndGerns do you like this approach?

ergo-furrer commented 3 months ago

Hi Matthias, I think it's the right approach to define a query and form parameters as a key-value list in the XML-Schema.

I had a brief look at SGrJava.ApacheRestServiceClient. I think the method getFormParameters() and its dependents are obsolete now and we can remove it.

mkrebs81 commented 3 months ago

Thanks for the feedback. I will add a commit that removes the old behaviour.