SmartGridready / SGrJava

SmartGridready communication handler in Java
Other
0 stars 0 forks source link

Rest API query and form parameters #70

Closed mkrebs81 closed 5 months ago

mkrebs81 commented 5 months ago

Support for HTTP POST requests with form data (content type = application/x-www-form-urlencoded).

Separates request query and form parameters from request path or body (with EID specification changes).

This should also solve potential URL encoding problems.

ergo-furrer commented 5 months ago

@mkrebs81: I will have a look at theRestApiDeviceTest and try to fix it.

ergo-furrer commented 5 months ago

@mkrebs81 Ifixed the unit-test. Shall I push here? -> Arnd can approve...

mkrebs81 commented 5 months ago

@ergo-furrer thank you; yes please push into this branch so Arnd can approve.

ergo-furrer commented 5 months ago

@mkrebs81: My test with the real Clemap device does not work anymore. I will have a look at it.

mkrebs81 commented 5 months ago

@ergo-furrer hmm, maybe I unintentionally changed the path from /digitaltwins/ to /digitaltwins. Can you check if the missing ending slash in the path is the problem?

ergo-furrer commented 5 months ago

@ergo-furrer hmm, maybe I unintentionally changed the path from /digitaltwins/ to /digitaltwins. Can you check if the missing ending slash in the path is the problem?

Thanks for the suggestion. The authentication fails. It seems to be an issue with the content-type. I will come back if I got it solved...

ergo-furrer commented 5 months ago

@ergo-furrer hmm, maybe I unintentionally changed the path from /digitaltwins/ to /digitaltwins. Can you check if the missing ending slash in the path is the problem?

Thanks for the suggestion. The authentication fails. It seems to be an issue with the content-type. I will come back if I got it solved...

I fixed the SGr_02_0018_CLEMAP_EIcloudEnergyMonitor_V1.0.0.xml EI-XML within SGrSpecificaitons.

Will do a PR on SGrSpecifications

mkrebs81 commented 5 months ago

@ergo-furrer you can commit to my PR which I created today

ergo-furrer commented 5 months ago

@ergo-furrer you can commit to my PR which I created today

Arnd asked me to check whether there is a way to stay backwards compatible with EI-XML so that we still can both /digitaltwins/?sensor_id={{sensor_id}} and

  <requestPath>/digitaltwins</requestPath>
  <requestQuery>
                  <parameter>
                    <name>sensor_id</name>
                    <value>{{sensor_id}}</value>
                  </parameter>
  </requestQuery>
ergo-furrer commented 5 months ago

@mkrebs81 Regading backwards compatibility: The only solution I can think of, is to check if there is a <requestQuery> there. If there it is not, then we do not apply URL-encoding. What do you think?

mkrebs81 commented 5 months ago

@ergo-furrer I committed an update which should allow backwards compatibility.

ergo-furrer commented 5 months ago

@ergo-furrer I committed an update which should allow backwards compatibility.

Thanks, this works fine!

ergo-furrer commented 5 months ago

I added a unit-test that tests the REST-API with form-data with my most recent commit.