# 外部サービスとのインテグレーション

> Call public internet endpoints and public APIs from your Cloud Code scripts.

Cloud Code では、UGS の一部であり [公開 API](https://services.docs.unity.com/cloud-code/v1) など、パブリックインターネットエンドポイントを呼び出すことができます。

以下の例は、[Cat Facts API](https://catfact.ninja/#/facts/getrandomfact) を呼び出してランダムなネコの豆知識を取得します。

###### JavaScript##javascript

```js
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;
  }
};
```

詳細については、[他の Unity サービスとのインテグレーション](./unity-services-integration.md) を参照してください。
