Cloud Code API 호출
Invoke scripts by making HTTP requests to the Cloud Code REST API.
읽는 시간 1분최근 업데이트: 한 달 전
스크립트를 실행하려면 Cloud Code API를 호출합니다. 자세한 내용은 Cloud Code API 기술 자료를 참고하십시오.
인증
서비스 계정이나 상태 비보존 토큰을 사용하여 플레이어 또는 신뢰할 수 있는 클라이언트로 인증하려면 인증을 참고하십시오. 받은 토큰을 요청 헤더에서 HTTP 인증을 위한 bearer 토큰으로 사용합니다.Authorization: Bearer <BEARER_TOKEN>
스크립트 요청 실행
POST 요청을 다음으로 보내 Cloud Code API를 호출합니다.다음과 같이 경로 파라미터를 정의합니다.https://cloud-code.services.api.unity.com/v1/projects/<PROJECT_ID>/scripts/<SCRIPT_NAME>
- - 프로젝트 ID입니다.
projectId - - 스크립트 이름입니다.
scriptName
curl --request POST 'https://cloud-code.services.api.unity.com/v1/projects/<PROJECT_ID>/scripts/<SCRIPT_NAME>' \--header 'Content-Type: application/json' \--header 'Authorization: Bearer <BEARER_TOKEN>'
요청 페이로드
스크립트에서 파라미터를 정의할 수 있습니다. 이러한 파라미터는 요청 본문에서 전달됩니다. 스크립트에 파라미터가 없는 경우 빈params완전한 cURL 커맨드는 다음과 같습니다.{ "params": { "numericParam": 123, "stringParam": "abcdef", "booleanParam": true, "jsonParam": { "key": "value" } }}
curl --request POST 'https://cloud-code.services.api.unity.com/v1/projects/<PROJECT_ID>/scripts/<SCRIPT_NAME>' \--header 'Content-Type: application/json' \--header 'Authorization: Bearer <BEARER_TOKEN>' \--data-raw '{"params": { "numericParam": 123, "stringParam": "abcdef", "booleanParam": true, "jsonParam": { "key": "value" }}}'
샘플 출력
다음은playerInfo{ "output": { "playerInfo": { "playerID": "TestUser", "userName": "TestUserName", "displayName": "Name", "email": "test@test.com", "country": null, "deviceType": null, "platform": "IOS", "dateCreated": "string" } }}