简体   繁体   中英

Bulk importing swagger files using wso2 API Manager

I'd like to know if it's possible to automate the process of importing swagger files in wso2 api manager. If so how can it be done?

thanks

You write a script to create an API using Publisher's API.

You can add resources, including scopes, as a Swagger payload.

https://docs.wso2.com/display/AM210/Publisher+APIs#PublisherAPIs-AddAPI

curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag -d "action=addAPI&name=PhoneVerification&context=/phoneverify&version=1.0.0&visibility=public&thumbUrl=&description=Verify a phone number&tags=phone,mobile,multimedia&endpointType=nonsecured&tiersCollection=Gold,Bronze&http_checked=http&https_checked=https&resourceCount=0&resourceMethod-0=GET&resourceMethodAuthType-0=Application&resourceMethodThrottlingTier-0=Unlimited&uriTemplate-0=/*&default_version_checked=default_version&bizOwner=xx&bizOwnerMail=xx@ee.com&techOwner=xx&techOwnerMail=ggg@ww.com" -d 'endpoint_config={"production_endpoints":{"url":" http://ws.cdyne.com/phoneverify/phoneverify.asmx","config":null},"endpoint_type":"http "}'

You can write a java/python client or create a script which will include the couple of hits to the APIs mentioned in the publisher api document .

  1. Generate the token using scopes: apim:api_create apim:api_view apim:api_publish
  2. Call the Update swagger definition
  3. Change API-Status to Publish using the Change API Status

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM