Partilhar via


Api Diagnostic - List By Service

Lists all diagnostics of an API.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics?api-version=2021-08-01
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/diagnostics?$filter={$filter}&$top={$top}&$skip={$skip}&api-version=2021-08-01

URI Parameters

Name In Required Type Description
apiId
path True

string

API identifier. Must be unique in the current API Management service instance.

resourceGroupName
path True

string

The name of the resource group.

serviceName
path True

string

The name of the API Management service.

Regex pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

subscriptionId
path True

string

Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.

api-version
query True

string

Version of the API to be used with the client request.

$filter
query

string

| Field | Usage | Supported operators | Supported functions |
|-------------|-------------|-------------|-------------|
| name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, endswith |

$skip
query

integer

int32

Number of records to skip.

$top
query

integer

int32

Number of records to return.

Responses

Name Type Description
200 OK

DiagnosticCollection

Paged Result response of diagnostics for an API.

Other Status Codes

ErrorResponse

Error response describing why the operation failed.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

ApiManagementListApiDiagnostics

Sample request

GET https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api/diagnostics?api-version=2021-08-01

Sample response

{
  "value": [
    {
      "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api/diagnostics/applicationinsights",
      "type": "Microsoft.ApiManagement/service/apis/diagnostics",
      "name": "applicationinsights",
      "properties": {
        "alwaysLog": "allErrors",
        "httpCorrelationProtocol": "Legacy",
        "logClientIp": true,
        "loggerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/aisamplingtest",
        "sampling": {
          "samplingType": "fixed",
          "percentage": 100
        },
        "frontend": {
          "request": {
            "headers": [],
            "body": {
              "bytes": 100
            }
          },
          "response": {
            "headers": [],
            "body": {
              "bytes": 100
            }
          }
        },
        "backend": {
          "request": {
            "headers": [],
            "body": {
              "bytes": 100
            }
          },
          "response": {
            "headers": [],
            "body": {
              "bytes": 100
            }
          }
        }
      }
    }
  ],
  "count": 1
}

Definitions

Name Description
AlwaysLog

Specifies for what type of messages sampling settings should not apply.

BodyDiagnosticSettings

Body logging settings.

DataMasking
DataMaskingEntity
DataMaskingMode

Data masking mode.

DiagnosticCollection

Paged Diagnostic list representation.

DiagnosticContract

Diagnostic details.

ErrorFieldContract

Error Field contract.

ErrorResponse

Error Response.

HttpCorrelationProtocol

Sets correlation protocol to use for Application Insights diagnostics.

HttpMessageDiagnostic

Http message diagnostic settings.

OperationNameFormat

The format of the Operation Name for Application Insights telemetries. Default is Name.

PipelineDiagnosticSettings

Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.

SamplingSettings

Sampling settings for Diagnostic.

SamplingType

Sampling type.

Verbosity

The verbosity level applied to traces emitted by trace policies.

AlwaysLog

Specifies for what type of messages sampling settings should not apply.

Name Type Description
allErrors

string

Always log all erroneous request regardless of sampling settings.

BodyDiagnosticSettings

Body logging settings.

Name Type Description
bytes

integer

Number of request body bytes to log.

DataMasking

Name Type Description
headers

DataMaskingEntity[]

Masking settings for headers

queryParams

DataMaskingEntity[]

Masking settings for Url query parameters

DataMaskingEntity

Name Type Description
mode

DataMaskingMode

Data masking mode.

value

string

The name of an entity to mask (e.g. a name of a header or a query parameter).

DataMaskingMode

Data masking mode.

Name Type Description
Hide

string

Hide the presence of an entity.

Mask

string

Mask the value of an entity.

DiagnosticCollection

Paged Diagnostic list representation.

Name Type Description
count

integer

Total record count number across all pages.

nextLink

string

Next page link if any.

value

DiagnosticContract[]

Page values.

DiagnosticContract

Diagnostic details.

Name Type Description
id

string

Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

The name of the resource

properties.alwaysLog

AlwaysLog

Specifies for what type of messages sampling settings should not apply.

properties.backend

PipelineDiagnosticSettings

Diagnostic settings for incoming/outgoing HTTP messages to the Backend

properties.frontend

PipelineDiagnosticSettings

Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.

properties.httpCorrelationProtocol

HttpCorrelationProtocol

Sets correlation protocol to use for Application Insights diagnostics.

properties.logClientIp

boolean

Log the ClientIP. Default is false.

properties.loggerId

string

Resource Id of a target logger.

properties.metrics

boolean

Emit custom metrics via emit-metric policy. Applicable only to Application Insights diagnostic settings.

properties.operationNameFormat

OperationNameFormat

The format of the Operation Name for Application Insights telemetries. Default is Name.

properties.sampling

SamplingSettings

Sampling settings for Diagnostic.

properties.verbosity

Verbosity

The verbosity level applied to traces emitted by trace policies.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

ErrorFieldContract

Error Field contract.

Name Type Description
code

string

Property level error code.

message

string

Human-readable representation of property-level error.

target

string

Property name.

ErrorResponse

Error Response.

Name Type Description
error.code

string

Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.

error.details

ErrorFieldContract[]

The list of invalid fields send in request, in case of validation error.

error.message

string

Human-readable representation of the error.

HttpCorrelationProtocol

Sets correlation protocol to use for Application Insights diagnostics.

Name Type Description
Legacy

string

Inject Request-Id and Request-Context headers with request correlation data. See https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md.

None

string

Do not read and inject correlation headers.

W3C

string

Inject Trace Context headers. See https://w3c.github.io/trace-context.

HttpMessageDiagnostic

Http message diagnostic settings.

Name Type Description
body

BodyDiagnosticSettings

Body logging settings.

dataMasking

DataMasking

Data masking settings.

headers

string[]

Array of HTTP Headers to log.

OperationNameFormat

The format of the Operation Name for Application Insights telemetries. Default is Name.

Name Type Description
Name

string

API_NAME;rev=API_REVISION - OPERATION_NAME

Url

string

HTTP_VERB URL

PipelineDiagnosticSettings

Diagnostic settings for incoming/outgoing HTTP messages to the Gateway.

Name Type Description
request

HttpMessageDiagnostic

Diagnostic settings for request.

response

HttpMessageDiagnostic

Diagnostic settings for response.

SamplingSettings

Sampling settings for Diagnostic.

Name Type Description
percentage

number

Rate of sampling for fixed-rate sampling.

samplingType

SamplingType

Sampling type.

SamplingType

Sampling type.

Name Type Description
fixed

string

Fixed-rate sampling.

Verbosity

The verbosity level applied to traces emitted by trace policies.

Name Type Description
error

string

Only traces with 'severity' set to 'error' will be sent to the logger attached to this diagnostic instance.

information

string

Traces with 'severity' set to 'information' and 'error' will be sent to the logger attached to this diagnostic instance.

verbose

string

All the traces emitted by trace policies will be sent to the logger attached to this diagnostic instance.