When it comes to salesforce integration with external services it's a pain to keep up with all the wrapper classes used to build request bodies and to convert retrieved data to appropriate format. in the following article we'll take a look at how you can (and how i did) leverage dataweave to make your code more organized, readable and how to get ride of apex wrapper classes.
for the sake of demonstration let's consider the following scenario; you have an application where users have a search feature, and you store the logs of search operations to a dynamodb database in order to use them later to get insights about what your users search for... and because you have a salesforce org you can bring that data to visualize it in form of dashboards, reports...
disclaimers:
1- salesforce config
configure the data model according to your specific use case, here I’ve created a custom object with a few fields
2- dynamodb setup
head to aws and create a new dynamodb table, and populate it with a few records, we won’t cover the details here, but it’s pretty stright forward, and remember, whenever in doubt, default is the best :)
here, I’ve created a table called SearchLogs, (you don’t need to define you columns when it come to dynamodb)
3- iam user
create a new iam user and give it AmazonDynamoDBFullAccess permission, we’ll use the provided credentials to perform api calls from salesforce, make sure to save the generated access key and Secret access key in a safe place
4- named credentials in salesforce