using "Payload" as a Map index - mule

I'm getting crazy whith this, and I'll appreciate any help....
Is there any way to use the value of payload as a map index?.
something like this:
<logger message = "the value is #[flowVars.MyMap['#[payload]'] doc:name="Logger""/>
Thanks in advance
alf.

Use: #[flowVars.MyMap[payload]]

Related

WebBrowser.openAuthSessionAsync has a token in result?

Does anyone has any idea on how to get the token from
WebBrowser.openAuthSessionAsync(url, redirectUrl) result? or how to get the parameter data of it.
Thank you so much in advance.

How to pass dynamic values to a GET API request?

The following GET request passes
#GET("api/v1/shades/colors?color=bl")
Call<List<Colors>> getColors();
but the following GET request fails.
#GET("api/v1/shades/colors?color={colorId}")
Call<List<Colors>> getColors(#Path(StringConstants.COLOR_ID) String colorId);
What's the right way to pass a dynamic value to a GET request?
Thank you!
It seems like you are using JaxRS web application. You should use this :
#GET("api/v1/shades/colors")
Call<List<Colors>> getColors(#Query("color") String colorId);
Check this: https://docs.oracle.com/javaee/6/tutorial/doc/gilik.html and this: https://mkyong.com/webservices/jax-rs/jax-rs-queryparam-example/.
Hope it helps !
Use annotation #RequestParam:
#GET("api/v1/shades/colors")
Call<List<Colors>> getColors(#RequestParam String colorId);

Conversion of data to json

Please find enclosed 3 screenshots in one of above usecase in debug mode , I am trying to obtain the result in json format but I am getting the result as mentioned in lower screenshot in postman .
Please help .
Thanks
Can you add ObjectToJson converter as below
<json:object-to-json-transformer doc:name="Object to JSON"/>
Add this component at the end of your flow. This will solve the issue.

How to access values from the context:property-placeholder in MEL?

can someone pls advise how to access values from a context:property-placeholder in MEL?
I've found an article that describes how to access the values from Java here.
Need similar for MEL.
Thanks,
It is simple mostly same as in Spring container of java. You access it using ${key} where key is present in your properties file.
OK, I had to find the answer by myself.
The syntax of accessing a property value in MEL depends on a type of the value.
For String values it should be like this:
MyStringVar='${MyProperty}';
while for numeric values the quotas not required.
you can try with ${propertyName}, where ever you want to access properties.
You should be able to access the property value as shown below:
<set-variable variableName="someName" value="${xyz.someProperty}" />

how to request to twitter using a keyword with a space?

I want to make a request to Twitter for a keyword that has a space in it. So i want to do http://search.twitter.com/search.atom?q=land rover.
How do i do this?
Use URL encode:
http://search.twitter.com/search.atom?q=land%20rover
Like this: http://search.twitter.com/search.atom?q=land%20rover
Try http://search.twitter.com/search.atom?q=land%20rover.