Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Avant de commencer à coder votre première application cliente, vous devez suivre quelques étapes (si ce n'est déjà fait).
Obtenir un compte Google
Vous devez disposer d'un compte Google pour pouvoir accéder à Compute Engine depuis la console d'API Google. Si vous avez déjà un compte, vous êtes prêt.
Vous pouvez également créer un compte Google distinct à des fins de test.
S'inscrire au service Compute Engine et l'essayer
Pour commencer, vous pouvez créer une instance de VM sur Compute Engine à l'aide de l'un des guides suivants :
Il est important de vous familiariser avec les notions de base relatives à Compute Engine avant de continuer.
Dans la documentation de l'API, nous partons du principe que vous avez utilisé Compute Engine et que vous connaissez les concepts de programmation Web ainsi que les formats de données Web.
Obtenez plus d'informations sur l'authentification.
Il existe différentes façons de s'authentifier auprès de Compute Engine selon la manière dont vous accédez à l'API. Pour en savoir plus, consultez la page S'authentifier auprès de Compute Engine.
Si vous décidez de ne pas utiliser de bibliothèques clientes, vous devez comprendre les bases de l'architecture REST.
REST est un style d'architecture logicielle qui permet de demander et modifier des données de manière pratique et cohérente.
Le terme REST est l'acronyme de REpresentational State Transfer. Dans le contexte des API Google, il désigne l'architecture utilisant des verbes HTTP pour récupérer et modifier les représentations des données stockées par Google.
Dans un système RESTful, les ressources sont stockées dans un datastore. Un client envoie une requête pour que le serveur exécute une action spécifique (par exemple la création, l'extraction, la mise à jour ou la suppression d'une ressource), et le serveur exécute l'action et envoie une réponse, souvent sous la forme d'une représentation de la ressource spécifiée.
Dans les API RESTful de Google, le client spécifie une action à l'aide d'un verbe HTTP comme POST, GET, PUT ou DELETE. La ressource est désignée par un URI unique au format suivant :
Étant donné que toutes les ressources d'API possèdent des URI uniques accessibles via HTTP, REST permet la mise en cache des données, et son fonctionnement est optimisé pour l'infrastructure distribuée du Web.
Les définitions de méthode figurant dans la documentation du standard HTTP 1.1 peuvent s'avérer utiles, car elles incluent les spécifications pour GET, POST, PUT, et DELETE.
REST dans l'API Compute Engine
Les opérations de l'API Compute Engine correspondent exactement aux verbes HTTP REST.
Les formats spécifiques des URI de l'API Compute Engine sont les suivants :
L'API Compute Engine renvoie des données au format JSON.
JSON (JavaScript Object Notation) est un format de données qui ne dépend pas d'un langage et qui fournit une représentation textuelle simple de structures de données arbitraires. Pour en savoir plus, accédez à json.org.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/05/29 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/05/29 (UTC)."],[[["\u003cp\u003eA Google Account is required to access Compute Engine in the Google APIs Console, and you may want a separate one for testing.\u003c/p\u003e\n"],["\u003cp\u003eYou can create either a Linux or Windows VM instance to get started with Compute Engine, which is recommended for familiarization before using the API.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication to Compute Engine varies depending on your method of API access, and details can be found in the documentation provided.\u003c/p\u003e\n"],["\u003cp\u003eThe Compute Engine API can be invoked through HTTP requests or by using client libraries, and using HTTP requests requires an understanding of REST principles.\u003c/p\u003e\n"],["\u003cp\u003eThe Compute Engine API uses RESTful architecture, with operations mapping directly to HTTP verbs, and the API returns data in JSON format.\u003c/p\u003e\n"]]],[],null,["# Prerequisites\n\nThis document explains the prerequisites for using the Compute Engine API.\n\nBefore you can start coding your first client application, there are a few things you need to do,\nif you haven't done them already.\n\nGet a Google Account\n--------------------\n\nYou need a [Google Account](https://www.google.com/accounts/NewAccount) to access the\nCompute Engine API. If you have an existing account, then you already have access.\n\nYou may also want a separate Google Account for testing purposes.\n\nSign up and try out Compute Engine\n----------------------------------\n\nTo get started, you can create a VM instance on Compute Engine by using one of the\nfollowing guides:\n\n- [Create a Linux VM](/compute/docs/create-linux-vm-instance)\n- [Create a Windows VM](/compute/docs/create-windows-server-vm-instance)\n\nBefore you continue, it's important to become familiar with Compute Engine. The API\ndocumentation assumes that you have used Compute Engine and you're familiar with web\nprogramming concepts and web data formats.\n\nLearn about authentication\n--------------------------\n\nThere are different ways to authenticate to Compute Engine depending on how you access\nthe API. For more information, see\n[Authenticate to Compute Engine](/compute/docs/authentication).\n\nLearn about REST\n----------------\n\nThere are two ways to invoke the API:\n\n- Sending HTTP requests and parsing the responses.\n- Using [client libraries](/compute/docs/api/libraries).\n\nIf you decide not to use client libraries, you'll need to understand the basics of REST.\n\n### REST basics\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`.\n\n### REST in the Compute Engine API\n\nThe Compute Engine API operations map directly to REST HTTP verbs.\n\nThe Compute Engine API uses the following format for URIs: \n\n```scdoc\nhttps://www.googleapis.com/compute/API_VERSION/RESOURCE_PATH\n```\n\nThe URI contains the following values:\n\n- \u003cvar translate=\"no\"\u003eAPI_VERSION\u003c/var\u003e: the API version that you want to use, which corresponds to the [launch stage](/products#product-launch-stages) of a Compute Engine resource as follows:\n - For resources in GA: `v1`\n - For resources in Public Preview: `beta`\n - For resources in Private Preview: `alpha`\n- \u003cvar translate=\"no\"\u003eRESOURCE_PATH\u003c/var\u003e: the path to the specific Compute Engine resource---for example, `projects/example-project/aggregated/instances`. To see available resources for each API version, see the following:\n - [Compute Engine API v1](/compute/docs/reference/rest/latest)\n - [Compute Engine API beta](/compute/docs/reference/rest/beta)\n - [Compute Engine API alpha](/compute/docs/reference/rest/alpha) ([Preview](/products#product-launch-stages))\n\n\u003cbr /\u003e\n\nIf you want to include query parameters, then include them in the URI after a question mark\n(`?`): \n\n```scdoc\nhttps://www.googleapis.com/compute/API_VERSION/RESOURCE_PATH?\u003cvar translate=\"no\"\u003eQUERY_PARAMETERS\u003c/var\u003e\n```\n\nIn the URI, \u003cvar translate=\"no\"\u003eQUERY_PARAMETERS\u003c/var\u003e is a list of query parameters, separated by ampersands\n(`&`)---for example,\n`format=json`**&**`filter=zone=us-central1-a`.\n\nLearn about the JSON data format\n--------------------------------\n\nThe Compute Engine API returns data in JSON format.\n\n\n[JSON](http://en.wikipedia.org/wiki/JSON) (JavaScript Object Notation) is a common, language-independent data format that provides a simple text representation of arbitrary data structures. For more information, see [json.org](http://www.json.org/).\n\n\u003cbr /\u003e"]]