Code studio Api Calls

Hi All,

I’m trying to create some functionality to retrieve data from an external API within Netcall’s code studio.

I am able to get data using rules to trigger api calls outside of the code studio, but this only works when a record has been created before triggering the api.

Is there a way in code studio to call an api without having to create a record within an object? I am also looking to populate my data object with the response payload.

Any help would be much appreciated.


Luke :slight_smile:

Hi Luke,

There are plenty of options if you have a record, but if you don’t then you will have to use cs.curl. Syntax is a bit tricky if you have not used before, but for a GET it should just be cs.curl(url) - and the returned value contains all the status information, plus your response. For a POST, its a bit trickier, so let us know if that is the case and I will find an example.


1 Like

Morning Luke,

I recommend you take a look at the Loqate Address Widget on the Appshare, that uses curl to make several api calls. Remember you will need to add the external domain to your firewall settings too.

Let me know how you get on, happy to help.

Many Thanks

1 Like

Hi Richard,

Examples of how to use cs.curl in the code studio would be perfect.

can we get examples for GET and POST?

Thanks :slight_smile:

Hi Adam,

Thanks for this, I will have a look :slight_smile:

Hi Luke,
As per Adams comment - see the example, but a quick sample:

const curl = mats.curl (url, “”,
{“verb”: “GET”, “headers” :{
“accept”: “application/json”,
“x-api-key”: widget.get_setting(“api_key”)}
if (curl.status != “success”) {
return {“status”:"Error - " + curl.status, “results”:[]};
The second parameter would be the body if you were doing a POST…(and changed the verb to POST)