How to merge 2 messages in logic apps - azure-logic-apps

here is my problem. I am using Logic Apps, and I am trying to create a message using a transform or any other idea from 2 incoming messages. I have been working with biztalk all my life and is so easy. It's called multipart message.
In example: Ingoing Message "A" + Ingoing Message "B" = Message "A" enriched or message "C".
I have been trying to use the compose. The result of the compose will be incoming of a xslt ( that is the idea). When I am trying to use the compose I can transform message "A" into json and message "B" is json based but for an unknown reason it can't be merge to new structure inside the compose.
If anyone has an idea?
Thanks

This should be possible today with compose - and we are also adding a new feature this month to allow you to inject a JSON property in an object. However i imagine something like this would work with compose. Let me know:
{ “A”: “#json(body(‘A’))”,
“B”: “#json(body(‘B’))”
}

Related

Converting CSV to JSON to send POST From React to Flask API

I am attempting to send a POST request to my API from my React app and am figuring out how to change a CSV from input to JSON format so no downloading needs to take place. I have seen people use Papaparse but from what I saw was that it hadn't been updated in a while so I am looking for other options.
const handleSubmit = async (event) => {
event.preventDefault();// from elements property
console.log(event.target.returns.value)
console.log(await axios.post('http://127.0.0.1:5000/ratios', event.target.returns.value))
setShow(true)
};
If I just send like this I get a 500 error and the first line of my POST function on Flask is
df = request.get_json()
maybe there's an easier way but let me know if you have any insight or advice. Thank you in advance
Your question is somewhat confusing and I think it's due to your understanding of how csv and json would interact. CSV is essentially a way to send tables of data, it doesn't have an inherent key pair structure so you need to do a little work to convert it. I'm not familiar with flask specifically but it looks like df = request.get_json() is trying to parse what it expects to be json but is instead csv. You are right that you need to convert that. Papaparse seems like an excellent option and is still under active development. However I don't think that really matters since csv and json are formats that haven't changed in a long time so the task of converting them hasn't changed. So whether or not there has been recent development doesn't matter.
If you decided to roll your own you could probably get close by taking each row and turning that into an object then matching each row entry with a first row key label or just with saved constants. Depend on how your csvs are structured.

How do get the result from REST website that returns only text?

I'm trying to use a REST web service from Geonames.org. When I try to manually put in the url with the parameters, it would only return the Country Code. I've tried to search for ways to implement it, but most of what I've seen return JSON text with multiple keys and data. I feel like the answer should be pretty simple, but I'm unsure.
I'm trying to use this for a React project I'm working on.
Here is an example of what the url returns
Just looked into the docs of that API, and it says if you want to receive JSON responses simply add JSON keyword to the endpoint. Like here for given endpoint you have:
http://api.geonames.org/countryCodeJSON?formatted=true&lat=47.03&lng=10.2&username=demo
so just change countryCode to countryCodeJSON.
Source: http://www.geonames.org/export/JSON-webservices.html

Need help parsing through JSON Object in JMETER

I'm testing an application that calls one API, gets a bunch of work orders, then only the work order ID's are passed to another API to display on the page.
The format they need to be in is: {"workOrderIds":["12345","123456"]}
I'm using the JSON Extractor with the following Path Expressions:
$..workOrderNumber
then I'm using the JSR223 PostProcessor and using the following script:
props.put("workOrderNumber", "${workOrderNumber}";
The problem is, that its creating the object like so when I add the variable into the POST Request body of the second request:
{"workOrderIds":["12345, 123456"]}
essentially, I just need to make sure that each value has quotations, but not sure how to make this happen. Sorry if this seems simple, I'm fairly new to QA and have spent several hours trying to figure this out.
We cannot provide a comprehensive answer without seeing the source JSON, maybe it worth trying explicitly casting the filtering result to an Integer like:
vars.put('workOrderIds', new groovy.json.JsonBuilder(new groovy.json.JsonSlurper().parse(prev.getResponseData()).findResults { entry -> entry.workOrderNumber as int }).toPrettyString())
More information:
Apache Groovy - Parsing and producing JSON
Apache Groovy - Why and How You Should Use It

How to parse and play Blob/Binary data from database in Angular 5

In my Angular 5 application, I am retrieving data which is stored as VARBINARY(MAX) in SQL Server database. It looks like this in the database field: 0xFEA47E451A40AE4571E51F...
When I retrieve it from database using a GET call via .NET WebAPI, it is shown like this in console from my Angular app: aFwwbUYFjhvbv=bhBGVJHvchjhcbsHKfvHbbh...
I know the MIME type of this data (it is either MP3 or WAV). How can I parse/read this data in Angular 5 client and play it using an HTML <audio> component?
I have looked at several related solutions but none seem to be applicable due to one error or another, or perhaps there is a lack of understanding on my part.
My assumptions are that Blob data has the audio content which I can play. I have to convert it to a File first. This is what I am trying:
const file = new File([blobData], "audio.mp3")
this.audioSource = URL.createObjectURL(file)
And in the HTML, I assign audioSource as the source of an HTML5 component.
<audio [src]="audioSource" type="audio/mp3"></audio>
This results in a net::ERR_UNKNOWN_URL_SCHEME error.
I tried sanitizer.bypassSecurityTrustUrl(this.audioSource) as well but this doesn't work either. What am I doing wrong, and how can I get the intended effect?
please check this answer : https://stackoverflow.com/a/40329529/1160236
if you have blob data with correct binaries all you have to do is to create URL using URL.createObjectURL(blob) then pass it to the audio tag as a source. (check step-3)
if you don't have blob data with correct binaries you can create blob data as shown in step-2.
I have created an Angular example which uses DomSanitizer via a custom pipe.
<audio [src]="audioSource | safe:'url'" id="audio" controls #audioTag></audio>
Reference : https://stackoverflow.com/a/40329529/1160236
Angular implementation using reference : https://stackblitz.com/edit/angular-audio-blob
DomSanitizer example: https://medium.com/#swarnakishore/angular-safe-pipe-implementation-to-bypass-domsanitizer-stripping-out-content-c1bf0f1cc36b
I hope this will help. just remember all you need is valid blob data.

[Zeppelin Apache][Angular] bind a form label with a angular variable

I'm going to explain my problem with zeppelin :
I want to use the Api in order to run a paragraph with params.
In fact i have succeeded to receive the data with
${variable} -> ([Dynamic form][1])
but angular can't interpret it.
The goal is to push data from the API of zeppelin in order to use its with javascript.
I have found a solution.
With Spark interpreter you can receive data from api and store it into a dynamic form {toto} and use it with angular after a z.angularBind("name", "toto") in your spark code;
You can now use angular with your dynamic form. The synthax to use it is {{name}}.

Resources