Retrieve error response from parseJSON logic apps - json

Can you retrieve the error message from Parse JSON step on failure?
I have tried different ways of access the message, but all return the empty string
body('Parse_json')?['errors'][0]['message']
Logic app Flow with Pars JSON with error message

Please use this expression:
outputs('Parse_json')['errors'][0]['message']

Related

SyntaxError: Unexpected token v in JSON at position 0 at parse (<anonymous>) at tryCallOne

In my React Native app, I have two different instances where I make an API call and then pass the response to the json() method. In the first instance, the promise resolves; in the second, it throws the following error "SyntaxError: Unexpected token v in JSON at position 0 at parse () at tryCallOne".
The response objects that I pass to json() are as follows:
First instance (successful)
Second instance (unsuccessful)
As far as I can tell, the only difference between these two is x-sourcefiles, but since they're both strings, I can't imagine that this would cause an error in the json() method.
When I've read other people's solutions, normally the problem was that the Response objects they passed to json() was not actually JSON (sometimes it was HTML etc). That obviously doesn't apply here since both objects, one of which is successful, are of the same type.
Does anyone have any insight or know how I could approach this?

How to get access token with JMeter JSON Extractor and use it?

I'm trying to extract access token from the body response and use it in Header Manager for authorization.
The response of the first request is
Response
Then I use regular expression for extracting the token
Json Extractor
Then I enter a variable into the Header Manager
Header Manager
But when I run the script I receive an error:
Listener
Also, I get an error:
2019-02-09 23:45:57,822 ERROR o.a.j.e.j.j.JSONPostProcessor: Error processing JSON content in JSON Extractor, message: Use bracket notion ['my prop'] if your property contains blank characters. position: 2
Error
I assume that json path is incorrect
I have already researched a lot of questions here but they didn't help me
What is wrong in my actions?
Thanks for the response in advance!
Use JSON Path Expressions as $.access_token
You're using a Regular Expression inside a JSON Extractor, that's your problem.
You must use JSON Path expression instead.
So correct value for JSON Path Expressions is:
$..access_token
Since you have in "Names for created variables" token, you can then use it with:
${token}

Angular 6 HttpClient not converting response to Interface

I have an api endpoint that responds with a JSON Array as a string.
Correspondingly, I have an interface that matches the JSON response
I have a service that makes the request to get the array of users and logs the first record to the console.
Expected Results
I expect to get a UserDetails object back and should print all the contents of index 0 to the console.
Actual Results
In the console I just see the character '['. It seems that res variable is still being treated as a string, and not a UserDetails array.
I have been struggling for house to try and figure out what is causing this behavior
I found the problem for anyone who is interested.
My server is returning the response in the body as a JSON string (this is a requirement from AWS API Gateway). The following has to be done to get the data to correctly parse.

JSON Destination component error in Kingswaysoft

Am using JSON destination component to perform DELETE , it is a bit weird that the delete is successful when I saw in UI but am receiving the following error.
[JSON Destination [15]] Error: An error occurred with the following error message:
"System.Exception: Http response body is invalid JSON. (SSIS Productivity Pack, v6.2.0.1468 -
DtsDebugHost, v11.0.7001.0)Newtonsoft.Json.JsonReaderException : Error reading JObject from JsonReader. Path '', line 0, position 0.".
[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "JSON Destination" (15)
failed with error code 0xC02090F9 while processing input "Input1 (Merge Join)" (32). The identified component returned an error from the
ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running.
There may be error messages posted before this with more information about the failure.
For the error you are getting above, it seems that the response you get is not in a JSON array, so the component cannot parse the response if you have checked the Response Is Array option in the Output Columns page.
Note that you would only check the Response Is Array option if the HTTP response contains an array with items corresponding to your input rows. If the response does not contain information about each input item, you wouldn’t need to check this option.
In this case, you can try to uncheck the Response Is Array option and enable the HttpBody option in the Output Columns page to verify what value you get from the response body.
Please feel free to reach out to our official support channel if you have any further trouble.

REST api with HttpClient but unknown JSON response

I'm using the WebApi httpclient to build up a .net api library for use against a REST webservice.
The rest service returns JSON.
Problem i am having is that for one request, it is possible that i get diffrent JSON formats back.
If the query was successful, I get back a JSON array which I have made a strong c# type to hold it.
Using the ReadAsAsync< T > method to get it out of the content.
If the request had a bad api key in or another error happens, the rest service returns a JSON object with some properties like status=error and an explanation message etc.
I cant then just use the ReadAsAsync< T > method as I dont know what format is comming back. I don't know much about the JSON linq library but is there a way I can put the JSON response into some JSON holder object and then check if there is a status=error in it and then use the correct deserialization to my strong type.
I seem to be able to store it in a JRaw object but don't know where to go from here.
Many thanks.
If the request had a bad api key in or another error happens, the rest service returns a JSON object with some properties like status=error and an explanation message etc.
In this case, the status code returned will not be successful. You can do a check on the status code and then deserialize your response content appropriately:
if (httpResponseMessage.IsSuccessStatusCode)
{
// Deserialize your JSON array
}
else
{
// Deserialize the error
}
You can use error handling in this case
try
{
//Deserialize your JSON Array..this will throw an exception in case of type mismatch
}
catch(Exception e)
{
//Deserialize your JSON object which will give you Error code or message
}