Method: projects.getContent
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Lấy nội dung của dự án tập lệnh, bao gồm cả nguồn mã và siêu dữ liệu của từng tệp tập lệnh.
Yêu cầu HTTP
GET https://script.googleapis.com/v1/projects/{scriptId}/content
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số đường dẫn
Tham số |
scriptId |
string
Mã Drive của dự án tập lệnh.
|
Tham số truy vấn
Tham số |
versionNumber |
integer
Số phiên bản của dự án cần truy xuất. Nếu không được cung cấp, phiên bản HEAD của dự án sẽ được trả về.
|
Nội dung yêu cầu
Nội dung yêu cầu phải trống.
Nội dung phản hồi
Nếu thành công, phần nội dung phản hồi sẽ chứa dữ liệu có cấu trúc sau:
Biểu diễn dưới dạng JSON |
{
"scriptId": string,
"files": [
{
object (File )
}
]
} |
Trường |
scriptId |
string
Mã Drive của dự án tập lệnh.
|
files[] |
object (File )
Danh sách các tệp dự án tập lệnh. Một trong số các tệp này là tệp kê khai tập lệnh; tập lệnh đó phải được đặt tên là "appsscript", phải có loại JSON và chứa cấu hình tệp kê khai cho dự án.
|
Phạm vi cấp phép
Yêu cầu một trong các phạm vi OAuth sau:
https://www.googleapis.com/auth/script.projects
https://www.googleapis.com/auth/script.projects.readonly
Để biết thêm thông tin, hãy xem bài viết Tổng quan về OAuth 2.0.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-26 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-26 UTC."],[[["\u003cp\u003eRetrieves the content of a script project, including source code and metadata for each file.\u003c/p\u003e\n"],["\u003cp\u003eRequires providing the script project's Drive ID as a path parameter.\u003c/p\u003e\n"],["\u003cp\u003eOptionally, a version number can be specified to retrieve a specific project version; otherwise, the latest version is returned.\u003c/p\u003e\n"],["\u003cp\u003eThe response includes the script project's Drive ID and a list of files, with one being a JSON manifest named "appsscript".\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with specific scopes related to script projects.\u003c/p\u003e\n"]]],[],null,["# Method: projects.getContent\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.Content.SCHEMA_REPRESENTATION)\n- [Authorization Scopes](#body.aspect)\n- [Try it!](#try-it)\n\nGets the content of the script project, including the code source and metadata for each script file.\n\n### HTTP request\n\n`GET https://script.googleapis.com/v1/projects/{scriptId}/content`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|------------|-----------------------------------------|\n| `scriptId` | `string` The script project's Drive ID. |\n\n### Query parameters\n\n| Parameters ||\n|-----------------|-------------------------------------------------------------------------------------------------------------------|\n| `versionNumber` | `integer` The version number of the project to retrieve. If not provided, the project's HEAD version is returned. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains data with the following structure:\nThe Content resource.\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------|\n| ``` { \"scriptId\": string, \"files\": [ { object (/apps-script/api/reference/rest/v1/File) } ] } ``` |\n\n| Fields ||\n|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `scriptId` | `string` The script project's Drive ID. |\n| `files[]` | `object (`[File](/apps-script/api/reference/rest/v1/File)`)` The list of script project files. One of the files is a script manifest; it must be named \"appsscript\", must have type of JSON, and include the manifest configurations for the project. |\n\n### Authorization Scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/script.projects`\n- `https://www.googleapis.com/auth/script.projects.readonly`\n\nFor more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2)."]]