How to get current path in the flow using dataweave in Mulesoft 4? - anypoint-studio

I want to get "orders" path resource from the requested url below.
Sample:
localhost:8082/orders?id=2

Related

How to get json path for the special character such as #odata.nextLink":"https://graph.microsoft.com/v1.0/users

In Pentaho Spoon, I am trying to build the transformation which will read the Data from Azure AD, and then I will push this data to another application.
Now the problem I am facing is with pagination and I am unable to retrieve the next URL variable from the first REST call.
In the first REST call, I can see the body like below:
{"#odata.context":"https://graph.microsoft.com/v1.0/$metadata#users","#odata.nextLink":"https://graph.microsoft.com/v1.0/users/?$skiptoken=RFNwdAIAAQAAACg6YWJkdWxsYWgucmFzaGVlZGlAYWR2YW5jZWRwZXRyb2NoZW0uY29tKVVzZXJfNDcwMGFmNGEtMjliMi00M2ZjLThlOWYtYzk3MGNkMTM5NTIzuQAAAAAAAAAAAAA","value":[{"id":"34543".......................}]}
The actual problem starts here, in the Pentaho transformation I used Json input to extract the next URL with the path below paths (tried with all the below paths.)
${#odata.nextLink} OR $.{#odata.nextLink} OR $..{#odata.nextLink} OR $#odata.nextLink
But unfortunately, nothing is working.

Mule 4: uriParams size is showing as 0 even though it is there

So I created a endpoint inside the raml file such as:
/proxy:
/{proxyDestinationTarget}:
uriParameters:
proxyDestinationTarget:
type: string
example: "myurl.com"
post:
description: Pass through operation that targets IAA
is: [client-credentials-required,standard-error-responses,traceHeaders]
and then inside of the logic.xml in my variable component I have
attributes.uriParams.'proxyDestinationTarget'
when I send the request in postman and debug i am getting a uriParams size of 0
the url i entered in postman is
https://localhost:8092/proxy/uat.something.somethingElse.com/Assign/Assignment.svc
but if i send a request like this :
https://localhost:8092/proxy/uat.something.somethingElse.com
I get a uriParam size = 1 which is what I want. I guess the / is whats causing the problem. how can I pass url as uri param with escape characters???
It looks like you are not sending an URL that matches the RAML definition in the first case.
For the URL:
https://localhost:8092/proxy/uat.something.somethingElse.com/Assign/Assignment.svc
The RAML defined that the API should expect /proxy/{proxyDestinationTarget} but it is receiving something like /proxy/{proxyDestinationTarget}/Assign/Assignment.svc, where {proxyDestinationTarget} is uat.something.somethingElse.com, but nothing matches /Assign/Assignment.svc. The API should include those two last components too to match. It is not escaping them, they probably need to be defined.

Unable to upload multipart file in karate, Required request part '' not present

ActualAPIRequest OutputFromKarate
Trying to upload a json file for an api using karate. Since api takes multipart input i am passing multipart configurations in karate.
But Required request part 'inputData' not present error is coming. Is there any solution for this please?
I have attached actual input and result from karate screenshot for reference
Just make sure that the data type of inputData and maybe swaggerFile is JSON. Looks like you are sending a string.
Please refer to this section of the doc: https://github.com/intuit/karate#type-conversion
If the server does not like the charset being sent for each multipart, try * configure charset = null

Karate Automation: How to Set Dynamic Path for a URL, from a json data

From Feature file 1, i am reading the content of a json file and passing it to the serverpost.Feature
feature file 1
* def output = read('output.json')
* def result = call read('serverpost.feature') output
In feature file 2, i am trying to set the Path as TC_ID and request body as BODY from the json data.
However, i am not able to set the path using the below feature. Please assist
Feature file 2
Given path '#(TC_ID)'
Given url 'http://myappurl.com:8080/mytestapp/Servers/Data/uploadServer/'
And request { some: '#(BODY)' } #### Here i am able to get the BODY data from JSON
When method post
Then status 200
The '#(foo)' notation applies only to JSON, XML or the right-hand-side of a match statement.
Please use it like a normal JS expression:
Given path TC_ID
or
Given path output.TC_ID

Extract report results with CloudConnect

I would like to extract raw report results within the CloudConnect process.
So far I have managed to get response from the raw report API end point - https://secure.gooddata.com/gdc/app/projects/{project_id}/execute/raw/
This response contains URI to the file and if I put that URI to browser, file is uploaded.
I have tried passing this URI to the following readers without success:
CSV Reader produces the following error:
------------------- Error details ------------------
Component [CSV Reader:CSV_READER] finished with status ERROR.
Parsing error: Unexpected end of file in record 1, field 1 ("date"),
metadata "outOfStock";
value: Raw record data is not available, please turn on verbose mode.
File Download - I don't know how to pass the URI through the port to "URL to Downlaod" parameter.
HTTP Connector again I don't see how to pass URI from the port.
What is the way to do this?
EDIT
If I use the HTTP Connector as suggested by #Filip, I get the following error:
Error details:
Component [HTTP connector:HTTP_CONNECTOR] finished with status ERROR. hostname in
certificate didn't match: xxx.com != secure.gooddata.com OR secure.gooddata.com
I have tried setting header to X-GDC-CHECK-DOMAIN: false with no effect.
The HTTP connector is the right component to go with. Leave the URL property empty and use the component’s property called “Input mapping”, where in the graphic editor you can assign the input edge field to the URL field.
Solution from GoodData support:
HTTP connector can be also used, but it is very complex, because
logging in to GoodData has to be created. REST connector has it built
in.
If you want to run the example graph, you have to be logged in in
CloudConnect with a user who has access to the project from where you
would like to export the report. You also have to change URL to
the one of white-labeled account in both REST connector components and change project
and report definition in the first REST connector.
So the graph that works looks like this:
Here are the main fields that you will need to set for each element:
Get Results URI - set params for POST request:
Request URL = https://secure.gooddata.com/gdc/app/projects/${GDC_PROJECT_ID}/execute/raw/
Request Body =
{
"report_req": {
"reportDefinition": "gdc/md/${GDC_PROJECT_ID}/obj/${OBJECT_ID}"
}
}
Get URI from Response - just map uri value to corresponding field:
<Mapping cloverField="uri" xpath="uri"/>
Load Results - make sure it is connected to metadata with two fields, one for response with data, other to pass through the uri.
Load Results - you will need to exclude uri field to process the data:
Exclude Fields = uri