Back to Meshery

Single

docs/layouts/rest-apis/single.html

1.0.187.1 KB
Original Source

{{ .tagLabel }}{{ upper .method }}

{{ .path }}

{{ .summary }}

{{ with .description }} {{ . | markdownify }} {{ end }} {{ if $authSummary }}

Authentication

{{ $authSummary }} {{ end }} {{ $ossServers := slice }} {{ range $servers }} {{ $serverUrl := index . "url" | default "" }} {{ if and $serverUrl (not (strings.Contains $serverUrl "cloud.")) (not (strings.Contains $serverUrl "staging-cloud.")) }} {{ $ossServers = $ossServers | append . }} {{ end }} {{ end }} {{ if eq (len $ossServers) 0 }} {{ $ossServers = $ossServers | append $defaultOssServer }} {{ end }}

Try this endpoint

Use your Meshery hostname or local server URL when calling this endpoint.

{{ range $server := $ossServers }} {{ $serverUrl := index $server "url" | default "" }} {{ $serverDescription := index $server "description" | default "Meshery Server URL" }}

{{ $serverDescription }}

{{ printf "%s%s" $serverUrl $operationPath }} {{ end }} {{ if gt (len $parameters) 0 }}

Parameters

{{ $locations := slice (dict "key" "path" "label" "Path parameters") (dict "key" "query" "label" "Query parameters") (dict "key" "header" "label" "Header parameters") (dict "key" "cookie" "label" "Cookie parameters") }} {{ range $locations }} {{ $rows := where $parameters "in" .key }} {{ if gt (len $rows) 0 }}

{{ .label }}

NameTypeRequiredDescription
{{ range $rows }} {{ $parameterSchema := index . "schema"default dict }} {{ $parameterType := partial "rest-apis/schema-type.html" $parameterSchema }}{{ .name }}{{ $parameterType
{{ end }}

{{ end }} {{ end }} {{ end }} {{ with $operation.requestBody }} {{ $requestBody := . }} {{ $requestContentCount := len $requestBody.content }} {{ $singleRequestContentType := "" }} {{ if eq $requestContentCount 1 }} {{ range $contentType, $_ := $requestBody.content }} {{ $singleRequestContentType = $contentType }} {{ end }} {{ end }}

Request body

{{ if eq $requestContentCount 1 }} {{ $singleRequestContentType }}{{ if $requestBody.required }}Required{{ else }}Optional{{ end }} {{ end }} {{ with $requestBody.description }} {{ . | markdownify }} {{ end }} {{ range $contentType, $content := $requestBody.content }} {{ $schema := index $content "schema" | default dict }} {{ $schemaType := partial "rest-apis/schema-type.html" $schema }} {{ $fields := partial "rest-apis/schema-properties.html" $schema }} {{ $example := partial "rest-apis/content-example.html" $content }} {{ if ne $requestContentCount 1 }}

{{ $contentType }}

{{ if $requestBody.required }}Required{{ else }}Optional{{ end }} {{ end }} {{ with index $schema "description" }} {{ . | markdownify }} {{ else }}

Schema: {{ $schemaType }}

{{ end }} {{ if gt (len (index $fields "rows")) 0 }}

FieldTypeRequiredDescription
{{ range index $fields "rows" }}{{ .name }}{{ partial "rest-apis/schema-type.html" (index . "schema") }}{{ if .required }}Yes{{ else }}No{{ end }}
{{ end }}

{{ else if index $schema "oneOf" }} {{ range index $schema "oneOf" }} {{ $variantFields := partial "rest-apis/schema-properties.html" . }}

{{ index . "title" | default (partial "rest-apis/schema-type.html" .) }}

{{ with index . "description" }} {{ . | markdownify }} {{ end }} {{ if gt (len (index $variantFields "rows")) 0 }}

FieldTypeRequiredDescription
{{ range index $variantFields "rows" }}{{ .name }}{{ partial "rest-apis/schema-type.html" (index . "schema") }}{{ if .required }}Yes{{ else }}No{{ end }}
{{ end }}

{{ else }}

Schema: {{ partial "rest-apis/schema-type.html" . }}

{{ end }} {{ end }} {{ else }}

Schema: {{ $schemaType }}

{{ end }} {{ if $example }}

Example payload

{{ if or (reflect.IsMap $example) (reflect.IsSlice $example) }}{{ $example | jsonify (dict "indent" " ") }}{{ else }}{{ $example }}{{ end }}

{{ end }} {{ end }} {{ end }} {{ with $operation.responses }}

Returned data

Responses

Status codes, content types, and response schemas returned by this endpoint.

{{ range $code, $response := . }} {{ $statusCode := printf "%v" $code }} {{ $responseTone := "neutral" }} {{ if strings.HasPrefix $statusCode "2" }} {{ $responseTone = "success" }} {{ else if strings.HasPrefix $statusCode "3" }} {{ $responseTone = "info" }} {{ else if strings.HasPrefix $statusCode "4" }} {{ $responseTone = "warning" }} {{ else if strings.HasPrefix $statusCode "5" }} {{ $responseTone = "danger" }} {{ end }} {{ $responseContentCount := 0 }} {{ with $response.content }} {{ $responseContentCount = len . }} {{ end }}

{{ $statusCode }} {{ with $response.description }} {{ . | markdownify }} {{ else }}

No description provided.

{{ end }} {{ if eq $responseContentCount 1 }} {{ with $response.content }} {{ range $contentType, $_ := . }}

{{ $contentType }}

{{ end }} {{ end }} {{ end }} {{ with $response.content }} {{ range $contentType, $content := . }} {{ $schema := index $content "schema" | default dict }} {{ $schemaType := partial "rest-apis/schema-type.html" $schema }} {{ $fields := partial "rest-apis/schema-properties.html" $schema }} {{ $example := partial "rest-apis/content-example.html" $content }} {{ if gt $responseContentCount 1 }}

{{ $contentType }}

{{ end }} {{ with index $schema "description" }} {{ . | markdownify }} {{ else }}

Schema: {{ $schemaType }}

{{ end }} {{ if gt (len (index $fields "rows")) 0 }}

FieldTypeRequiredDescription
{{ range index $fields "rows" }}{{ .name }}{{ partial "rest-apis/schema-type.html" (index . "schema") }}{{ if .required }}Yes{{ else }}No{{ end }}
{{ end }}

{{ else if index $schema "oneOf" }} {{ range index $schema "oneOf" }} {{ $variantFields := partial "rest-apis/schema-properties.html" . }}

{{ index . "title" | default (partial "rest-apis/schema-type.html" .) }}

{{ with index . "description" }} {{ . | markdownify }} {{ end }} {{ if gt (len (index $variantFields "rows")) 0 }}

FieldTypeRequiredDescription
{{ range index $variantFields "rows" }}{{ .name }}{{ partial "rest-apis/schema-type.html" (index . "schema") }}{{ if .required }}Yes{{ else }}No{{ end }}
{{ end }}

{{ else }}

Schema: {{ partial "rest-apis/schema-type.html" . }}

{{ end }} {{ end }} {{ else }}

Schema: {{ $schemaType }}

{{ end }} {{ if $example }}

Example response

{{ if or (reflect.IsMap $example) (reflect.IsSlice $example) }}{{ $example | jsonify (dict "indent" " ") }}{{ else }}{{ $example }}{{ end }}

{{ end }} {{ end }} {{ end }} {{ end }} {{ end }}