Bạn đang xem tài liệu cũ về API Thư viện Google Photos.
Giới thiệu về API RESTful
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.
REST là một kiểu kiến trúc phần mềm mang lại cách tiếp cận thuận tiện và nhất quán để yêu cầu và sửa đổi dữ liệu.
Thuật ngữ REST là viết tắt của "Đại diện chuyển trạng thái". Trong ngữ cảnh của API Google, nó đề cập đến việc sử dụng các động từ HTTP để truy xuất và sửa đổi bản trình bày dữ liệu do Google lưu trữ.
Trong hệ thống RESTful, các tài nguyên được lưu trữ trong một kho dữ liệu; ứng dụng gửi yêu cầu mà máy chủ thực hiện một hành động cụ thể (chẳng hạn như tạo, truy xuất, cập nhật hoặc xoá tài nguyên), sau đó máy chủ thực hiện hành động đó và gửi phản hồi, thường ở dạng biểu diễn tài nguyên được chỉ định.
Trong API RESTful của Google, ứng dụng chỉ định một hành động bằng cách sử dụng động từ HTTP như POST
, GET
, PUT
hoặc DELETE
. Phương thức này chỉ định tài nguyên bằng một URI duy nhất trên toàn hệ thống có dạng sau:
https://www.googleapis.com/apiName/apiVersion/resourcePath?parameters
Vì mọi tài nguyên API đều có URI riêng biệt có thể truy cập HTTP, nên REST cho phép lưu dữ liệu vào bộ nhớ đệm và được tối ưu hoá để hoạt động với cơ sở hạ tầng phân phối của web.
Bạn có thể thấy định nghĩa về phương thức trong tài liệu về các tiêu chuẩn HTTP 1.1 hữu ích; chúng bao gồm thông số kỹ thuật cho GET
, POST
, PUT
và DELETE
.
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-08-29 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-29 UTC."],[[["\u003cp\u003eREST is an architectural style for exchanging data using standard HTTP methods like \u003ccode\u003eGET\u003c/code\u003e, \u003ccode\u003ePOST\u003c/code\u003e, \u003ccode\u003ePUT\u003c/code\u003e, and \u003ccode\u003eDELETE\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eGoogle APIs implement REST, allowing clients to interact with Google's data by sending HTTP requests to specific resource URIs.\u003c/p\u003e\n"],["\u003cp\u003eRESTful systems rely on unique URIs for resources, enabling efficient caching and leveraging web infrastructure.\u003c/p\u003e\n"],["\u003cp\u003eClients request actions on data stored by the server, which then performs the action and responds, often with a representation of the resource.\u003c/p\u003e\n"]]],["REST is a software architecture style employing HTTP verbs to interact with data. Clients send requests to servers to perform actions like creating, retrieving, updating, or deleting resources. Resources are identified by unique URIs, structured as `https://www.googleapis.com/apiName/apiVersion/resourcePath?parameters`. The server executes the requested action and responds. Common HTTP verbs used include `POST`, `GET`, `PUT`, and `DELETE`, defining the specific action. This structure supports data caching and is optimized for web infrastructure.\n"],null,["# About RESTful APIs\n\nREST is a style of software architecture that provides a convenient and consistent approach to requesting and modifying data.\n\nThe term REST is short for \"[Representational State Transfer](https://en.wikipedia.org/wiki/Representational_state_transfer).\" In the context of Google APIs, it refers to using HTTP verbs to retrieve and modify representations of data stored by Google.\n\nIn a RESTful system, resources are stored in a data store; a client sends a request that the server perform a particular action (such as creating, retrieving, updating, or deleting a resource), and the server performs the action and sends a response, often in the form of a representation of the specified resource.\n\nIn Google's RESTful APIs, the client specifies an action using an HTTP verb such as `POST`, `GET`, `PUT`, or `DELETE`. It specifies a resource by a globally-unique URI of the following form: \n\n```\nhttps://www.googleapis.com/apiName/apiVersion/resourcePath?parameters\n```\n\nBecause all API resources have unique HTTP-accessible URIs, REST enables data caching and is optimized to work with the web's distributed infrastructure.\n\nYou may find the [method definitions](https://tools.ietf.org/html/rfc7231#section-4.3) in the HTTP 1.1 standards documentation useful; they include specifications for `GET`, `POST`, `PUT`, and `DELETE`."]]