I am trying to embed uploading Open API Spec to developer portal into my CI process. I heard a way using management API, but I couldn't find how to upload them using not URL but the file.
The API I am using is
https://:host/v1/organizations/:org/apimodels/:model/revisions
I heard there are query parameter such as action & format. But when I used format=swagger and ran cURL command as below.
curl -k -X POST -H "Authorization: Basic XXXXXXXXX=" -H "Content-Type:text/plain" -d "@swagger.json" "https://api.enterprise.apigee.com/v1/organizations/kunitomo/apimodels/github/revisions?action=import&format=swagger" -v
I received an error message
"Unable to retrieve details from the swagger URL provided. Please check the swagger URL."
so I am guessing query parameter "format=swagger" can only be used for URL. So my question is that how do you upload Open API Spec from file?
Solved! Go to Solution.
I think you need to use the following URL to upload the OpenAPI (Swagger) file.
https://api.enterprise.apigee.com/v1/organizations/{Org}/apimodels/{APIModel}/import/file?format=swa...
The content type should be application/json. You need to change "api.enterprise.apigee.com" to point to management server in a private cloud deployment.
I think you need to use the following URL to upload the OpenAPI (Swagger) file.
https://api.enterprise.apigee.com/v1/organizations/{Org}/apimodels/{APIModel}/import/file?format=swa...
The content type should be application/json. You need to change "api.enterprise.apigee.com" to point to management server in a private cloud deployment.
Thank you, sudheendra1. The URL you suggested worked for me.
Related to this topic, is there a page you can check this management api specs? I know there is a page for management api, but I couldn't find specs for developer portal. If you know, it is appreciated if you tell me.
Is there a way to do the same thing except with a YAML format file instead of a JSON format (without performing an intermediate conversion)?
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |