{"fault":{"faultstring":"Failed to resolve API Key variable request.queryparam.apikey",
"detail":{"errorcode":"steps.oauth.v2.FailedToResolveAPIKey"}}}
API キーを取得するには、helloworld API を含む API プロダクトを作成した後、デベロッパーを作成してそれを API プロダクトに登録する必要があります。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-08-18 UTC。"],[[["\u003cp\u003eThis guide outlines how to deploy an API archive to an Apigee environment after local development and testing in VS Code, applicable to both Apigee and Apigee hybrid.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves creating a new 'dev' environment in your Apigee organization, enabling 'Archive' as the deployment type, and attaching this environment to a runtime instance and environment group.\u003c/p\u003e\n"],["\u003cp\u003eAfter creating the environment, you deploy the API proxy configuration archive to the newly created environment using the \u003ccode\u003egcloud beta apigee archives deploy\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eYou will need to create an API product, a developer, and register an app in order to obtain an API key to successfully test the deployed API.\u003c/p\u003e\n"],["\u003cp\u003eAfter testing the deployment with an API key, you can use this new flow for promoting the API archive to an Apigee production environment.\u003c/p\u003e\n"]]],[],null,["*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\n\u003cbr /\u003e\n\nAfter you complete local development and testing with Apigee in VS Code, you are ready to deploy your API as an archive to an Apigee\nenvironment. In this step, you'll create an Apigee environment that supports archive deployment and deploy an archive of your API proxy configuration to the Apigee environment.\n| **Before you begin** : Install Google Cloud SDK and the `gcloud beta apigee` component, as described in [Getting started using gcloud with Apigee](/apigee/docs/api-platform/get-started/gcloud-get-started).\n\n1. Follow the steps in [Create an environment](https://cloud.google.com/apigee/docs/api-platform/get-started/install-cli#create-environment) to perform the following:\n 1. Create a new **dev** environment in your Apigee organization, enabling **Archive** as the deployment type. Use the [UI](https://cloud.google.com/apigee/docs/api-platform/fundamentals/environments-working-with#creating-a-new-environment-in-the-ui) or [API](/apigee/docs/reference/apis/apigee/rest/v1/organizations.environments/create).\n 2. Attach the environment to a runtime instance using the [Instances attachment API](/apigee/docs/reference/apis/apigee/rest/v1/organizations.instances.attachments).\n\n\n This command triggers a long-running operation. Ensure that the environment has been attached to the runtime before continuing.\n 3. Create an environment group if you do not already have one using the [Create environment groups API](/apigee/docs/reference/apis/apigee/rest/v1/organizations.envgroups/create).\n\n\n Ensure that the environment group has been created before continuing. You can check the status of your new group using a\n request like the following: \n\n ```\n curl -i -H \"$AUTH\" -H \"Content-Type:application/json\" \\\n \"https://apigee.googleapis.com/v1/organizations/$PROJECT_ID/environments/ENVIRONMENT_NAME\"\n ```\n 4. Attach the new environment to the environment group using the [Environment group attachment API](/apigee/docs/reference/apis/apigee/rest/v1/organizations.envgroups.attachments).\n\n Attaching an environment to the group makes the proxies in that environment\n routable via the hostnames in the group. This triggers a long-running operation that can take several minutes to complete. We recommend that you wait a minute or two before continuing to the next step. In the meantime you can check the status of the operation as before.\n2. Deploy an archive of your API proxy configuration to the Apigee environment.\n 1. In the **Terminal** tab in Apigee VS Code, navigate to the **myapigeeworkspace** directory. \n\n ```\n cd myapigeeworkspace\n ```\n\n\n When you run `ls` the directory should contain the `src` folder.\n 2. Run the following command: \n\n ```\n gcloud beta apigee archives deploy --environment=dev --labels=release=052021\n ```\n\n\n The following provides an example of the response: \n\n ```\n Using Apigee organization dev\n Waiting for operation [b64c2665-b5ac-43cc-9e2d-232e8895c2ed] to complete...done\n ```\n3. Run the following command in the **Terminal** tab to test your API: \n\n ```\n curl https://INTERNAL_LOAD_BALANCER_IP/helloworld /\n -H \"Host: ENV_GROUP_HOSTNAME\" \n ```\n\n\n For more information about the variables in this example and how to set up API access, see [Deploy a sample proxy](/apigee/docs/api-platform/get-started/deploy-sample).\n\n\n The following error message is displayed: \n\n ```\n {\"fault\":{\"faultstring\":\"Failed to resolve API Key variable request.queryparam.apikey\",\n \"detail\":{\"errorcode\":\"steps.oauth.v2.FailedToResolveAPIKey\"}}}\n ```\n\n\n You need to create an API product that includes the `helloworld` API, then create and register a developer with the API product in order to obtain an API key.\n4. Obtain an API key.\n 1. Create an API product using the Apigee UI:\n 1. Go to the API products page: \n\n Apigee in Cloud console\n\n In the Google Cloud console, go to the **Distribution \\\u003e API products** page.\n\n [Go to API products](https://console.cloud.google.com/apigee/apiproducts)\n\n Classic Apigee UI\n\n Select **Publish \\\u003e API Products**.\n 2. Click **+ Create**.\n 3. Enter the Product Details for your API product. \n 4. Enter the following information in the fields:\n\n | Field | Setting |\n |-------------------------|---------------|\n | `Name: ` | **myproduct** |\n | `Display name: ` | **myproduct** |\n | `Environment: ` | **dev** |\n | `Access: ` | **Public** |\n | `Quota: ` | Leave blank |\n | `Allowed OAuth scope: ` | Leave blank |\n\n 5. In the **Operations** section, click **+ Add an Operation**.\n 6. Under **Source** select **helloworld** from the API Proxy dropdown menu.\n 7. Under **Operation** , in the Path field, enter `/`.\n\n\n Leave other fields set to their defaults.\n 8. Click **Save** to save the Operation.\n 9. Click **Save** to save the API product.\n\n \u003cbr /\u003e\n\n 2. Create a developer in your organization: \n\n Apigee in Cloud console\n 1. In the Google Cloud console, go to the **Distribution \\\u003e Developers** page.\n\n [Go to Developers](https://console.cloud.google.com/apigee/developers)\n 2. Click **+ Create**.\n 3. Enter the following information in the fields:\n\n | Field | Setting |\n |----------------|---------------------------|\n | `First Name: ` | **Alex** |\n | `Last Name: ` | **Hamilton** |\n | `Username: ` | **ahamilton** |\n | `Email: ` | **ahamilton@example.com** |\n\n 4. Click **Add**.\n\n Classic Apigee UI\n 1. Select **Publish \\\u003e Developers** in the navigation menu.\n 2. Click **+ Developer**.\n 3. Enter the following information in the fields:\n\n | Field | Setting |\n |----------------|---------------------------|\n | `First Name: ` | **Alex** |\n | `Last Name: ` | **Hamilton** |\n | `Username: ` | **ahamilton** |\n | `Email: ` | **ahamilton@example.com** |\n\n 4. Click **Create**.\n 3. Register an app:\n 1. Open the app editor. \n\n Apigee in Cloud console\n 1. In the Google Cloud console, go to the **Distribution \\\u003e Apps** page.\n\n [Go to Apps](https://console.cloud.google.com/apigee/apps)\n 2. Click **+ Create**.\n\n Classic Apigee UI\n 1. Select **Publish \\\u003e Apps**.\n 2. Click **+ App**.\n 2. Enter the following information in the fields:\n\n | Field | Setting |\n |-----------------------|----------------------------------------------------------------------|\n | `Name: ` | **myapp** |\n | `Display name: ` | **myapp** |\n | `Developer: ` | **ahamilton@example.com** |\n | `Callback URL: ` | Leave blank |\n | `Notes: ` | Leave blank |\n | `Expiry: ` | **Never** |\n | `Product: ` | 1. Click **Add product**. 2. Select **myproduct**. 3. Click **Add**. |\n | `Custom attributes: ` | Leave blank |\n\n 3. Click **Create**.\n 4. \n 4. Copy the API key.\n\n Apigee in Cloud console\n - In the Google Cloud console, go to the **Distribution \\\u003e Apps** page.\n\n [Go to Apps](https://console.cloud.google.com/apigee/apps)\n - Click **myapp**.\n - In the **Credentials** section, next to **Key** , click visibility_off **Show**.\n - Click content_copy **Copy**.\n\n Classic Apigee UI\n - On the Apps page (**Publish \\\u003e Apps** ), click **myapp**.\n\n - On the **myapp** page, click **Show** next to **Key** in the **Credentials** section. Notice that the API key is associated with the API product you created. \n - Select and copy the API key.\n\n5. Run the curl call again passing the API key using the `apikey` query parameter, as follows: \n\n ```\n curl -v https://$PUBLIC_FACING_IP/helloworld?apikey=ZQA5euYtNeJ7ZCGCJMpvd6F2BZOmxOzY\n ```\n\n The following response is returned: \n\n ```\n {\n \"root\": {\n \"city\": \"San Jose\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"state\": \"CA\"\n }\n }\n ```\n\n\u003cbr /\u003e\n\n**Congratulations!** You've successfully deployed your API archive to an Apigee environment!\n\nIn the next step, you'll promote your API archive to an Apigee production environment.\n\n\n[1](/apigee/docs/api-platform/local-development/vscode/tutorial-create-workspace)\n\n\n[2](/apigee/docs/api-platform/local-development/vscode/tutorial-create-proxy)\n\n\n[3](/apigee/docs/api-platform/local-development/vscode/tutorial-deploy)\n\n\n[4](/apigee/docs/api-platform/local-development/vscode/tutorial-test)\n\n\n[5](/apigee/docs/api-platform/local-development/vscode/tutorial-change-target-endpoint)\n\n\n[6](/apigee/docs/api-platform/local-development/vscode/tutorial-attach-policy)\n\n\n[7](/apigee/docs/api-platform/local-development/vscode/tutorial-deploy-apigee)\n\n\n[(NEXT) Step 8: Promote an archive to production](/apigee/docs/api-platform/local-development/vscode/tutorial-promote)\n\n\u003cbr /\u003e"]]