-
Notifications
You must be signed in to change notification settings - Fork 0
Metadata page
ServiceStack will automatically generate a metadata page about the webservice. The metadata can be found under the URL /metadata
:
The Metadata page contains:
- List of all visible web services and the endpoints they're accessible on
- Links to a detailed page of each format, with example request and responses
- Links to SOAP 1.1/1.2 WSDLs
- Links to all XSD types for all services
- Links to internally available debug metadata info
- Links to Client examples documentation
The metadata pages provide automatic generated documentation around your services, allowing consumers of your APIs to more easily introspect and provide greater visibility of your services.
You can also optionally add custom annotations and documentation on services which will automatically appear on the metadata pages. Here is an example of a fully annotated Service:
[Api("Service Description")]
[Route("/swagger/{Name}", "GET", Summary = @"GET Summary", Notes = "GET Notes")]
[Route("/swagger/{Name}", "POST", Summary = @"POST Summary", Notes = "POST Notes")]
public class MyRequestDto
{
[ApiMember(Name="Name", Description = "Name Description",
ParameterType = "path", DataType = "string", IsRequired = true)]
public string Name { get; set; }
}
If now the detail page of the specific service is inspected, the description configured above will be displayed.
The HTML templates for the metadata pages are maintained as embedded html template resources. You can get servicestack to use your own custom metadata pages instead by setting Config.UseCustomMetadataTemplates = true
and copying the html templates and adding them to your Website Directory which you can customize locally that ServiceStack will pick up and use instead:
- IndexOperations.html
- OperationControl.html
- OperationsControl.html
The metadata page is a feature and can be removed by setting:
SetConfig(new EndpointHostConfig {
EnableFeatures = Feature.All.Remove(Feature.Metadata)
});
This can be done by configuration (AppSetting) by adding the following method. Note that the Feature enum is decorated with the Flags attribute. By comma separating multiple feature names in the value of the DisableFeature appsetting you will be able to remove multiple features when desired.
SetConfig(new EndpointHostConfig {
EnableFeatures = Feature.All.Remove(GetDisabledFeatures())
});
private static Feature GetDisabledFeatures()
{
var disabled = ConfigurationManager.AppSettings.Get("DisabledFeatures");
Feature d;
if (!string.IsNullOrWhiteSpace(disabled)
&& Enum.TryParse(disabled,true, out d))
{
return d;
}
return Feature.None;
}
And an example app setting disabling the metadata page and all soap endpoints.
<AppSettings>
<add key="DisabledFeatures" value="MetaData, Soap, Soap11, Soap12" />
</appSettings>
- Why ServiceStack?
- What is a message based web service?
- Advantages of message based web services
- Why remote services should use separate DTOs
- Getting Started
- Reference
- Clients
- Formats
- View Engines 4. Razor & Markdown Razor
- Hosts
- Advanced
- Configuration options
- Access HTTP specific features in services
- Logging
- Serialization/deserialization
- Request/response filters
- Filter attributes
- Concurrency Model
- Built-in caching options
- Built-in profiling
- Messaging and Redis
- Form Hijacking Prevention
- Auto-Mapping
- HTTP Utils
- Virtual File System
- Config API
- Physical Project Structure
- Modularizing Services
- Plugins
- Tests
- Other Languages
- Use Cases
- Performance
- How To
- Future