튜토리얼: Gemini Code Assist를 사용하여 Apigee에서 API 설계, 개발, 테스트
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
이 페이지는 Apigee 및 Apigee Hybrid에 적용됩니다.
개요
이 튜토리얼에서는 Gemini Code Assist의 @Apigee 도구를 사용하여 API 사양을 만들고 수정하는 프로세스를 설명합니다. 자연어 프롬프트를 사용하여 치과 예약 관리에 사용할 API를 설계하고 만듭니다. 사양이 준비되면 사양을 테스트하고 사양에서 Apigee API 프록시를 만들 수도 있습니다.
Gemini Code Assist를 사용하여 API 사양을 만들고 수정하는 방법에 대한 자세한 내용은 API 설계 및 수정을 참조하세요.
@Apigee Create an API specification for patients to schedule their own appointments with a dental
office. Include multiple dentists and a dental appointment type, which can be regular checkup or
other.
4단계: 사양 보기
Gemini Code Assist에서 사양을 생성하는 동안 기다립니다. 사양을 사용할 수 있게 되면 채팅 창에 API 허브 및 API 엔드포인트에서 활용된 엔터프라이즈 컨텍스트 요약을 포함한 생성된 사양에 대한 정보가 표시됩니다. Cloud Code의 다른 탭에는 새 API 사양에 대한 엔드포인트, 스키마, 기타 정보가 포함된 사양 코드와 Swagger 인터페이스가 표시됩니다.
5단계: 사양 수정
여러 치과 위치가 포함되도록 사양을 수정합니다. 먼저 사양이 포함된 YAML 파일이 현재 편집기에서 활성화된 탭에 있는지 확인합니다. 그런 다음 채팅 창에서 Apigee 핸들을 다시 입력하고 Apigee 도구 @Apigee를 선택합니다. 다음 프롬프트를 입력합니다.
@Apigee Update the API specification for the dental scheduling API. Add multiple dental
office locations.
편집 탭에 차이점이 강조 표시된 사양 변경사항이 표시됩니다. 편집 탭에 직접 업데이트를 입력하고 파일을 저장하여 사양을 수정할 수도 있습니다.
6단계: API 허브에 API 게시
API를 검토하고 완료한 후에는 이를 API 허브에 등록하여 개발자에게 제공합니다.
API 허브에 게시를 클릭합니다.
메시지를 따라 API를 게시/등록합니다. API 허브에 등록하는 방법과 제공해야 하는 정보는 API 등록을 참고하세요.
7단계: 로컬 모의 서버를 사용하여 API 테스트
API 응답을 에뮬레이션하는 로컬 모의 서버를 사용하여 API를 테스트합니다. 로컬 모의 서버를 API 허브에 게시할 필요가 없습니다.
서버 드롭다운에서 로컬 모의 서버가 이미 선택되어 있어야 합니다.
로컬 모의 서버를 선택한 후 POST 경로를 열고 사용해 보기를 클릭합니다.
addresses 항목의 요청 본문에 'city', 'country', 'postalCode' 값을 제공합니다.
(선택사항) 이 사양에서 Apigee API 프록시 번들을 만들려면 API 프록시 번들 만들기 버튼을 클릭하고 프록시 이름을 입력합니다.
생성되면 Apigee 작업공간의 apiproxies 아래에 새 프록시가 표시됩니다. Cloud Code에서 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 tutorial demonstrates how to use Gemini Code Assist in Cloud Code to design an API and create an Apigee API proxy from a generated API specification.\u003c/p\u003e\n"],["\u003cp\u003eYou'll learn how to use natural language prompts to create an API, view and modify the generated spec, and test it using a local mock server.\u003c/p\u003e\n"],["\u003cp\u003eThe tutorial covers the optional step of registering your final API to API hub for developer access.\u003c/p\u003e\n"],["\u003cp\u003eYou can also save the designed API, create an Apigee API proxy bundle from the API spec, and continue developing the proxy.\u003c/p\u003e\n"],["\u003cp\u003eThe necessary prerequisites include setting up Gemini for Google Cloud API, Apigee API Admin access, local development in Cloud Code, and familiarity with OpenAPI specifications.\u003c/p\u003e\n"]]],[],null,["# Tutorial: Use Gemini Code Assist to design, develop, and test APIs in Apigee\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\nOverview\n--------\n\nThis tutorial guides you through the process of using the `@Apigee` tool in\nGemini Code Assist to\ncreate and edit an API spec. You'll use a natural language prompt to design and create an API for\nmanaging dental office appointments. Once the spec is ready, you can also test it and create an\nApigee API proxy from it.\n\nFor more information on creating and editing API specs using Gemini Code Assist, see\n[Design and edit APIs](/apigee/docs/api-platform/local-development/vscode/develop-design-edit-apis).\n\nBefore you begin\n----------------\n\nTo complete this tutorial, you'll need:\n\n- A Google Cloud project set up for local development in Google Cloud. See [Set up Apigee API Management in Cloud Code for VS Code](/apigee/docs/api-platform/local-development/setup). Make sure to set up Gemini Code Assist for your project. See [Use Gemini Code Assist with Apigee](/apigee/docs/api-platform/local-development/setup#gemini).\n- To make sure your user account has the required roles listed in [Required roles to use Gemini Code Assist in Apigee](/apigee/docs/api-platform/local-development/setup#required-roles-to-use-gemini-code-assist-in-apigee) for each task.\n- Familiarity with [OpenAPI specs](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md), so that you can review the generated spec.\n\nStep 1: Open Gemini Code Assist Chat\n------------------------------------\n\nOpen VS Code and click the Gemini Code Assist chat icon. You should see the chat window.\n\nStep 2: Enter the Apigee handle to use the\nApigee tool\n------------------------------------------------------\n\nType `@Apigee` in the chat window. You'll see a list of Apigee prompts.\nSelect **Create an API specification**.\n\nStep 3: Enter the prompt\n------------------------\n\nIn the input field, enter and submit this description to complete the prompt: \n\n\n`@Apigee Create an API specification for patients to schedule their own appointments with a dental\noffice. Include multiple dentists and a dental appointment type, which can be regular checkup or\nother.`\n| **Note:** Do not copy and paste over the `@Apigee` handle. Instead, complete the prompt by pasting in the text starting with `for patients to\n| schedule...`.\n\nStep 4: View the spec\n---------------------\n\nWait while Gemini Code Assist generates the spec. Once it's available, the chat window\nshows information about the generated spec, including a summary of enterprise context leveraged\nfrom your API hub and API endpoints. Other tabs in Cloud Code\nshow the spec code and the Swagger interface with the endoints, schema, and other information\nabout the new API spec.\n\nStep 5: Modify the spec\n-----------------------\n\nModify the spec to include multiple dental office locations. First, make sure that the\nYAML file containing the spec is in the currently active tab in your editor. Then, in the chat window,\nenter the\nApigee handle again and select the Apigee tool: `@Apigee`. Enter this\nprompt: \n\n`@Apigee Update the API specification for the dental scheduling API. Add multiple dental\noffice locations.`\n\nThe changes to the spec are shown, with diffs highlighted, in the editing tab. You can also\nmodify the spec by typing your updates directly in the editing tab and saving the file.\n\nStep 6: Publish your API to API hub\n-----------------------------------\n\nOnce your API is reviewed and final, make it available to developers by registering it\nwith API hub:\n\n1. Click **Publish to API hub**.\n2. Follow the prompts to publish/register the API. See [Register an API](/apigee/docs/apihub/manage-apis#register-an-api) for information on registering with API hub and the information you need to provide.\n\nStep 7: Test the API using a local mock server\n----------------------------------------------\n\nTest the API using the local\n[mock server](/apigee/docs/api-platform/local-development/vscode/develop-design-edit-apis#use-the-local-mock-server),\nwhich emulates responses for the API. The local mock server does not require publishing to\nAPI Hub.\n\nThe local mock server should already be selected in the **Servers** dropdown. \n\nOnce the local mock server is selected, open the **POST** path and click **Try it out**.\n\nProvide the \"city\", \"country\", and \"postalCode\" values in the request body for the\n`addresses` entity: \n\n```\n{\n \"city\": \"string\",\n \"country\": \"string\",\n \"postalCode\": \"string\",\n \"state\": \"string\",\n \"streetAddress\": \"string\"\n }\n```\n\nClick **Execute** to see a mock response from the API in the **Responses** section.\n\nStep 8: Create an API proxy bundle from this spec\n-------------------------------------------------\n\n(Optional) To create an Apigee\n[API proxy bundle](/apigee/docs/api-platform/fundamentals/understanding-apis-and-api-proxies#howdoyoucreateanapiproxy)\nfrom this spec, click the **Create API proxy bundle** button and enter a proxy name.\nAfter creation, you should see the new proxy under **apiproxies** in your Apigee\nworkspace. See\n[Developing API proxies](/apigee/docs/api-platform/local-development/vscode/develop-apiproxies)\nfor information on working with API proxies in Cloud Code. \n\nNext steps\n----------\n\n- Learn more about [designing and editing APIs using Cloud Code](/apigee/docs/api-platform/local-development/vscode/develop-design-edit-apis).\n- Learn more about Gemini Code Assist features you can use in Apigee. See [Use Gemini](/apigee/docs/api-platform/get-started/gemini-code-assist)."]]