Is there any APIs to interact with the OpenAPI Specs Container in APIGEE Edge (SaaS)?

csd
Bronze 2
Bronze 2

We maintain a list of open api specs which is used to validate incoming requests.

At the moment we store it outside of APIGEE (say external storage) and make a service callout to fetch those specs.

We would like to leverage APIGEE Specs Container where we can house those specs.

Please let me know if there is a way to interact with the Specs using an API so that we can house all specs in APIGEE itself.

0 2 157
2 REPLIES 2

Are we talking about Apigee X or hybrid?

For what purpose do you want the OAS documents to be stored within Apigee?  Are these used within  the OASValidation step?  If so, you can attach such specifications to the API proxy itself, under /resources/oas .  Place .yaml or .json OAS documents there, in the bundle. 

You also have the option to attach these to the environment or to the organization, too, using the administrative API.  For X or hybrid, Use this URL: 

 

$apigee/v1/organizations/$ORG/environments/$ENV/resourcefiles

 

A request to "store" an OpenAPI Spec resource at the environment scope would look like this:

 

POST :apigee/v1/organizations/:org/environments/:env/resourcefiles?type=oas&name=oas-1.yaml
Authorization: Bearer :token
Content-Type: application/octet-stream

(content of OAS spec here)

 

In curl it would look like

 

curl -i -H 'Content-Type: application/octet-stream' \
 -H "Authorization: Bearer $TOKEN" \
 -X POST \
 "$apigee/v1/organizations/$ORG/environments/$ENV/resourcefiles?type=oas&name=oas-1.yaml" \
 -d @/path/to/my-oas-spec.yaml

 

The downside of this is, at the current moment, these resource files are not accessible from the Apigee UI.  As an operator or admin, you can't "see them" by clicking through the UI.  There are a bunch of things in Apigee that you can manage at th environment scope - keyvalue maps, truststores, references, target servers, and so on - and you can see all of those things in the UI.  But at the moment you cannot administer or view the resourcefiles. 

env-scope-entities.png

csd
Bronze 2
Bronze 2

Thanks a lot for for your reply.

We are using APIGEE Edge (SaaS) and yes they are used during validation. We use https://github.com/geraintluff/tv4 to validate the incoming data against spec.

Can you confirm if the same curl command would be applicable for APIGEE Edge (SaaS)?