Linking to endpoints in Document


(Colleen Chan) #1

Hi,

I’m writing pages in the Document Hub to explain the APIs that we have, and I’d like to link to specific API Endpoints that are in the .oas2 file. Is there any way to do this?

I’ve only seen that you can create a document hub page with page type of ‘OpenAPI’ which links to the entire modelling file.

Thanks,
Colleen


(Taylor Barnett) #2

Hey Colleen,

It is technically possible, but there isn’t a nice UI for it like when referencing a whole OAS document. You have to go into the code view to do it. I can create an example for you.


(Taylor Barnett) #3

For example, I want to link to this endpoint in a subpage by itself:

Like thiis:

I would have to reference it with ./main.oas2.yml#/paths/~1todos/post


(Colleen Chan) #4

Hi,

Thanks for that! That is very helpful!

Is there also a way to reference it as a link within a page? eg in the Markdown using Text… something like [API Endpoint Name](Path to the Specific Endpoint as a document page)??

Hope that makes sense…

Cheers,
Colleen


(Taylor Barnett) #5

In that case, I would treat it like an external link and link directly to it where ever it is in your Hub.

So for example, for one of our endpoints, I’d use:

[Build docs API endpoint](https://docs.stoplight.io/api-reference/documentation/publish/postdocsrelease)


(Colleen Chan) #6

Thanks for that!

Cheers,
Colleen