Ragic record JSon data in a URL inside Ragic

Hi,

I’m developing a nice tool for the Ragic community :wink: so please help me as I am so close making this live. I am not a developer so please can someone help me with a simple solution.

I need to send Ragic API data to another solution by having a URL in a Ragic record form.
What I need is the following:

  1. Inside a Ragic record the user click a URL link which I create using the URL field type or a formula field, not sure this is where I need help.

  2. When the user clicks the URL link it sends the JSon data to another app. Below is an example of the URL I need in Ragic:
    https://othersite.com/api/GetInfo?info={
    “_ragicId”: 0,
    “_star”: false,
    “Name”: “E-00001”,
    “StartDateTime”: “2017/12/31 13:00:00”,
    index_calDates”: “d2000466 2017/12/31 13:00:00 d2000467 2018/01/01 14:00:00”,
    “EndDateTime”: “2018/01/01 14:00:00”,
    “CreatorEmail”: "RagicSolutions@gmail.com",
    “Timezone”: “Africa/Johannesburg”,
    “TimezoneOffset”: “+0200”,
    “Status”: “Test Status”,
    “url”: “2020-04-01T09:00:00.000Z”,
    “Summary”: “New Year Countdown Party”,
    index_title”: “New Year Countdown Party”,
    “Location”: “106, Taipei City, Da\u2019an District”,
    “Description”: “Test description for event”,
    “Priority”: “0”,
    index”: “”,
    “_seq”: 2
    }

  3. I can get the data by https://www.ragic.com/RSDemo/ragicnew-tab/1?api&listing&where=2000463,eq,E-00002 then I need that DATA at the end of the URL https://othersite.com/api/GetInfo?info= created in the Ragic form.

So how can I get the result of point 3 above into the URL in the Ragic form in point 2 above?

Thanks so much for your help.

Rather than sending this through a URL link action button, I would suggest you send the request via Javascript Workflow URL call. This type of JS script can also be triggered by an action button, but is generally a better way to handle API calls to another application.

1 Like

I can get the JSon using var res = util.getURL(
but then how do I use the res in the URL action. I would need to call getURL, set a linkField in the form with the value from res, and then use the URL action to open that linkField URL.

The problem is the sequence of events. I would need to run the JS var res = util.getURL(… as the record is opened to that linkField is already set for when the user clieck the URL action button.

Is there a way to call somethign like window.open with res ?

Thanks

I find response.addOpenURL(“http://www.google.com”); but the follwing does not work.

response.addOpenURL(“https://ragictest.azurewebsites.net/api/GetIcalendar?event= { ‘_ragicId’: 1, ‘Name’: ‘E-00002’, ‘StartDateTime’: ‘2020/05/22 09:00:00’, ‘index_calDates’: ‘d2000466 2020/05/22 09:00:00 d2000467 2020/05/22 11:00:00’, ‘EndDateTime’: ‘2020/05/22 11:00:00’, ‘CreatorEmail’: ‘stephen@stephengroenewald.com’, ‘Timezone’: ‘Africa/Johannesburg’, ‘TimezoneOffset’: ‘+0200’, ‘Status’: ‘Busy’, ‘url’: ‘2020-04-01T09:00:00.000Z’, ‘Summary’: ‘New Year Countdown Party’, ‘index_title’: ‘New Year Countdown Party’, ‘Location’: ‘106, Taipei City, Da\u2019an District’, ‘Description’: ‘Another test description’, ‘Priority’: ‘0’, ‘index’: ‘’, ‘_seq’: 1}”);

Thanks

You’re confusing server-side calls with client-side Javascript calls. When you call a URL with Javascript Workflow, the Ragic server is the one doing the call to your API. When you call a URL with action button, the user’s browser is doing the call to the API.

As a general rule, when you call an API, you should use server-side calls when possible (with Javascript Workflow). Because if you do client side calls through the user’s browser, you will run into many security issues that browser has implemented to avoid cross site attacks. Many things like opening a new tab window or doing any type of custom scripting on the client’s browser will most likely be blocked for security reasons.