Calling a REST with a path defined in a variable

0
I’m consuming several REST from the same URL therefore I have defined a Constant which contains the basic path to the server. And I call the REST using that Constant.   Everything works fine running the app locally, I get the ‘error , contact the administrator’ message running from the cloud. Everything works also just fine using the URL instead of the Constant in the REST call. I don’t think I have access to the logs so I don’t know what is going on.  Any suggestions? Thanks    
asked
5 answers
2

In a free app node, the constant value that is set in Studio Pro is used. You should be able to watch logs live from a free node by accessing the “View Live Log” button in the “Environments” tab of home.mendix.com.

Using the live log viewer, please log both the value of the constant and also capture the error you’re getting, and share it here. If it’s an issue with the free environment, we’ll get it submitted as a ticket to Mendix Support.

EDIT:

I’m trying to reproduce your issue, and not having any luck. I created an app that uses a constant and calls a mock API:

https://ticket102961-sandbox.mxapps.io/

The value of the constant is:

https://tieniber.mocklab.io:443/

and I am concatenating the end of the API string to that in the same was you’ve described. As you can see, the app shows the correct value for the constant, and when you click the button, the API gets called successfully.

Do you mind packaging up your app with the constant set up to reproduce the issue (File → Export) and sharing on the support ticket?

answered
0

>>Micah McMullen
>>Hey Massimo, add + ‘api/team’  to the end to complete the string. Should work for you then. 

Hi Micah,

I tried several options, this is the only one which works locally, but still not on the cloud.

It seems the only way to have the App working on the cloud is to explicitly use the URL in the REST call.

 

 

 

answered
0

Anyone from Mendix?

answered
-1

Did you check the log at the cloud environment? 

How did you configure the constant? By modeler runtime settings or within the model? 

My first guess would be that the cloud env does not have access to the server, maybe there is a firewall and whitelisting is needed. The server log should give you insight about this. 

answered
-1

Create a string variable first where you create the complete URL. This way you can double check if the URL is build up correctly by setting a breakpoint there. My guess is that the URL is not right. And double check if you provided the right credentials.

Regards,

Ronald

 

answered