How can we call API inside the function?

Hi Team,

  1. How can I call API with GET url inside function (i.e inside the code part of any function) ?
  2. Is this possible to call one function from other function inside the code part and if so, how ?

can someone help.

1 Like

Hi,

I used this link:

to understand everything about API integration during building my bot …

Please see if this link solves your query…

Best
Shagun

1 Like

Thanks, @Shagun for helping fellow community members. :tada:

Thanks @Shagun for sharing the Link, I referred that and still my query is not solved
My question was,

  1. I need to call any API inside any function of code section, how to achieve this?
    // function:
    user() {
    // I need to call one API here…( I have an api called employee_api in my yellow.ai API section with the required url and parameter)
    return;
    }

  2. How to call another function inside from one function ? I have added small code snippet below and this was my query. How can I achieve this in yellow.ai code section ?

// Main function:
user_details() {
let user = [] ;
// code is here…
user = this.employer_detail();
return user;
}

//other function:
employer_detail() {
let employer = [];
// code is here…
return employer;
}

can someone help me for both of this queries.

1 Like

Hey Pandian,

The purpose of a function is to implement complex logic which is not possible with Builder. Since we already have nodes to invoke API or execute functions, it’s not allowed to call an API or call another function inside a function.

I’m interested to know more about your use case though. You can share it here or drop me an email at pratik@yellow.ai.