google-cloud-platformgoogle-cloud-api-gateway

GCP - How to update api specification in API Gateway


I have created an API Gateway and created an API config as well associated with it which lists a set of APIs. Now I want to add/modify a set of APIs. How do I update the same API config of this gateway?


Solution

  • I did it using gcloud CLI.

    First create a new config using your updated open api spec file:

    gcloud api-gateway api-configs create NEW_CONFIG_ID --api=MY_API --openapi-spec=openapi2-functions.yaml 
    

    Then update your api gateway with new config:

    gcloud api-gateway gateways update MY-GATEWAY --api=MY-API --api-config=NEW_CONFIG_ID --location=YOUR_LOCATION