Skip to main content

Hello, I am new to Mulesoft.

 

I would like to build an HTTP GET REST API that retrieves reference data stored on some kind of JSON property file residing on the Mulesoft ESB runtime. This property file stores small map of key value pairs in JSON format. How best to achieve as I do not want to use File Connector as the inbound endpoint or outbound endpoint? Instead I will be using HTTP Connector for my request and response end point.

 

Sample reference data stored in "sample-${env}.json" property file. There will be 3 versions of the "sample-${env}.json" property for each of the 3 runtime environments (DEV, TEST, PROD) as the values will be different (e.g. "sample-DEV.json", "sample-TEST.json" , "sample-PROD.json" ).

[

{

"country": "Canada",

"code": "CA"

},

{

"country": "United States",

"code": "US"

}

]

 

Thanks, Paul

6 risposte
  1. 15 ott 2016, 11:45

    - Requester can accept connector reference here you can add global file connector with auto delete false with pass reference of that connector to requester as connector=File_connector_name

    - Query "?connector=File" is for passing connector reference you can also pass any file connector attribute like this even autoDelete=false

    - You can evaluate any mule expression for setting resource name, here filename is set into flowvars before Mule requester then referred in requester resource name instead of any hard coded value.

    - No need to add return class. You can add `<json:object-to-json-transformer doc:name="Object to JSON"/>` for converting to JSON or use dataweave for the same.

     

    Hope this helsp.

0/9000