javaapipostsaiku

Error while hit the query EXECUTE API in saiku using POSTMAN


enter image description hereI have API for execute the query [http://localhost:8080/saiku/rest/saiku/api/query/execute] and i pass the input as a application/json.

Body:

{
    "name": "0A470887-83B3-BCCD-A01C-1AC522C394A6",
    "queryModel": {
        "axes": {
            "FILTER": {
                "mdx": null,
                "filters": [],
                "sortOrder": null,
                "sortEvaluationLiteral": null,
                "hierarchizeMode": null,
                "location": "FILTER",
                "hierarchies": [],
                "nonEmpty": false,
                "aggregators": []
            },
            "COLUMNS": {
                "mdx": null,
                "filters": [],
                "sortOrder": null,
                "sortEvaluationLiteral": null,
                "hierarchizeMode": null,
                "location": "COLUMNS",
                "hierarchies": [],
                "nonEmpty": true,
                "aggregators": []
            },
            "ROWS": {
                "mdx": null,
                "filters": [],
                "sortOrder": null,
                "sortEvaluationLiteral": null,
                "hierarchizeMode": null,
                "location": "ROWS",
                "hierarchies": [
                    {
                        "name": "[Date].[Time]",
                        "levels": {
                            "Year": {
                                "name": "Year"
                            }
                        },
                        "cmembers": {}
                    }
                ],
                "nonEmpty": true,
                "aggregators": []
            }
        },
        "visualTotals": false,
        "visualTotalsPattern": null,
        "lowestLevelsOnly": false,
        "details": {
            "axis": "COLUMNS",
            "location": "BOTTOM",
            "measures": [
                {
                    "name": "Average Magnitude",
                    "type": "EXACT"
                }
            ]
        },
        "calculatedMeasures": [],
        "calculatedMembers": []
    },
    "queryType": "OLAP",
    "type": "QUERYMODEL",
    "cube": {
        "uniqueName": "[earthquakes].[Global Earthquakes].[Global Earthquakes].[Earthquakes]",
        "name": "Earthquakes",
        "connection": "earthquakes",
        "catalog": "Global Earthquakes",
        "schema": "Global Earthquakes",
        "caption": null,
        "visible": false
    },
    "mdx": null,
    "parameters": {},
    "plugins": {},
    "properties": {
        "saiku.olap.query.automatic_execution": true,
        "saiku.olap.query.nonempty": true,
        "saiku.olap.query.nonempty.rows": true,
        "saiku.olap.query.nonempty.columns": true,
        "saiku.ui.render.mode": "table",
        "saiku.olap.query.filter": true,
        "saiku.olap.result.formatter": "flattened",
        "org.saiku.query.explain": true,
        "saiku.olap.query.drillthrough": true,
        "org.saiku.connection.scenario": false
    },
    "metadata": {}
}

Once i hit that API means I got an error such as

SEVERE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class org.saiku.web.rest.objects.resultset.QueryResult, and Java type class org.saiku.web.rest.objects.resultset.QueryResult, and MIME media type application/octet-stream was not found.

AND

SEVERE: A message body writer for Java class org.saiku.olap.query2.ThinQuery, and Java type class org.saiku.olap.query2.ThinQuery, and MIME media type application/octet-stream was not found.
The registered message body writers compatible with the MIME media type are:
*/* ->
  com.sun.jersey.core.impl.provider.entity.FormProvider
  com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
  com.sun.jersey.core.impl.provider.entity.StringProvider
  com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
  com.sun.jersey.core.impl.provider.entity.FileProvider
  com.sun.jersey.core.impl.provider.entity.InputStreamProvider
  com.sun.jersey.core.impl.provider.entity.DataSourceProvider
  com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
  com.sun.jersey.core.impl.provider.entity.ReaderProvider
  com.sun.jersey.core.impl.provider.entity.DocumentProvider
  com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider
  com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
  com.sun.jersey.json.impl.provider.entity.JSONJAXBElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONArrayProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONObjectProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONWithPaddingProvider
  com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
  com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider
  com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
  com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONRootElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JSONListElementProvider$General
  com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy
application/octet-stream ->
  com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
  com.sun.jersey.core.impl.provider.entity.FileProvider
  com.sun.jersey.core.impl.provider.entity.InputStreamProvider
  com.sun.jersey.core.impl.provider.entity.DataSourceProvider
  com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider

But it is working fine in localhost web-application and not in POSTMAN


Solution

  • I have faced the same problem for my case this is solved my probs 1.http://localhost:8080/saiku/rest/saiku/username/query/queryname/, 2.http://localhost:8080/saiku/rest/saiku/api/query/execute/. Both the query Name must be same when u call in post man . For api 2 queryname value is in input Json( parameter as name).