# Can't refresh reflections using API v3

**URL:** <https://community.dremio.com/t/cant-refresh-reflections-using-api-v3/11955>\
**Category:** Uncategorized\
**Created:** [June 17, 2024, 10:22am UTC](https://community.dremio.com/t/cant-refresh-reflections-using-api-v3/11955 "2024-06-17T10:22:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![domke89](https://avatars.discourse-cdn.com/v4/letter/d/77aa72/32.png) [@domke89](https://community.dremio.com/u/domke89)\
**Post date:** [June 17, 2024, 10:22am UTC](https://community.dremio.com/t/cant-refresh-reflections-using-api-v3/11955/1 "2024-06-17T10:22:58Z")

</div>

Hello, I am trying to make a request to trigger reflection refreshes for a dataset with:

```auto
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?

---

<div class="post-metadata">

**Author:** ![Benny\_Chow](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/benny_chow/32/5527_2.png) [@Benny\_Chow](https://community.dremio.com/u/Benny_Chow)\
**Post date:** [June 18, 2024, 3:38pm UTC](https://community.dremio.com/t/cant-refresh-reflections-using-api-v3/11955/2 "2024-06-18T15:38:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![domke89](https://avatars.discourse-cdn.com/v4/letter/d/77aa72/32.png) [@domke89](https://community.dremio.com/u/domke89)\
**Post date:** [June 18, 2024, 7:01pm UTC](https://community.dremio.com/t/cant-refresh-reflections-using-api-v3/11955/3 "2024-06-18T19:01:26Z")

</div>

I specifically left out the id in th url. When I’m making the query the part is substituted with an actual id

---

<div class="post-metadata">

**Author:** ![Max\_Lerch](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/max_lerch/32/4921_2.png) [@Max\_Lerch](https://community.dremio.com/u/Max_Lerch)\
**Post date:** [June 18, 2024, 11:34pm UTC](https://community.dremio.com/t/cant-refresh-reflections-using-api-v3/11955/4 "2024-06-18T23:34:37Z")

</div>

@domke89 the endpoint you are using only supports `GET`, and is used for retrieving the reflections for that dataset: [Endpoints | Dremio Documentation](https://docs.dremio.com/current/reference/api/datasets/endpoints/)

To achieve what you are describing you need to use `POST /api/v3/catalog/{id}/refresh` as described here: [Table | Dremio Documentation](https://docs.dremio.com/current/reference/api/catalog/table#refreshing-the-reflections-on-a-table)

---

<div class="post-metadata">

**Author:** ![domke89](https://avatars.discourse-cdn.com/v4/letter/d/77aa72/32.png) [@domke89](https://community.dremio.com/u/domke89)\
**Post date:** [June 19, 2024, 8:20am UTC](https://community.dremio.com/t/cant-refresh-reflections-using-api-v3/11955/5 "2024-06-19T08:20:47Z")

</div>

I am using POST and I tried the catalog endpoint (_/api/v3/catalog/{id}/refresh_) but I’m still getting this error

---

<div class="post-metadata">

**Author:** ![domke89](https://avatars.discourse-cdn.com/v4/letter/d/77aa72/32.png) [@domke89](https://community.dremio.com/u/domke89)\
**Post date:** [June 19, 2024, 2:21pm UTC](https://community.dremio.com/t/cant-refresh-reflections-using-api-v3/11955/6 "2024-06-19T14:21:49Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![domke89](https://avatars.discourse-cdn.com/v4/letter/d/77aa72/32.png) [@domke89](https://community.dremio.com/u/domke89)\
**Post date:** [June 19, 2024, 2:57pm UTC](https://community.dremio.com/t/cant-refresh-reflections-using-api-v3/11955/7 "2024-06-19T14:57:29Z")

</div>

Nevermind, I figured it out. I did not have any code to handle 204 response. My fault
