On Thu, 7 Mar 2019 at 11:33, Chesnay Schepler <ches...@apache.org> wrote:
> I've heard of cases where client libraries are automatically changing > the HTTP method when provided with a body. > Hmmm thanks for that... I'll dig into it > > To figure out what exactly is received by Flink, enable TRACE logging, > try again and look for logging messages from > "org.apache.flink.runtime.rest.handler.router.RouterHandler" > > On 07.03.2019 11:25, Stephen Connolly wrote: > > In the documentation for the /jars/:jarid/plan endpoint > > > https://ci.apache.org/projects/flink/flink-docs-stable/monitoring/rest_api.html#jars-jarid-plan > > > > It says: > > > > > Program arguments can be passed both via the JSON request > > (recommended) or query parameters. > > > > Has anyone got sample code that sends the JSON request? > > > > I have got the end-point working with query parameters, but I need to > > support more than 2083 GET URL length limit. > > > > When I have my code like this: > > > > UriTemplate template = UriTemplate.fromTemplate(apiUrl) > > .literal("/v1/jars") > > .path("jarId") > > .literal("/plan") > > .query("entryClass", "programArg*", "parallelism") > > .build() > > .set("jarId", jarId); > > if (requestBody.getEntryClass() != null) { > > // TODO find a way to have this as entry-class even if the > > spec says no > > template.set("entryClass", requestBody.getEntryClass()); > > } > > if (!requestBody.getProgramArgs().isEmpty()) { > > template.set("programArg", > > requestBody.getProgramArgs().toArray(new String[0])); > > } > > if (requestBody.getParallelism() > 0) { > > template.set("parallelism", requestBody.getParallelism()); > > } > > return get( > > template, > > null, > > null, > > JsonNode.class, > > MEDIA_TYPE_JSON > > ); > > > > Then I get the plan returned. > > > > When I change to this > > > > UriTemplate template = UriTemplate.fromTemplate(apiUrl) > > .literal("/v1/jars") > > .path("jarId") > > .literal("/plan") > > .build() > > .set("jarId", jarId); > > return get( > > template, > > requestBody, > > MEDIA_TYPE_JSON, > > JsonNode.class, > > MEDIA_TYPE_JSON > > ); > > > > I get a 404. > > > > Basically, adding the request body makes the URL go 404... For fun I > > tried having both query parameters and request body and that gets a > > 404 also. > > > > So does anyone have a working example using the JSON request body (and > > let's not get started on how a request body is a really bad idea for > > GET requests) > > >