Skip to main content
Question

Call external rest api from report rule (Apps10)

  • September 11, 2024
  • 8 replies
  • 106 views

Forum|alt.badge.img+5
  • Sidekick (Customer)
  • 15 replies

We are trying to call the external rest API from the report rule but unfortunately don’t know how it will work.

If someone already tried then please share how we can set it up. 

We already have an external rest api and that is working. We want the same working from the report rule.

 

Report rule

 

Application message but in error

 

Thank you in advance for your help and support.

8 replies

Harley
Hero (Customer)
Forum|alt.badge.img+9
  • Hero (Customer)
  • 27 replies
  • October 10, 2024

I have tried something similar and ended up getting success using the “SEND_XML_TO_CONNECT” logical printer. This could be used in combination with Report Rules.

By Using the SEND_XML_TO_CONNECT, i was able to apply a Routing Rule to route to a defined Routing Address. This gave more control over the sender, action, authentication.

 

The routing rule conditions looked like this:

 

I was testing with a simple endpoint in Power Automate and found that this worked via the HTTP_SENDER. Calling this endpoint using REST_SENDER was returning 400 Bad Request.

Other end points have worked with the REST_SENDER using this approach.


Forum|alt.badge.img+5
  • Author
  • Sidekick (Customer)
  • 15 replies
  • October 10, 2024

@Harley Thank you for your reply. Could you please send me the screenshot of the report rule that you set up for this case?

I want to check further to set up at my end after looking at those setups.

 

 

 


Harley
Hero (Customer)
Forum|alt.badge.img+9
  • Hero (Customer)
  • 27 replies
  • October 10, 2024

@SNBSHAN 

See below

This is working with a Report layout that uses the XML Plugin

<?xml version="1.0" encoding="UTF-8"?>
<report-layout>
	<properties>
		<version>0.1</version>
		<layout-type>XML</layout-type> <!--SCRIPT,XSL,XML,EXCEL-->
		<plugin-class>ifs.application.reportingservices.impl.extendedformatter.xmlplugin.XMLPlugin</plugin-class>
		<output-method>BINARY</output-method> <!-- BINARY,FILE,E-MAIL-->
		<output-extension>xml</output-extension>
		<default-output-reference>
			<binary></binary> 
			<file></file>
			<e-mail></e-mail>
	   		<e-mail-sender></e-mail-sender>
	   		<e-mail-cc></e-mail-cc>
	   		<e-mail-subject></e-mail-subject>
	   		<e-mail-body>
				<![CDATA[
					Email Body Content from the RPL
				]]> 
	   		</e-mail-body>
		</default-output-reference>
 		<full-xml>TRUE</full-xml>
		<flattened-xml>
			<enabled>TRUE</enabled>
			<strongtyping>TRUE</strongtyping>
    		</flattened-xml>
		<report-id>CUSTOMER_ORDER_IVC_REP</report-id>
		<report-title>XML</report-title>
	</properties>
	<plugin>
		<properties>
			<!-- not used by this plugin -->
		</properties>
		<data> 
			<!-- not used by this plugin -->
		</data> 
		<variables>
			<!-- not used by this plugin --> 
		</variables>
	</plugin>
</report-layout>

Not sure this is the best way to approach this, but it seems to be working.


Forum|alt.badge.img+5
  • Author
  • Sidekick (Customer)
  • 15 replies
  • October 10, 2024

@Harley

I am not sure how it works but I will test and let you know.

The xmll that you send it, is it the code of the file “XMLoutput.rpl” ?


dsj
Superhero (Partner)
Forum|alt.badge.img+22
  • Superhero (Partner)
  • 836 replies
  • October 10, 2024

Hi @SNBSHAN 

I think when you add OutputType and Message, it creates two payloads (Message input data in your application message) which could lead to the error.

Slightly different approach than @Harley mentioned which could work is to route to connect without any connector in the report rule

Then create a routing address and a rule to route to your rest endpoint and create a transformer to convert the report XML to the desired JSON format.

 

Hope it helps!

Damith


Harley
Hero (Customer)
Forum|alt.badge.img+9
  • Hero (Customer)
  • 27 replies
  • October 11, 2024
SNBSHAN wrote:

@Harley

I am not sure how it works but I will test and let you know.

The xmll that you send it, is it the code of the file “XMLoutput.rpl” ?

yes, that is the contents of XMLoutput.rpl


Forum|alt.badge.img+5
  • Author
  • Sidekick (Customer)
  • 15 replies
  • October 11, 2024

Thank you @dsj  and @Harley  for your answer.

I will first try and then will let you know.

 

 


Forum|alt.badge.img+5
  • Author
  • Sidekick (Customer)
  • 15 replies
  • October 16, 2024

Thank you both for your help and suggestion @dsj and @Harley .

I tried and it is working as expected.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings