cancel
Showing results for 
Search instead for 
Did you mean: 

publish/unpublish through registry api

SOLVED
Libor
New Contributor

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/...

Thanks for help

Libor

1 ACCEPTED SOLUTION

Accepted Solutions
HKosova
Moderator

Re: publish/unpublish through registry api

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


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

5 REPLIES 5
HKosova
Moderator

Re: publish/unpublish through registry api

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


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

Libor
New Contributor

Re: publish/unpublish through registry api

awesome! thanks!

prabha
New Contributor

Re: publish/unpublish through registry api

hey i am not able to unpublish/remove API

prabha
New Contributor

Re: publish/unpublish through registry api

HKosova
Moderator

Re: publish/unpublish through registry api

Hi @prabha,

You need to unpublish this API first. Then you'll be able to delete it.


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors