外部サービスとのインテグレーション
Call public internet endpoints and public APIs from your Cloud Code scripts.
読み終わるまでの所要時間 1 分最終更新 23日前
Cloud Code では、UGS の一部であり 公開 API など、パブリックインターネットエンドポイントを呼び出すことができます。 以下の例は、Cat Facts API を呼び出してランダムなネコの豆知識を取得します。
JavaScript
詳細については、他の Unity サービスとのインテグレーション を参照してください。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; }};