swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: Azure Application Insights client for saved items.
  title: ApplicationInsightsManagementClient
  version: 2015-05-01
  x-apisguru-categories:
    - cloud
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_assets.onestore.ms_cdnfiles_onestorerolling-1606-01000_shell_v3_images_logo_microsoft.png
  x-origin:
    - format: swagger
      url: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/applicationinsights/resource-manager/Microsoft.Insights/stable/2015-05-01/analyticsItems_API.json
      version: "2.0"
  x-providerName: azure.com
  x-serviceName: applicationinsights-analyticsItems_API
  x-tags:
    - Azure
    - Microsoft
consumes:
  - application/json
produces:
  - application/json
securityDefinitions:
  azure_auth:
    authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
    description: Azure Active Directory OAuth2 Flow.
    flow: implicit
    scopes:
      user_impersonation: impersonate your user account
    type: oauth2
security:
  - azure_auth:
      - user_impersonation
parameters:
  IncludeContentParameter:
    description: Flag indicating whether or not to return the content of each applicable item. If false, only return the item information.
    in: query
    name: includeContent
    required: false
    type: boolean
    x-ms-parameter-location: method
  ItemIdParameter:
    description: The Id of a specific item defined in the Application Insights component
    in: query
    name: id
    required: false
    type: string
    x-ms-parameter-location: method
  ItemNameParameter:
    description: The name of a specific item defined in the Application Insights component
    in: query
    name: name
    required: false
    type: string
    x-ms-parameter-location: method
  ItemScopeParameter:
    default: shared
    description: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
    enum:
      - shared
      - user
    in: query
    name: scope
    required: false
    type: string
    x-ms-enum:
      modelAsString: true
      name: ItemScope
    x-ms-parameter-location: method
  ItemScopePathParameter:
    description: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
    enum:
      - analyticsItems
      - myanalyticsItems
    in: path
    name: scopePath
    required: true
    type: string
    x-ms-enum:
      modelAsString: true
      name: ItemScopePath
    x-ms-parameter-location: method
  ItemTypeParameter:
    default: none
    description: Enum indicating the type of the Analytics item.
    enum:
      - none
      - query
      - function
      - folder
      - recent
    in: query
    name: type
    required: false
    type: string
    x-ms-enum:
      modelAsString: true
      name: ItemTypeParameter
    x-ms-parameter-location: method
  OverrideItemParameter:
    description: Flag indicating whether or not to force save an item. This allows overriding an item if it already exists.
    in: query
    name: overrideItem
    required: false
    type: boolean
    x-ms-parameter-location: method
  ResourceNameParameter:
    description: The name of the Application Insights component resource.
    in: path
    name: resourceName
    required: true
    type: string
    x-ms-parameter-location: method
paths:
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}":
    get:
      description: Gets a list of Analytics Items defined within an Application Insights component.
      operationId: AnalyticsItems_List
      parameters:
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - $ref: "#/parameters/ResourceNameParameter"
        - $ref: "#/parameters/ItemScopePathParameter"
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - $ref: "#/parameters/ItemScopeParameter"
        - $ref: "#/parameters/ItemTypeParameter"
        - $ref: "#/parameters/IncludeContentParameter"
      responses:
        "200":
          description: A list containing 0 or more items associated with the Application Insights component.
          schema:
            items:
              $ref: "#/definitions/ApplicationInsightsComponentAnalyticsItem"
            type: array
      x-ms-examples:
        AnalyticsItemList:
          parameters:
            api-version: 2015-05-01
            resourceGroupName: my-resource-group
            resourceName: my-component
            scopePath: analyticsItems
            subscriptionId: subid
          responses:
            "200":
              body:
                - Content: |-
                    //Top 10 countries by traffic in the past 24 hours
                    requests 
                     | where  timestamp > ago(24h) 
                     | summarize count() by client_CountryOrRegion
                     | top 10 by count_ 
                     | render piechart
                  Id: b753348d-333a-4678-a684-c0e9090713b7
                  Name: "1"
                  Scope: user
                  TimeCreated: null
                  TimeModified: 2017-06-29T10:27:03Z
                  Type: query
                  Version: "1.0"
                - Content: |-
                    //Top 10 countries by traffic in the past 24 hours
                    requests 
                     | where  timestamp > ago(24h) 
                     | summarize count() by client_CountryOrRegion
                     | top 10 by count_ 
                     | render piechart
                  Id: 0d2f1b19-04b2-4c93-bc6f-2466b23c5284
                  Name: "4"
                  Scope: user
                  TimeCreated: null
                  TimeModified: 2017-06-29T10:27:13Z
                  Type: query
                  Version: "1.0"
                - Content: |-
                    //Top 10 countries by traffic in the past 24 hours
                    requests 
                     | where  timestamp > ago(24h) 
                     | summarize count() by client_CountryOrRegion
                     | top 10 by count_ 
                     | render piechart
                  Id: 3d17bebb-0b20-4b58-9bbd-22aeed70be51
                  Name: "2"
                  Scope: user
                  TimeCreated: null
                  TimeModified: 2018-02-10T23:21:05.9952874Z
                  Type: query
                  Version: "1.0"
                - Content: |-
                    //Top 10 countries by traffic in the past 24 hours
                    requests 
                     | where  timestamp > ago(24h) 
                     | summarize count() by client_CountryOrRegion
                     | top 10 by count_ 
                     | render piechart
                  Id: 2be491c6-10d9-4cf6-9490-2a7ce7270c54
                  Name: "5"
                  Scope: user
                  TimeCreated: null
                  TimeModified: 2017-06-29T10:27:17Z
                  Type: query
                  Version: "1.0"
                - Content: |-
                    //Top 10 countries by traffic in the past 24 hours
                    requests 
                     | where  timestamp > ago(24h) 
                     | summarize count() by client_CountryOrRegion
                     | top 10 by count_ 
                     | render piechart
                  Id: d8f83601-4a40-4dc1-8516-0a28dcb74420
                  Name: "8"
                  Scope: user
                  TimeCreated: 2018-02-10T23:20:19.0174631Z
                  TimeModified: 2018-02-10T23:20:19.0174631Z
                  Type: query
                  Version: "1.0"
                - Content: |
                    let newExceptionsTimeRange = 7d;
                    let timeRangeToCheckBefore = 7d;
                    exceptions
                    | where timestamp < ago(timeRangeToCheckBefore)
                    | summarize count() by problemId
                    | join kind= rightanti (
                    exceptions
                    | where timestamp >= ago(newExceptionsTimeRange)
                    | extend stack = tostring(details[0].rawStack)
                    | summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId  
                    ) on problemId 
                    | order by  count_ desc
                  Id: fd3afe4d-9139-4c76-9b47-81d0fada977b
                  Name: Exceptions - New in the last 7 days
                  Scope: user
                  TimeCreated: 2018-02-11T22:05:57.6019354Z
                  TimeModified: 2018-02-12T11:01:15.5687326Z
                  Type: query
                  Version: "1.0"
                - Content: |
                    let newExceptionsTimeRange = 1d;
                    let timeRangeToCheckBefore = 7d;
                    exceptions
                    | where timestamp < ago(timeRangeToCheckBefore)
                    | summarize count() by problemId
                    | join kind= rightanti (
                    exceptions
                    | where timestamp >= ago(newExceptionsTimeRange)
                    | extend stack = tostring(details[0].rawStack)
                    | summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId  
                    ) on problemId 
                    | order by  count_ desc
                  Id: 3466c160-4a10-4df8-afdf-0007f3f6dee5
                  Name: Exceptions - New in the last 24 hours
                  Scope: shared
                  TimeCreated: 2018-02-12T11:44:39.2980634Z
                  TimeModified: 2018-02-14T13:13:19.3381394Z
                  Type: query
                  Version: "1.0"
  "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item":
    delete:
      description: Deletes a specific Analytics Items defined within an Application Insights component.
      operationId: AnalyticsItems_Delete
      parameters:
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - $ref: "#/parameters/ResourceNameParameter"
        - $ref: "#/parameters/ItemScopePathParameter"
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - $ref: "#/parameters/ItemIdParameter"
        - $ref: "#/parameters/ItemNameParameter"
      responses:
        "200":
          description: The item has been successfully removed from the Application Insights component
      x-ms-examples:
        AnalyticsItemDelete:
          parameters:
            api-version: 2015-05-01
            id: 3466c160-4a10-4df8-afdf-0007f3f6dee5
            resourceGroupName: my-resource-group
            resourceName: my-component
            scope: shared
            scopePath: analyticsItems
            subscriptionId: subid
          responses:
            "200": {}
    get:
      description: Gets a specific Analytics Items defined within an Application Insights component.
      operationId: AnalyticsItems_Get
      parameters:
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - $ref: "#/parameters/ResourceNameParameter"
        - $ref: "#/parameters/ItemScopePathParameter"
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - $ref: "#/parameters/ItemIdParameter"
        - $ref: "#/parameters/ItemNameParameter"
      responses:
        "200":
          description: A single item associated with the Application Insights component.
          schema:
            $ref: "#/definitions/ApplicationInsightsComponentAnalyticsItem"
      x-ms-examples:
        AnalyticsItemGet:
          parameters:
            api-version: 2015-05-01
            id: 3466c160-4a10-4df8-afdf-0007f3f6dee5
            resourceGroupName: my-resource-group
            resourceName: my-component
            scope: shared
            scopePath: analyticsItems
            subscriptionId: subid
          responses:
            "200":
              body:
                Content: |
                  let newExceptionsTimeRange = 1d;
                  let timeRangeToCheckBefore = 7d;
                  exceptions
                  | where timestamp < ago(timeRangeToCheckBefore)
                  | summarize count() by problemId
                  | join kind= rightanti (
                  exceptions
                  | where timestamp >= ago(newExceptionsTimeRange)
                  | extend stack = tostring(details[0].rawStack)
                  | summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId  
                  ) on problemId 
                  | order by  count_ desc
                Id: 3466c160-4a10-4df8-afdf-0007f3f6dee5
                Name: Exceptions - New in the last 24 hours
                Scope: shared
                TimeCreated: 2018-02-12T11:44:39.2980634Z
                TimeModified: 2018-02-14T13:13:19.3381394Z
                Type: query
                Version: "1.0"
    put:
      description: Adds or Updates a specific Analytics Item within an Application Insights component.
      operationId: AnalyticsItems_Put
      parameters:
        - description: The ID of the target subscription.
          in: path
          minLength: 1
          name: subscriptionId
          required: true
          type: string
        - description: The name of the resource group. The name is case insensitive.
          in: path
          maxLength: 90
          minLength: 1
          name: resourceGroupName
          pattern: ^[-\w\._\(\)]+$
          required: true
          type: string
          x-ms-parameter-location: method
        - $ref: "#/parameters/ResourceNameParameter"
        - $ref: "#/parameters/ItemScopePathParameter"
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - $ref: "#/parameters/OverrideItemParameter"
        - description: Properties that need to be specified to create a new item and add it to an Application Insights component.
          in: body
          name: itemProperties
          required: true
          schema:
            $ref: "#/definitions/ApplicationInsightsComponentAnalyticsItem"
      responses:
        "200":
          description: The new or updated item associated with the Application Insights component.
          schema:
            $ref: "#/definitions/ApplicationInsightsComponentAnalyticsItem"
      x-ms-examples:
        AnalyticsItemPut:
          parameters:
            api-version: 2015-05-01
            id: 3466c160-4a10-4df8-afdf-0007f3f6dee5
            itemProperties:
              Content: |
                let newExceptionsTimeRange = 1d;
                let timeRangeToCheckBefore = 7d;
                exceptions
                | where timestamp < ago(timeRangeToCheckBefore)
                | summarize count() by problemId
                | join kind= rightanti (
                exceptions
                | where timestamp >= ago(newExceptionsTimeRange)
                | extend stack = tostring(details[0].rawStack)
                | summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId  
                ) on problemId 
                | order by  count_ desc
              Name: Exceptions - New in the last 24 hours
              Scope: shared
              Type: query
            resourceGroupName: my-resource-group
            resourceName: my-component
            scope: shared
            scopePath: analyticsItems
            subscriptionId: subid
          responses:
            "200":
              body:
                Content: |
                  let newExceptionsTimeRange = 1d;
                  let timeRangeToCheckBefore = 7d;
                  exceptions
                  | where timestamp < ago(timeRangeToCheckBefore)
                  | summarize count() by problemId
                  | join kind= rightanti (
                  exceptions
                  | where timestamp >= ago(newExceptionsTimeRange)
                  | extend stack = tostring(details[0].rawStack)
                  | summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId  
                  ) on problemId 
                  | order by  count_ desc
                Id: 3466c160-4a10-4df8-afdf-0007f3f6dee5
                Name: Exceptions - New in the last 24 hours
                Scope: shared
                TimeCreated: 2018-02-12T11:44:39.2980634Z
                TimeModified: 2018-02-14T13:13:19.3381394Z
                Type: query
                Version: "1.0"
definitions:
  ApplicationInsightsComponentAnalyticsItem:
    description: Properties that define an Analytics item that is associated to an Application Insights component.
    properties:
      Content:
        description: The content of this item
        type: string
      Id:
        description: Internally assigned unique id of the item definition.
        type: string
      Name:
        description: The user-defined name of the item.
        type: string
      Properties:
        $ref: "#/definitions/ApplicationInsightsComponentAnalyticsItemProperties"
      Scope:
        description: Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component.
        enum:
          - shared
          - user
        type: string
        x-ms-enum:
          modelAsString: true
          name: ItemScope
      TimeCreated:
        description: Date and time in UTC when this item was created.
        readOnly: true
        type: string
      TimeModified:
        description: Date and time in UTC of the last modification that was made to this item.
        readOnly: true
        type: string
      Type:
        description: Enum indicating the type of the Analytics item.
        enum:
          - query
          - function
          - folder
          - recent
        type: string
        x-ms-enum:
          modelAsString: true
          name: ItemType
      Version:
        description: This instance's version of the data model. This can change as new features are added.
        readOnly: true
        type: string
    type: object
  ApplicationInsightsComponentAnalyticsItemProperties:
    description: A set of properties that can be defined in the context of a specific item type. Each type may have its own properties.
    properties:
      functionAlias:
        description: A function alias, used when the type of the item is Function
        type: string
    type: object
