# 외부 서비스와 연동

> 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)하는 방법을 참고하십시오.
