m3dev / octoparts

Octoparts, the backend services aggregator
https://m3dev.github.io/octoparts/
Other
152 stars 18 forks source link

Support easy way building body parameter in API client and Admin console #100

Open gakuzzzz opened 9 years ago

gakuzzzz commented 9 years ago

It seems that ParamType.Body parameters's outputName is not used.

https://github.com/m3dev/octoparts/blob/1a12031bea4b7e5b25814a225094cd61f175998f/app/com/m3/octoparts/aggregator/handler/HttpPartRequestHandler.scala#L80-L82

HTTP POST parameters require key1=value1&key2=value2 format. However HttpPartRequestHandler#createBlockingHttpRetrieve use one first parameter and only value.

We can not call HTTP Post API.

lloydmeta commented 9 years ago

If I remember correctly, for body param types, we expect you to just send one + we don't it validate it. I don't think this was made clear in the documentation though.

The reasoning was:

I'm not sure if we have re-thought the above, but I would suggest the following course of action:

  1. At least for now, update docs to make it clear we don't handle more than 1 body parameter
  2. Think about whether or not we want to support validating body parameters
    • If so in what (limited) way ? How do we choose ?
    • Implement the feature
    • Update the docs again.

We can not call HTTP Post API.

If you can not call the HTTP Post API, that is a different problem; it should still work. Maybe more details are needed.

gakuzzzz commented 9 years ago

Ok, I see. ParamType.Body is used any format as XML, JSON and so on.

I can not find the way how to setting HTTP Post API parameters. Other ParamType s (Query, Path, Header, Cookie) do not seem usable to POST body. How I do configure?

mauhiz commented 9 years ago

Right, it looks like currently your best shot is to prepare a post body client side and send it as a body parameter. This prevents you from validating parameters in Octoparts which is a bit of a waste ... I think this design miss was because we focused on REST.

gakuzzzz commented 9 years ago

I see. I understood that Octoparts behave as proxy so it bit difficult to parse and validate body.

I think, It is enough that Octoparts client and Admin console is possible to build body from some parameters. Octoparts server still does not parse and validate body. And these parameters can not be used at cache control key.

What do you think?

lloydmeta commented 9 years ago

I think that seems reasonable.

That said, to make this useful, we should make sure that the feature works across common body types; unless if there's a more scientific way, we should probably make sure the ones that Play supports can be built.

Namely:

gakuzzzz commented 9 years ago

I agree that the feature works across common body types.