Currently I have a function that calls a webhook and returns a stringified json:
@Query()
public async getCollegeInfo(state_name : string, min_student : Integer, max_student: Integer): Promise<string> {
try {
const response = await GetCollegeData.webhooks.FetchCollegeData.call({
min_size : min_student,
max_size : max_student,
school_state : resolveState(state_name)
});
//console.log(JSON.stringify(response))
//console.log(JSON.stringify(response, null, 2));
return (JSON.stringify(response));
} catch (error) {
console.error("Error fetching college information:", error);
throw new Error("Failed to fetch college information");
}
}
I the webhook calls an api that returns a json. Then the webhook parses this output into a list of records. Then when I call this webhook in the function, i return the data as a stringified json. I initially did this to test if the function was working and now that the function is working I am wondering what is the best way to return the data so I can integrate in other AIP apps. For instance, I am currently trying to display the data in a widget in workshop.