Documentation

Support

Integrate with external services

Call public internet endpoints and public APIs from your Cloud Code scripts.
Read time 1 minuteLast updated 18 hours ago

With Cloud Code, you can call out to any public internet endpoint, including the public APIs that are a part of UGS. The following example demonstrates how to call out to a Cat Facts API to get a random cat fact.
JavaScript
const axios = require("axios-0.21");module.exports = async ({ params, context, logger }) => { let result; try { const catFactUrl = `https://catfact.ninja/fact`; result = await axios.get(catFactUrl); return result.data; } catch (err) { logger.error("Failed to call out to Cat Facts", {"error.message": err.message}); throw err; }};
For more information, learn how to integrate with other Unity services.

Integrate with external services • Cloud Code • Unity Docs