diff --git a/snippets/functions/api-functions/api_callExternalAPI.js b/snippets/functions/api-functions/api_callExternalAPI.js new file mode 100644 index 0000000..19f0d42 --- /dev/null +++ b/snippets/functions/api-functions/api_callExternalAPI.js @@ -0,0 +1,9 @@ +exports = async function(arg){ + const url = "https://api.stackexchange.com/2.3/answers?key=U4DMV*8nvpm3EOpvf69Rxw((&site=stackoverflow&page=1&pagesize=10&order=desc&sort=activity&filter=default"; + + const response = await context.http.get({ url: url }) + // The response body is a BSON.Binary object, so parse it: + const result = EJSON.parse(response.body.text()) + // console.log(JSON.stringify(result)); + return result; +} \ No newline at end of file