Skip to main content
May 16, 2024
Question

Parsing HTTP Response

  • May 16, 2024
  • 13 replies
  • 0 views

I am struggling with parsing the HTTP response.  I thought fv!result in the rule that called the integration would allow me to access the body of the response.  However, I am getting errors.  The three values I am trying to access are highlighted below.  Screenshots of the function where I call the integration and the response from the call are shown below.  I would like the three values stored in local variables so I can display the text messages to the user.  Thank you in advance!

                         rule!CreatePatientResource(
                           givenName:local!firstName,
                           familyName:local!surName,
                           gender:local!gender,
                           dateOfBirth: local!dateOfBirth,
                           onSuccess:
                           {
                             a!save(local!registrationErrorMessage,null),
                             a!save(local!registrationComplete,true()),                 
                             a!save(local!registrationConfirmationMessage, 
                               concat(tostring(local!firstName), " ",tostring(local!surName)," was successfully registered"))

                           },
                           onError: {
                              /*Handle HTTP error */
                             a!save(local!registrationErrorMessage, fv!error.message)
                           }
                         )

13 replies

stefanhelzle0001
May 16, 2024

And what errors do you get?

For me, your code and your requirements do not match.

Where is this "onSuccess" coming from. Do you try to call an integration which you configured to "Modifies Data" just inside some expression code?

johnd0037Author
May 16, 2024

The onSuccess/onError was shown as rule-inputs when we selected "Override and define all error conditions" option.  

This is the integration that we are trying to call and obtain results from.

stefanhelzle0001
May 16, 2024

OK. And the other questions from my post?

When you configure that integration to "Usage: Modifies Data", you can only call it inside a saveInto or a Call Integration node in a process. And this is when the onSuccess and onError pop up.