# 7.9.2 http code convert ? to %3F. Rest API fails. Used to work

**URL:** <https://discuss.elastic.co/t/7-9-2-http-code-convert-to-3f-rest-api-fails-used-to-work/250385>\
**Category:** Kibana\
**Created:** [September 29, 2020, 3:04pm UTC](https://discuss.elastic.co/t/7-9-2-http-code-convert-to-3f-rest-api-fails-used-to-work/250385 "2020-09-29T15:04:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgervais](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@pgervais](https://discuss.elastic.co/u/pgervais)\
**Post date:** [September 29, 2020, 3:04pm UTC](https://discuss.elastic.co/t/7-9-2-http-code-convert-to-3f-rest-api-fails-used-to-work/250385/1 "2020-09-29T15:04:49Z")

</div>

I'm trying to convert my plugin that works under 7.8.1 to 7.9.2. I use the saved object REST API.  
In order to get all index patterns already created.  
The REST API call look like:  
'[http://localhost:5601/api/saved\_objects/\_find?type=index-pattern](http://localhost:5601/api/saved_objects/_find?type=index-pattern)"  
I use the http instance that is passed into the plugin template unchanged.

Somehow the REST API gets converted internally to:  
'[http://localhost:5601/api/saved\_objects/\_find%3Ftype=index-pattern](http://localhost:5601/api/saved_objects/_find%3Ftype=index-pattern)"  
What i now get is a 404 Not Found error.

I've tried using curl with both command options. Version with ? works as expected.  
Version with %3F fails in the same manner.  
Is there an option that can be passed to the http get command that will stop it from converting ? -\> %3F?  
Is this a known bug in the latest release?

function used to do the call is shown below.

async function getRequest(type) {  
console.log('getRequest:' + type);

const url = webSite + '/api/saved\_objects/\_find?type=' + type;  
console.log('getRequest final url:' + url);

const response = await httpClient.get(url);  
console.log('http get response:' + JSON.stringify(response));  
return response;  
}

---

<div class="post-metadata">

**Author:** ![tsullivan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tsullivan/32/31077_2.png) [@tsullivan](https://discuss.elastic.co/u/tsullivan)\
**Post date:** [October 8, 2020, 5:13pm UTC](https://discuss.elastic.co/t/7-9-2-http-code-convert-to-3f-rest-api-fails-used-to-work/250385/2 "2020-10-08T17:13:15Z")

</div>

What is the `webSite` variable? If it is the root URL of Kibana, such as `https://localhost:5601`, that could be the problem.

If this code is in a Kibana plugin, I think the idea should be to send a request to the URL path, not the full URL, since it is not a cross-domain request.

I checked the types in the 7.9 branch of the code to confirm this.

`HttpSetup.get` is a `HttpHandler` interface:

- Definition of `.get`: [https://github.com/elastic/kibana/blob/7.9/src/core/public/http/types.ts#L48](https://github.com/elastic/kibana/blob/7.9/src/core/public/http/types.ts#L48)
- Definition of `HttpHandler`: [https://github.com/elastic/kibana/blob/7.9/src/core/public/http/types.ts#L271](https://github.com/elastic/kibana/blob/7.9/src/core/public/http/types.ts#L271)

If `HttpHandler` is called with a string as the first argument and no second argument, it uses this definition: [https://github.com/elastic/kibana/blob/7.9/src/core/public/http/types.ts#L278](https://github.com/elastic/kibana/blob/7.9/src/core/public/http/types.ts#L278)

Here, in the text of the code, we can see the string is given the identifier `path` which confirms my idea.

A faster way to confirm what kind of string should be passed to `.get` is to search for other usages of that method elsewhere in the code. I did a brief search and found the string is the path in existing code.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 5, 2020, 5:13pm UTC](https://discuss.elastic.co/t/7-9-2-http-code-convert-to-3f-rest-api-fails-used-to-work/250385/3 "2020-11-05T17:13:18Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
