Publishing a POST Rest Service: how to read payload/body

I'm currently publishing a POST rest webservice (another application is sending customer data into my database). They are sending this information in the body/payload of the POST message. For example: { "Customer": { "Name": "Henk", "Address": "Straat" } } How do I read this message? Currently my microflow has 1 input object (SearchArgs) to read the input parameters from the REST request. How do I configure my microflow so that I can read the body? Do I need to call any of the java included in the module? How do I map this JSON message. I can see there is a Java call "deserializeJsonToObject" but that expects a JSON string as input.
1 answers

If you have your datamodel set up correctly, meaning SearchArgs can probably contain 1 customer object you can do the following:

SearchArgs(non persistable)

1-1 association _SearchArgsCustomer (will be ignored because it has a _ in front of it)

Customer(non persistable) with the attributes

  • Name
  • Address

If you then receive a SearchArgs you can then do a retrieve action retrieve Customer, which will automatically map your JSON to the data model, comparing the attribute names and ignoring _

But as said in the comments the github page you can find the exact details of how to publish a service if your data is more complex as displayed above.