Posts

Showing posts with the label Integration

Mule4 - Dataweave - use of read, fromBase64, valuesOf

Image
 Scenario: Assuming that there is base64 encoded string containing values separated by tab(\t) and each row is separated by new line(\n) without any headers, how to extract and build json with predefined index mapped to particular attribute name. Lets assume 0 index is firstName, 1st Index is lastName 2nd Index is customerId. Sample Data:   Mule\t Soft\t aa234ed23e Lets encode the above data to base64: TXVsZVx0U29mdFx0YWEyMzRlZDIzZQ== Now using dataweave functions read, fromBase64 and valueOf ,  extract and build json.

RAML with MultiPart

 Lets build to build file upload with MultiPart, below is RAML RAML /testUpload:      post:        description:  file upload to sftp        headers:         f ilePath:            description:  sftp file path            type:  string        body:          multipart/form-data:            properties:              fileName:                description:  file name                type:  string  ...

Dataweave 2.0 update function

Image
  Update the user data below. Usernames should be all lower case and the street should be   "Fiskargatan" (example from dataweave tutorial from mulesoft) Input payload { "username": "WASP", "name": "Lisbeth", "surname": "Salander", "location": { "address": { "street": "Lundagatan", "number": 9 }, "city": "Stockholm", "country": "Sweden" } } Dataweave Transformation %dw 2.0 import * from dw :: util :: Values output json --- payload update "username" with lower($) update [ "location" , "address" , field( "street" )] with "Fiskargatan" output { "username" : "wasp" , "name" : "Lisbeth" , "surname" : "Salander" , "location" : { "address...

Mule4- Salesforce Connector- Version-10.4.2 - Create job bulk api v 2 - ClientInputError:LineEnding is invalid on user data. Current LineEnding setting is LF

Image
 Problem: When using Salesforce Connector in Mule4 - Component - " Create job bulk api v2 " - when job is crated, return error: ClientInputError:LineEnding is invalid on user data. Current LineEnding setting is LF Resolution: to resolve the issue, try adding lineSeparator="\n" in dataweave while building csv payload for bulk job. Screenshot: