Consume arbitrary external REST API to display in low-code Page?

Hello there,

As the title asks, is it possible to display in a low-code developed Page (for example with a Block of Record List) data that was fetched from an external (arbitrary) REST Api instead of using internal data of Corteza ? If not is there any “non-official” way to do so?

(Alternatively possibly also, is it possible to connect to an arbitrary database and its data ?)

Thank you very much for any explanation.

1 Like

@Fabio thank you for creating this
I really interested in the answer

in my case:
since corteza doesn’t support nested records links
it’s hard/can’t display a list in the records-list
for example:
I have a customer model that has many orders
also, I have a telesales-call which will call the customer on monthly bases
so both the order module and telesale_call module are linked to the customer

now, I want to show/display the orders of that customer in the telesales-call so they can see what’s the orders for that customer
I couldn’t achieve this even with messy workflows!

appreciate any input

With current versions, you would need to create a module in Corteza and then either use our automation to pull in the data, or use an integration gateway to push in the data as a record of that module.

We are, however, working on some interesting features that would enable us to support things like having external APIs as data sources – v1 would be available with the 2022.9 release.

You could add an additional reference to the order module which would point to the corresponding telesale_call module and filter orders based on that.

Alternativelly, if the telesale_call record has a reference to the customer you should be able to filter over records for the given customer with a simple prefilter.

1 Like

This is a really interesting feature that allow for example to use corteza as customer portal for any CRM solution without import data! Or a wide range of other possible applications!

@tjerman for the second option: yes the telesale_call has a reference to the customer.
I’m not sure how to reference the fields

could you please provide me with the query?
here are the fields

  • Customer module > customer_id
  • Order module > order_id, customer_id
  • telesale_call module > call_id, customer_id

thanks

In the record page for the call module, I’ve added a record list for the orders module with the prefilter of customer = '${record.values.customer}' – show all orders where the customer matches the customer of current call.

The output on the record page for my customer is:

All registered orders are:

Hope this helps

thank you very much @tjerman, will try it as soon as I get back to the office
is this allowed? which version?
I’m still using 2021.9

It should work there as well yes

1 Like

hey @tjerman, finally it worked … not I’ll stop a lot of automation just for copying and pasting the records ids … thank you so much

I wonder what’s the available list of variables can be used inside the pre-filters?
I may wanna do a complex dashboard and may need some kind of nested equality or aggregation

1 Like

Here is the source code for prefilter evaluation; so you can use:

  • record
  • recordID
  • ownerID
  • userID

And the source code for Record type definition.

I hope you can make sense of these references; I’ll see how we can improve the docs in regards to this.

1 Like

In regards to nested filters and pre-filters – those can’t be done (yet).
We’re doing a rework of how data is stored/accessed so we might do some improvements in the next release 2022.9.

Until nested querying is supported, what we usually do (when we need to access some related data) is we define a workflow that coppies some fields from the child record into the parent records (the fields we wish to query over).

1 Like

@tjerman thank you so much, really valuable inputs as usual :heart:

1 Like

Hello!

I have a question pertaining to this piece:

Is there a way to handle oAuth for an external 3rd party API. I have the Client ID + Secret but I am not sure how to handle the oAuth 2.0 access token flow and refresh tokens that are provided via Corteza.

I am specifically looking to pull data from this API:
Zoho Inventory API / oAuth

Thanks!

The provided link indicates you’d use authorization code grant type; can you configure it to use client credentials? There currently isn’t anything built-in which would allow you to collect access tokens for an external service using an authorization code.

I did need to connect to an external service via authorization code grant type and this is what I’ve done:

  • define a client script which redirects to the external services auth page
  • define a sink endpoint to which the external service redirects to; the sink endpoint fetches the access token
  • the sink endpoint saves the access token to some settings module.

Here is the code from when we needed this – corteza-ext/docusign at 2021.9.x · cortezaproject/corteza-ext · GitHub

This is really helpful - let me try it out and see if it works. Thanks!

@tjerman ,

Did this make it into the 2022.9 release? If not, do you know when to expect it to get added?

@tjerman can you update about this topic? Seems its not yet possibile have external api as data source?

1 Like

Hello TomaĹľ (@tjerman) !

Do you have any examples of how to create this module in Corteza and use automation to extract and display the data in the module?

We have a similar use case for this thread, where we need to get billing data through its APIs and display it in Corteza (only display in a module without store it on Corteza).

Best regards
Ricardo