Forum Discussion

Libor's avatar
Libor
New Contributor
4 years ago
Solved

publish/unpublish through registry api

Hello,

We have automated way how to create and upload new api documentation to swaggerhub during releasing of new version of our application to production servers. But we still need to log into swaggerhub and publish the version theree manually. Is there a possibility for us to automate also this last step?

I found similar issue but it is old and still without answer: https://community.smartbear.com/t5/SwaggerHub/publish-unpublish-an-api-through-the-registry-api/m-p/160156#M502

Thanks for help

Libor

  • Hi Libor,

     

    This is now possible - you can publish and unpublish definitions by using "PUT ​/apis​/{owner}​/{api}​/{version}​/settings​/lifecycle":

    curl -X PUT "https://api.swaggerhub.com/apis/OWNER/API_NAME/VERSION/settings/lifecycle"
         -H "Authorization: SWAGGERHUB_API_KEY"
         -H "Content-Type: application/json"
         -d "{\"published\": true}"

    API docs

5 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi Libor,

     

    This is now possible - you can publish and unpublish definitions by using "PUT ​/apis​/{owner}​/{api}​/{version}​/settings​/lifecycle":

    curl -X PUT "https://api.swaggerhub.com/apis/OWNER/API_NAME/VERSION/settings/lifecycle"
         -H "Authorization: SWAGGERHUB_API_KEY"
         -H "Content-Type: application/json"
         -d "{\"published\": true}"

    API docs