WSO API Manager是否支持发布现有GraphQL端点及路由已部署的GraphQL API?
1. Publishing Existing GraphQL Endpoints (Similar to REST's "Existing API" Option)
Absolutely, WSO2 API Manager has you covered here—you can import and publish existing GraphQL endpoints just as easily as you do with REST APIs using the "Existing API" option. Here's the step-by-step:
- Head over to the API Publisher dashboard.
- Click "Create API" and pick the GraphQL type from the options.
- Instead of building the schema from scratch, select the "Import from GraphQL endpoint" option.
- Paste in the URL of your existing GraphQL backend (e.g.,
https://your-running-graphql-service.com/graphql). APIM will automatically pull the schema directly from this endpoint. - From there, you can configure all the usual API details (name, version, context), attach any policies you need, and publish it to the gateway—exactly like you would with an imported REST API.
This saves you the hassle of redefining your schema and lets you quickly onboard your existing GraphQL service into APIM's governance framework.
2. Routing Already Live GraphQL APIs via WSO2 APIM
Yes, you can absolutely route traffic to your already live GraphQL API through WSO2 APIM. Here's how to set it up:
- First, import your live GraphQL endpoint into APIM using the steps outlined above.
- Once the API is published to the gateway, instruct your clients to send their GraphQL requests to the APIM gateway's API endpoint (not directly to your backend service anymore).
- The APIM gateway acts as a reverse proxy: it receives requests from clients, applies any configured policies (like authentication, rate limiting, or request transformations), then forwards the request to your live GraphQL backend. Responses are routed back through the gateway to the client.
Just make sure that your APIM gateway has network access to your live GraphQL service. If your backend requires authentication, you can configure backend security credentials (like basic auth or OAuth) in the API's backend settings within the Publisher.
内容的提问来源于stack exchange,提问作者A.K




