Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Dave-Ampere
Partner - Contributor II
Partner - Contributor II

How to trace QRS API POST errors in Qlik Sense logs, which log file to look at?

Hi, I'm trying to develop some QRS API calls to automate some processes for QlikSense on Windows (Enterprise). GET calls are working OK, but POSTs and PUTs are not. I'm getting a 400 response back but without further information.

As a first step, could you advise me the best place to look in the QlikSense logs for these calls? Also, do the logs need to be at a certain verbosity?

Thanks!

Labels (3)
1 Solution

Accepted Solutions
Dave-Ampere
Partner - Contributor II
Partner - Contributor II
Author

Hi @Patricia_Silva , thanks. I do use Postman yes. The response doesn't carry enough information (a 400 code but little else).

Thanks! Your help has helped me crack it: 

I worked out it is the "System Level Log" that needed to be set to DEBUG and then I can see more information in the Repository Log folder, in the "Trace > System Repository" log.

From there I could see the JSON payload was causing an exception in QlikSense. With a bit of trial and error I've got my payload JSON correct. Sorted 🙂

Some background details:

I was testing the create flow (POST) to create a new custom property definition (as per the API docs for creating custom property ). Once I'd set the level to Debug, I could see my POST request and then the next line in the logs carries this:

[RESTEngine.HandleException] Caught Newtonsoft.Json.JsonReaderException	Unexpected character encountered while parsing value: n. Path '', line 0, position 0.	   at Newtonsoft.Json.JsonTextReader.ParseValue()↵↓   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)↵↓   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)↵↓   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)↵↓   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)↵↓   at Qlik.Sense.Common.Serialization.JSONSerializer.Deserialize(String value, Type type, JsonSerializerSettings serializerSettings)↵↓   at Qlik.Sense.Common.Communication.REST.Server.RESTParser.ParseRequest(IHttpListenerRequestWrapper httpRequest, IHttpRecording httpRecording, IObjectCreator objectCreator, ParsedMethod parsedMethod)↵↓   at Qlik.Sense.Common.Communication.REST.Server.RESTEngine.<>c__DisplayClass26_0.<GetParsedRequest>b__0(ParsedMethod parsedMethod)↵↓   at System.Collections.Generic.List`1.ForEach(Action`1 action)↵↓   at Qlik.Sense.Common.Communication.REST.Server.RESTEngine.GetParsedRequest(IHttpListenerRequestWrapper request, IHttpRecording httpRecording, IObjectCreator objectCreator)↵↓   at Qlik.Sense.Common.Communication.REST.Server.RESTEngine.HandleRequest(IHttpListenerRequestWrapper httpRequest, IHttpListenerResponseWrapper httpResponse, IHttpRecording httpRecording)

 

View solution in original post

3 Replies
Patricia_Silva
Specialist II
Specialist II

Hello @Dave-Ampere, I would suggest you to set the logs to debug mode. On the other hand have you tried to use Postman tool to see what response you get from there?

Help users find answers! Don't forget to mark a correct resolution 🙂
Dave-Ampere
Partner - Contributor II
Partner - Contributor II
Author

Hi @Patricia_Silva , thanks. I do use Postman yes. The response doesn't carry enough information (a 400 code but little else).

Thanks! Your help has helped me crack it: 

I worked out it is the "System Level Log" that needed to be set to DEBUG and then I can see more information in the Repository Log folder, in the "Trace > System Repository" log.

From there I could see the JSON payload was causing an exception in QlikSense. With a bit of trial and error I've got my payload JSON correct. Sorted 🙂

Some background details:

I was testing the create flow (POST) to create a new custom property definition (as per the API docs for creating custom property ). Once I'd set the level to Debug, I could see my POST request and then the next line in the logs carries this:

[RESTEngine.HandleException] Caught Newtonsoft.Json.JsonReaderException	Unexpected character encountered while parsing value: n. Path '', line 0, position 0.	   at Newtonsoft.Json.JsonTextReader.ParseValue()↵↓   at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)↵↓   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)↵↓   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)↵↓   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)↵↓   at Qlik.Sense.Common.Serialization.JSONSerializer.Deserialize(String value, Type type, JsonSerializerSettings serializerSettings)↵↓   at Qlik.Sense.Common.Communication.REST.Server.RESTParser.ParseRequest(IHttpListenerRequestWrapper httpRequest, IHttpRecording httpRecording, IObjectCreator objectCreator, ParsedMethod parsedMethod)↵↓   at Qlik.Sense.Common.Communication.REST.Server.RESTEngine.<>c__DisplayClass26_0.<GetParsedRequest>b__0(ParsedMethod parsedMethod)↵↓   at System.Collections.Generic.List`1.ForEach(Action`1 action)↵↓   at Qlik.Sense.Common.Communication.REST.Server.RESTEngine.GetParsedRequest(IHttpListenerRequestWrapper request, IHttpRecording httpRecording, IObjectCreator objectCreator)↵↓   at Qlik.Sense.Common.Communication.REST.Server.RESTEngine.HandleRequest(IHttpListenerRequestWrapper httpRequest, IHttpListenerResponseWrapper httpResponse, IHttpRecording httpRecording)

 

Patricia_Silva
Specialist II
Specialist II

Hello @Dave-Ampere, I am happy to know the issue could be solved, and also happy that you shared the solution you found 🙂 

Help users find answers! Don't forget to mark a correct resolution 🙂