call APIR REST. Help..

  • Last Post 21 December 2020
OLAYA HERRERA posted this 05 December 2020

Hi. I have a workflow which works correctly but at the end of the process I need a tr_SCRIPT to call or query a rest API, no need to wait for an answer, just call it. I have done many methods always with errors, I do not know if I am doing something wrong. I have tried JavaScript and VBScript without success.

This method does not show signs of errors in the log, but when processing it, it does not consult the api, I have tried several methods without success, I only need to consult the url shown in the image using javascript or vbscript, I have tried various javascript methods it always gives me errors even with the simplest code. please i need your help if anyone has done this before.




Order By: Standard | Newest | Votes
OLAYA HERRERA posted this 07 December 2020

Another Example JS.


luigi.zurolo posted this 08 December 2020

Hi OIaya,

you can see the error very clear written in the logs, the fetch function isn't defined. Fetch is a specific client browser function and not available of course in a service, you should be using other methods such as JS.NET.

Please consider also that async operations are not suggested as the execution is unexpected, the process service performs everything in a synchronous way and will return from the script once finished (reached the end), if the script process is interrupted the async operation might get also cancelled according the specific timing it requires and you can never be sure it always get executed also if you don't need to wait the result.


OLAYA HERRERA posted this 19 December 2020

hello, but in vbscript also gives me errors, do you have any idea where i can find examples of how to simply call the url?

luigi.zurolo posted this 21 December 2020

Hello Olaya,

this is an operation which is quite a tricky one, whatever you use JS or VBS. As said the process is sync and it needs to wait and close script execution, when done the script will be ended which means any pending call will be terminated at no expected status, and this produces a possible error which should be avoided.

Assuming what written about sync/async, for VBS you should check if XMLHTTP is available, maybe depending on the version you won't find that COM object and that's why VBS crashes, maybe you have Msxml2.XMLHTTP rather than Microsoft.XMLHTTP if you copied that from the internet.

For JS please have a look at the possibilities in JS.NET (CLR), but once again, this is not a very good practice to do during the processing.