Not getting proper response from API

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*

  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

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:

{
"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 

...

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