I’m trying to get the docs for a single endpoint so I can generate a swagger client for just one of the services. Is there a way to do this? I tried /api/v2/api_docs/serviceName but it just returned the same JSON the top level did.
I’d also like to expose these docs for developers for each endpoint, rather than all of them.
Thanks for posting! However, I’m not sure I understand the question. It would help to know what service you’re talking about…a database, remote http API, something else?
My thought was that if the URL was /api/v2/api_docs, the docs for a particular service would be at /api/v2/api_docs/users, but both URLs return the full docs.
The reason we’d like this is that we can generate functional client libraries using swagger over at https://generator.swagger.io/, but most people probably won’t want all of the services in the instance, just the one they need. Manually editing the JSON is tedious. It would also be great to be able to link to the docs for just one service.
@jraiche, there is currently no way to cherry pick a swagger definition for a single service using the api/v2/api_docs API. You will need to get the full doc and then take out the piece that you need from it.
Alternatively, you can try the api/v2/system/service/ API. Replace with your service id. This will give you all the information about your service including the swagger doc inside the ‘doc.content’ section. However, the doc here is stringified. You will need to convert it to JSON before you can use it.