Search code examples
apimulemule-studioconnector

Message.InboundProperty always return String - MULE - AnyPoint Studio - APIkit


im developing an API using RAML + MULE AnypointStudio (APIkit) . so in my RAML file i had defined a resourse like this.

/player
    post:
        queryParameters:
            year: type: integer
            place: type: string

Then, into AnyPoint Studio, after importing my .raml file i got a flow with the post method asociated. I use the MySQL Conector to insert in a data base. the problem resides in the query:

INSERT INTO Matches (day,place,max_players)
VALUES (#[message.inboundProperties.'day'],#[message.inboundProperties'place'],
#[message.inboundProperties.'maxPlayers'])

when i call #[message.inboundProperties.day] it returns a string, but i want an integer value.

im new at MULE, so it would be great if you can explain me how.

ty


Solution

  • All query parameters are treated as Strings. You can use MEL to convert to an int though. Here's an example suing Java in a Mel expression to parse the parameter to an int.

    #[Integer.parseInt(message.inboundProperties.day)]