How to make an API Call from a Form?

n_travaglini August 22, 2024

Hi

I am trying to call an API according to the following documentation:  https://www.cirrnet.ch/service.asmx. However, I am not sure how to embed this in an according form or via which Addon (e.g. Comfiforms) since the Post is being blocked. Does anyone have an idea on how API can be directly reached?

BR

2 answers

1 vote
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2024

Hi @n_travaglini 

Are you trying to set up a ConfiForms form that will do a web-request to one of your services?

That is possible. ConfiForms offers a way to call any service via https://wiki.vertuna.com/display/CONFIFORMS/Configuring+ConfiForms+IFTTT+actions+and+rules#ConfiguringConfiFormsIFTTTactionsandrules-WebServiceRequest

Alex

n_travaglini August 26, 2024

Hi Alex

Thanks a lot for your response and the link.  I actually found that documentation before but had troubles with setting it up. Therefore I  alternatively tried an html form, from which the request got blocked by the server. 

Are you familiar with the correct setup?

Thanks a lot an br

 

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 26, 2024

If you try to do it via HTML and browser request you quickly end up with cross-domain requests that quickly get blocked

What was not working for you with ConfiForms webservice request?

n_travaglini August 31, 2024

Hi Alex

Actually all the configuration is clear, but when I try to adjust the Body Storage format, it does not get saved properly.  In my opinion, it should be something like this (I configured the fields the same way as given by the definition in https://www.cirrnet.ch/service.asmx):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<web:ImportCirrnet>
<web:IdFachbereich>
<ac:structured-macro ac:name="confiform-field">
<ac:parameter ac:name="fieldName">IdFachbereich</ac:parameter>
</ac:structured-macro>
</web:IdFachbereich>
<web:MassngepO>
<ac:structured-macro ac:name="confiform-field">
<ac:parameter ac:name="fieldName">MassngepO</ac:parameter>
</ac:structured-macro>
</web:MassngepO>
<web:MassngetO>
<ac:structured-macro ac:name="confiform-field">
<ac:parameter ac:name="fieldName">MassngetO</ac:parameter>
</ac:structured-macro>
</web:MassngetO>
<web:EreignisO>
<ac:structured-macro ac:name="confiform-field">
<ac:parameter ac:name="fieldName">EreignisO</ac:parameter>
</ac:structured-macro>
</web:EreignisO>
<web:DatEreignis>
<ac:structured-macro ac:name="confiform-field">
<ac:parameter ac:name="fieldName">DatEreignis</ac:parameter>
</ac:structured-macro>
</web:DatEreignis>
<web:aldLogin>
<ac:structured-macro ac:name="confiform-field">
<ac:parameter ac:name="fieldName">aldLogin</ac:parameter>
</ac:structured-macro>
</web:aldLogin>
<web:aPwd>
<ac:structured-macro ac:name="confiform-field">
<ac:parameter ac:name="fieldName">aPwd</ac:parameter>
</ac:structured-macro>
</web:aPwd>
</web:ImportCirrnet>
</soapenv:Body>
</soapenv:Envelope>

However, this is overwritten by confiforms. Here is the configuration of the IFTTT, do you see a potential error?

Attachment 1.png

Attachment 2.png

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 31, 2024

Well, You want a SOAP message to be produced, right?

Add a no format or code macro (inside the ConfiForms IFTTT macro body) and put your SOAP message in there

To reference values from ConfiForms fields use [entry.field_name] notations (not ConfiForms Field macros)

 

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 31, 2024

Also, service URL in the webrequests is NEVER with the domain name (never an absolute URL), but a relative URL that is combined with the root path that you configure the web-service connection configuration

n_travaglini September 3, 2024

Hi Alex

Thanks a lot! So I changed the url to /service.asmx?op=ImportCirrnet and added in the IFTTT Integration the following Code Block:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<web:ImportCirrnet>
<web:IdFachbereich>[entry.IdFachbereich]</web:IdFachbereich>
<web:MassngepO>[entry.MassngepO]</web:MassngepO>
<web:MassngetO>[entry.MassngetO]</web:MassngetO>
<web:EreignisO>[entry.EreignisO]</web:EreignisO>
<web:DatEreignis>[entry.DatEreignis]</web:DatEreignis>
<web:aldLogin>[entry.aldLogin]</web:aldLogin>
<web:aPwd>[entry.aPwd]</web:aPwd>
</web:ImportCirrnet>
</soapenv:Body>
</soapenv:Envelope>

However, I am still getting the following error:

Could not complete request (WebService Request) using configuration id = 081701e4-b4de-4ab3-862c-f17e1b7241b8. Requested to https://www.cirrnet.ch/service.asmx/service.asmx?op=ImportCirrnet has resulted in error. Response code = 500. Response contents: System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Web.Services.Protocols.HttpServerType..ctor(Type type) at System.Web.Services.Protocols.HttpServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)

 

Really sorryy for the circumstances, I am not really able to solve it.

Thanks for your help

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 4, 2024

Is that the URL you want to submit to?

https://www.cirrnet.ch/service.asmx/service.asmx?op=ImportCirrnet 

?

Besides, you can see in the private ticket you have opened with us on what I was actually suggesting to do (using escapeXML function, for example)

0 votes
Luis Pellacani
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 28, 2024

Hey @n_travaglini 

Welcome to Atlassian Community.

 

The option to embed Confluence content outside our products is not currently available, due to the same-origin policy (set through the X-Frame-Options HTTP response header).

In case you opt to use the ConfiForms to achieve the desired results, we would suggest reaching them through their support channels:

 

Based on the details you shared, it might be possible to integrate your requirements developing your own app to use inside Confluence. Our Developer Support team would be the best channel to further clarify your doubts on this matter. You can reach them on the channel below:

 

Cheers,

Luis Pellacani

n_travaglini August 31, 2024

Hi Luis

Okey, great I will gladly reach out, if @Alex Medved _ConfiForms_would not know how to solve it with the provided details.

Thank you guys a lot!

Like Luis Pellacani likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events