Hello, I am trying to make a request to trigger reflection refreshes for a dataset with:
String url = "https://dremio-ee.k8s.<env>.<org>.net/api/v3/dataset/<id>/reflection";
String AUTHORIZATION = "Authorization";
String BEARER_S = "Bearer %s";
SimpleJsonHttpRequest request = new SimpleJsonHttpRequest.Builder(
SimpleJsonHttpRequest.Method.POST,
url)
.addHeader(AUTHORIZATION, String.format(BEARER_S, token.getToken()))
.build();
...
<building the request, setting headers, etc.>
...
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
But I’m getting: Bad HTTP status returned {“errorMessage”:“HTTP 405 Method Not Allowed”,“moreInfo”:“”}
Does anyone know why it would be giving this error?
There’s a bug in your code. This REST API is used to retrieve the reflections anchored on a particular table or view. The “” part of the URL needs to be substituted with the id of the table or view.
I specifically left out the id in th url. When I’m making the query the part is substituted with an actual id
@domke89 the endpoint you are using only supports GET
, and is used for retrieving the reflections for that dataset: Endpoints | Dremio Documentation
To achieve what you are describing you need to use POST /api/v3/catalog/{id}/refresh
as described here: Table | Dremio Documentation
I am using POST and I tried the catalog endpoint (/api/v3/catalog/{id}/refresh) but I’m still getting this error
Also, the interesting thing is that it seems to trigger the referesh when I’m trying it using curl:
curl -X POST ‘https://dremio-ee.k8s.“env”.“org”.net/api/v3/dataset//reflection’ -H “Authorization: Bearer $TOKEN” --header ‘Content-Type: application/json’ --capath $CA_PATH
However, the same query fails in java showing:
SimpleJsonHttpClientError$HttpResponseError: Bad HTTP status returned
Nevermind, I figured it out. I did not have any code to handle 204 response. My fault