Protocol

1
2
3
4
5
{
    "Name": "RESTar.Admin.Protocol",
    "Kind": "EntityResource",
    "Methods": ["GET", "REPORT", "HEAD"]
}

The Protocol resource lists all protocol providers that have been added to the current RESTar application, as well as their respective available input and output content types. The RESTar protocol is always enabled, but others – such as OData – can be added by the developer. See this section of the documentation for more information on how to add custom protocol providers.

Format

Property name Type Description
Name string The name of the protocol
Identifier string A unique identifier for the protocol
IsDefault boolean Is this the default protocol?
ContentTypes array of ContentTypeInfo The content types supported in this protocol

ContentTypeInfo

ContentTypeInfo objects describe content types that are available for some protocol in a RESTar application.

Format

Property name Type Description
Name string The name of the content type
MimeType string The MIME type string of the content type
CanRead boolean Can the given protocol read from requests using this content type?
CanWrite boolean Can the given protocol write to responses using this content type?
Bindings array of string The available header values that can be used to bind a request to this content type

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
GET /protocol

Response body:
[
    {
        "Name": "RESTar",
        "Identifier": "restar",
        "IsDefault": true,
        "ContentTypes": [{
            "Name": "JSON",
            "MimeType": "application/json",
            "CanRead": true,
            "CanWrite": true,
            "Bindings": [
                "application/json",
                "application/restar-json",
                "json",
                "text/plain"
            ]
        },
        {
            "Name": "Microsoft Excel",
            "MimeType": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
            "CanRead": true,
            "CanWrite": true,
            "Bindings": [
                  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                  "application/restar-excel",
                  "excel"
            ]
        },
        {
            "Name": "XML",
            "MimeType": "application/xml",
            "CanRead": false,
            "CanWrite": true,
            "Bindings": [
                "application/xml",
                "application/restar-xml",
                "xml"
            ]
        }]
    }
]