# Not getting proper response from API

**URL:** <https://discuss.elastic.co/t/not-getting-proper-response-from-api/248758>\
**Category:** Kibana\
**Created:** [September 16, 2020, 2:16am UTC](https://discuss.elastic.co/t/not-getting-proper-response-from-api/248758 "2020-09-16T02:16:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chenna123](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@chenna123](https://discuss.elastic.co/u/chenna123)\
**Post date:** [September 16, 2020, 2:16am UTC](https://discuss.elastic.co/t/not-getting-proper-response-from-api/248758/1 "2020-09-16T02:16:30Z")

</div>

Hi,

I'm facing an issue with API, following these below line to invoke API from Powershell and expecting json response but I'm getting HTML response instead.

API - [http://xxxxxxxxx/api/saved\_objects/\_find?type=dashboard&search\_fields=title&search=Image\*](http://xxxxxxxxx/api/saved_objects/_find?type=dashboard&search_fields=title&search=Image*)

1. Invoke-RestMethod -Method Get -Uri $Url -ContentType "application/json" -Credential $credential
2. Invoke-RestMethod -Method Get -Uri $Url -Headers @{"content-type" = "application/json"} -Credential $credential

Please help me to get json response.

Thanks in advance.

- 

Chenna

---

<div class="post-metadata">

**Author:** ![thomasneirynck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomasneirynck/32/23313_2.png) [@thomasneirynck](https://discuss.elastic.co/u/thomasneirynck)\
**Post date:** [September 21, 2020, 2:27pm UTC](https://discuss.elastic.co/t/not-getting-proper-response-from-api/248758/2 "2020-09-21T14:27:38Z")

</div>

hi @chenna123,

Maybe you are getting an error-page from the server (e.g. a 404 or 500)?

When I'm running that API-call, it seems OK.

e.g. with sample-data loaded, I get something like:

```auto
{
"page": 1,
"per_page": 20,
"total": 13,
"saved_objects": [
{
"type": "dashboard",
"id": "7adfa750-4c81-11e8-b3d7-01146121b73d",
"attributes": {
"title": "[Flights] Global Flight Dashboard",
"hits": 0,
"description": "Analyze mock flight data for ES-Air, Logstash Airways, Kibana Airlines and JetBeats",
"panelsJSON": "[{\"panelIndex\":\"1\",\"gridData\":{\"x\":0,\"y\":0,\"w\":32,\"h\":7,\"i\":\"1\"},\"embeddableConfig\":{},\"version\":\"7.3.0\",\"panelRefName\":\"panel_0\"},{\"panelIndex\":\"3\",\"gridData\":{\"x\":17,\"y\":7,\"w\":23,\"h\":12,\"i\":\"3\"},\"embeddableConfig\":{\"vis\":{\"colors\":{\"Average Ticket Price\":\"#0A50A1\",\"Flight Count\":\"#82B5D8\"},\"legendOpen\":false}},\"version\":\"7.3.0\",\"panelRefName\":\"panel_1\"},{\"panelIndex\":\"4\",\"gridData\":{\"x\":0,\"y\":85,\"w\":48,\"h\":15,\"i\":\"4\"},\"embeddableConfig\":{},\"version\":\"7.3.0\",\"panelRefName\":\"panel_2\"},{\"panelIndex\":\"5\",\"gridData\":{\"x\":0,\"y\":7,\"w\":17,\"h\":12,\"i\":\"5\"},\"embeddableConfig\":{\"vis\":{\"colors\":{\"ES-Air\":\"#447EBC\",\"JetBeats\":\"#65C5DB\",\"Kibana Airlines\":\"#BA43A9\",\"Logstash 

...

```

---

<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:** [October 19, 2020, 2:28pm UTC](https://discuss.elastic.co/t/not-getting-proper-response-from-api/248758/3 "2020-10-19T14:28:05Z")

</div>

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