Dear Team,
Can you share the sample or demo code where i can fetch the bulk data from sql server in mule soft and that bulk data i want to push in third party api which is accepting data as json
Dear Team,
Can you share the sample or demo code where i can fetch the bulk data from sql server in mule soft and that bulk data i want to push in third party api which is accepting data as json
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mohamed Azarudeen ZRank #297 · 8.5K reputationPosted Jun 5, 2023, 7:53 AM EDT
Hi gaurav
hope you have comected database nad http connectors find tyhe sample code below
Gaurav Srivastava64 reputationPosted Jun 5, 2023, 10:43 AM EDT
Dear Mohammad,
thank you so much for quick response, but it would be helpful if you have any sample code for the same.
yes i am able to fetch bulk data from sql server database and display as json but if i want to insert bulk data in third party API as best practice so can you suggest any sample code for the same and another use case is, i want this push as scheduled job i mean i want to push lets say this bulk data on daily basis to third party once in a day automatically.
appreciate if you can suggest example with source code.
Rajkiran SwainRank #165 · 14.4K reputationPosted Jun 5, 2023, 12:01 PM EDT
n the above code:
The
db:selectcomponent is used to fetch the desired bulk data from the SQL Server database. Make sure you have a properly configured database connector (SQLServer_Config) with the required connection details.The
json:object-to-json-transformeris used to convert the fetched data to JSON format.The
http:requestcomponent is used to make an HTTP POST request to the third-party API. Ensure that you have a properly configured HTTP connector (ThirdPartyAPI_Config) with the necessary endpoint details.The fetched data, converted to JSON, is passed as the payload of the HTTP POST request.
Please note that you'll need to configure the database connection and the HTTP connector with the appropriate details according to your environment and the third-party API specifications.
Feel free to customize the code as per your specific requirements and data structures.
If you have any further questions or need additional assistance, please let us know.
Gaurav Srivastava64 reputationPosted Jun 6, 2023, 2:02 PM EDT
Dear Rajkiran,
I hope you are doing well.
thanks for your reply, but i am using latest version of mule and it is not supporting object to json for that i am using dataweave and for that i dont have any issue or concern, what i am looking for industry standard best practice sample code like it will execute daily once in a day the job or schedular for fetching t-1 day records from sql database as bulk in json and then it should post to third party api. But what i am looking for industry best practices for the same lets say including caching, or if any error happend so retry to post again untill the bulk loaded data not successfully pushed to third party api. I hope you understand my query.
so appreciate if you have such use case sample code so kindly suggest or post.