How to associate a Spec with an existing Proxy

Not applicable

Is it possible to associate a newly created spec with an existing proxy?

Thank you,

Brent

2 4 1,313
4 REPLIES 4

Theoretically yes. It'll require that you download the proxy bundle and create the association 'offline' prior to uploading the proxy again.

When you create a proxy from a spec, it'll create a folder names 'openapi' under the resources directory. This folder contains a file called association.json which its contents will reference the spec. For example:

{
"url": "/c3Rvc-ZG9j-42192/content"
}

The spec reference can be extracted from the URL when you go back into the spec editor:

.../specs/homeFolder/editor/c3Rvc-ZG9j-42192

In the main file for the downloaded proxy (<proxyname>.xml) you'll also need to add a reference to the association.json file:

    <Resources>
        <Resource>openapi://association.json</Resource>
    </Resources>

It's not as straight forward as simply clicking a button on the UI and selecting the spec, but for now, this will do it until the UI allows you to do it in an easier manner.

To make it easier to understand the process described above, a good idea would be to create a simple proxy from a spec and compare its downloaded version with one created without a spec.

After the association is in place, you can update the proxy based on updates on the spec (for example, add a new resource).

I hope this helps and feel free to reach out with any questions.

Hi @Ricardo de Andrade,

As you mention above, After the association is in place, you can update the proxy based on updates on the spec (for example, add a new resource).

if we update the spec file will it automatically update the proxy?

Thanks,

G Ramya

Hi Ramya, It will not automatically update your proxy. You'll need to go into the proxy editor and click the Add Conditional Flow button for the proxy endpoint, where you'll have the option for adding a flow from OpenAPI. If you don't see this option, you might not have successfully updated your proxy with the spec association. See https://community.apigee.com/questions/43855/update-the-flows-in-a-proxy-using-a-spec.html for info on how to add the conditional flow.

Hello Mike @Mike Dunker, as you said I'm not able to see the option OpenApi Spec when I click on + icon under proxy endpoint. And I'm trying to add OAS to my proxy. Any idea on why I'm not able to see the OpenAPI option? Thank you very much!!