대화형 작업이 2023년 6월 13일에 지원 중단되었습니다. 자세한 내용은
대화 작업 지원 중단을 참고하세요.
Actions API
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Actions API는 작업을 빌드, 관리, 테스트하는 데 도움이 되는 엔드포인트를 제공합니다.
클라이언트 라이브러리 (Node.js)
서버에 직접 HTTP 요청을 전송하여 Actions API RESTful 서비스를 사용할 수 있지만, 저희는 Node.js에서 엔드포인트에 더 쉽게 액세스할 수 있게 해주는 클라이언트 라이브러리를 제공합니다. Actions API 클라이언트 라이브러리를 사용하면 다양한 엔드포인트를 사용하여 작업을 관리하고 테스트할 수 있습니다.
예를 들어 아래 코드는 writePreview
엔드포인트를 호출하여 제공된 모델을 기반으로 사용자의 프로젝트 미리보기를 업데이트합니다.
import {ActionsSdkClient} from '@assistant/actions';
import { promisify } from 'util';
import * as stream from 'stream';
const PROJECT_ID = '<PROJECT_ID>';
const VERSION = 123;
const projectPath = `projects/${PROJECT_ID}`;
const versionPath = `projects/${PROJECT_ID}/versions/${VERSION}`;
async function publishPreview(projectPath, versionPath) {
const request = {
parent: projectPath,
previewSettings: {sandbox: {value: true}},
submittedVersion: {version: versionPath}
};
const client = new ActionsSdkClient();
const stream = client.writePreview(()=>{});
stream.write(request);
stream.end();
const finished = promisify(stream.finished);
await finished(stream);
}
Actions API Node.js 클라이언트 라이브러리의 설치 안내 및 참조 자료는 라이브러리 및 Actions API REST 참조 문서를 확인하세요.
요구사항
Actions API에 대한 요청에는 다음 요구사항이 적용됩니다.
요청 페이로드 크기
Actions API에 대한 요청은 10MB 이하여야 합니다. 여기에는
클라이언트 스트리밍 엔드포인트(스트림의 각 요청은 10MB여야 함)
합니다.
페이로드가 10MB를 초과하면 작업으로부터 400
오류가
SDK 서버에서 실행됩니다.
권장사항
다음 권장사항은
Actions API를 사용합니다
사용자를 위한 도구나 애플리케이션을 만들 때 사용자의
요금이 청구되고 할당량 한도에서 사용되는 프로젝트입니다.
결제 및 할당량 목적으로 프로젝트를 지정하려면
x-goog-user-project
요청 헤더.
유효한 값 |
기존 프로젝트의 프로젝트 ID입니다.
Google Cloud 프로젝트 |
예 |
x-goog-user-project: my-project |
세부정보 |
헤더에 지정된 프로젝트가 할당량 한도에 사용되며 요금이 청구됩니다.
요청 관련 요금에 대한
액세스를 제공합니다
|
user-agent
요청 헤더를 사용하여 적절한 사용자 에이전트를 설정합니다. 이
API는 파트너가 요청을 보냈는지 확인하는 데 도움이 됩니다.
알려진 제한사항
이 섹션에서는 Actions API의 알려진 제한사항을 설명합니다.
클라이언트 스트리밍 엔드포인트 제한 시간
이 제한은 클라이언트 스트리밍에 전송하는 HTTP 요청에만 적용됩니다.
엔드포인트가 있습니다 클라이언트 라이브러리를 사용하여 실행한 요청은
영향을 받을 수 있습니다
HTTP 요청을 사용하여 WritePreview
, CreateVersion
또는 WriteDraft
를 호출하는 경우
시간 제한을 구현하여
있습니다.
200
이외의 상태 코드를 지정하는 응답 헤더를 받으면
일정 시간이 지나면 스트림이 종료되어야 합니다. 이 권호
클라이언트 스트리밍 엔드포인트에만 영향을 미칩니다 예를 들어 gactions
도구는
5초의 제한 시간이 있습니다
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-26(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-26(UTC)"],[[["\u003cp\u003eThe Actions API offers endpoints for building, managing, and testing Actions.\u003c/p\u003e\n"],["\u003cp\u003eA Node.js client library simplifies interactions with the API, offering easier access to endpoints for managing and testing your Action.\u003c/p\u003e\n"],["\u003cp\u003eRequests to the Actions API must be 10 MB or less, including those made to client streaming endpoints.\u003c/p\u003e\n"],["\u003cp\u003eSetting the \u003ccode\u003ex-goog-user-project\u003c/code\u003e request header enables billing and quota management for user projects.\u003c/p\u003e\n"],["\u003cp\u003eWhen using HTTP requests with client streaming endpoints like \u003ccode\u003eWritePreview\u003c/code\u003e, it's recommended to implement a timeout to handle potential unsuccessful requests.\u003c/p\u003e\n"]]],["The Actions API facilitates Action development, management, and testing. A Node.js client library simplifies interaction with API endpoints. For instance, `writePreview` updates a project preview. Requests must be under 10MB, with the `x-goog-user-project` header recommended for billing and quota purposes. The `user-agent` header is advised for partner identification. Direct HTTP calls to streaming endpoints like `WritePreview` have timeout considerations, though the client library mitigates this.\n"],null,["# Actions API\n\nThe Actions API provides endpoints to help build, manage, and test your Action.\n\nClient Library (Node.js)\n------------------------\n\nWhile you can use the Actions API RESTful service by making direct HTTP requests to the server, we provide a client library that makes it easier to access the endpoints from Node.js. The [Actions API client library](https://github.com/actions-on-google/assistant-actions-nodejs) allows you to manage and test your Action using a variety of endpoints.\n\nFor example, the code below makes a call to the [`writePreview`](/assistant/actions/api/reference/rest/v2/projects.preview/write) endpoint to update a user's project preview based on the provided model: \n\n import {ActionsSdkClient} from '@assistant/actions';\n import { promisify } from 'util';\n import * as stream from 'stream';\n\n const PROJECT_ID = '\u003cPROJECT_ID\u003e';\n const VERSION = 123;\n\n const projectPath = `projects/${PROJECT_ID}`;\n const versionPath = `projects/${PROJECT_ID}/versions/${VERSION}`;\n\n async function publishPreview(projectPath, versionPath) {\n const request = {\n parent: projectPath,\n previewSettings: {sandbox: {value: true}},\n submittedVersion: {version: versionPath}\n };\n\n const client = new ActionsSdkClient();\n const stream = client.writePreview(()=\u003e{});\n stream.write(request);\n stream.end();\n const finished = promisify(stream.finished);\n await finished(stream);\n }\n\nFor installation instructions and reference material for the Actions API Node.js client library, see the [library](/assistant/actions/api/(https:/github.com/actions-on-google/assistant-actions-nodejs)) and [Actions API REST reference](/assistant/actions/api/reference/rest) documentation.\n\nRequirements\n------------\n\nThe following requirements apply to requests made to the Actions API.\n\n### Request payload size\n\nRequests made to the Actions API must be 10 MB or less. This includes\nclient streaming endpoints, where each request in the stream must be 10 MB\nor less.\n\nIf your payload exceeds 10 MB, you should receive a `400` error from the Actions\nSDK server.\n\nBest practices\n--------------\n\nThe following best practices are strongly recommended when\nyou use the Actions API.\n\n### Set the x-goog-user-project request header\n\nWhen building a tool or application for your users, you may want a user's\nproject to be billed and used for quota limits, rather than your client project.\nTo specify a project for billing and quota purposes, set the\n`x-goog-user-project` request header.\n\n|--------------|------------------------------------------------------------------------------------------------------------------|\n| Valid Values | The [Project ID](/docs/overview#projects) for an existing Google Cloud project |\n| Example | `x-goog-user-project: my-project` |\n| Details | The project specified in the header is used for quota limits and billed for charges associated with the request. |\n\n### Set the user-agent request header\n\nSet an appropriate user agent using the `user-agent` request header. This\nhelps the API determine if requests originate from partners.\n\nKnown limitations\n-----------------\n\nThis section describes known limitations of the Actions API.\n\n### Timeout for client streaming endpoints\n\nThis limitation only applies to HTTP requests you make to client streaming\nendpoints. Requests made using the [client library](#client-library) are not\naffected by this limitation.\n\nIf you are using HTTP requests to call `WritePreview`, `CreateVersion`, or `WriteDraft`, we\nrecommend that you implement a timeout to handle requests that are not\nsuccessful.\n\nIf you receive a response header that specifies a status code other than `200`,\nyour code should terminate the stream after a certain period of time. This issue\nonly affects client streaming endpoints. For example, the `gactions` tool,\nwhich uses the Actions API, has a 5-second timeout."]]