Docs As Code
DocsAsCode HTML Page
This is a sample HTML page that demonstrates how to use Docs-as-Code features in SwaggerHub Portal when using a local HTML file. It includes code samples, images, videos, and tables.
Using HTML snippets is a great way to showcase your API documentation and provide a rich user experience
Embed Code Samples
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://virtserver.swaggerhub.com/frank-kilcommins/Portal-API-Copy/0.2.0-beta/portals"),
Headers =
{
{ "Accept", "application/json, application/problem+json" },
{ "Authorization", "Bearer " },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
Embed Images
Let's drop in an image. It's similar to how you would do it in Markdown, but you can also use HTML tags directly if you prefer.
Embed Picture with Sources
Embed Video
Here's an example of embedding a video. You can use the feature to include videos from platforms like YouTube.
Include Tables
Here's a table
| Heading One | Heading Two |
|---|---|
| A1 | value |
| A2 | value |
Insert Endpoints:
GET get list of portals
is an endpoint to filter portals by subdomain, and other parameters. You can use this endpoint to retrieve a list of portals that match your criteria.