swagger: "2.0"
schemes:
  - https
host: management.azure.com
info:
  description: Azure Application Insights workbook type.
  title: ApplicationInsightsManagementClient
  version: 2018-06-17-preview
  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/preview/2018-06-17-preview/workbooks_API.json
      version: "2.0"
  x-preferred: true
  x-providerName: azure.com
  x-serviceName: applicationinsights-workbooks_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:
  CanFetchWorkbookContentParameter:
    description: Flag indicating whether or not to return the full content for each applicable workbook. If false, only return summary content for workbooks.
    in: query
    name: canFetchContent
    required: false
    type: boolean
    x-ms-parameter-location: method
  CategoryParameter:
    description: Category of workbook to return.
    enum:
      - workbook
      - TSG
      - performance
      - retention
    in: query
    name: category
    required: true
    type: string
    x-ms-enum:
      modelAsString: true
      name: CategoryType
    x-ms-parameter-location: method
  SourceIdParameter:
    description: Azure Resource Id that will fetch all related workbooks.
    in: query
    name: sourceId
    required: true
    type: string
    x-ms-parameter-location: method
  TagsParameter:
    collectionFormat: csv
    description: Tags presents on each workbook returned.
    in: query
    items:
      type: string
    name: tags
    required: false
    type: array
    x-ms-parameter-location: method
  WorkbookResourceNameParameter:
    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}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks":
    get:
      description: Get all Workbooks defined within a specified resource group and category.
      operationId: Workbooks_ListByResourceGroup
      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/CategoryParameter"
        - $ref: "#/parameters/TagsParameter"
        - $ref: "#/parameters/SourceIdParameter"
        - $ref: "#/parameters/CanFetchWorkbookContentParameter"
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: A list containing 0 or more workbook definitions.
          schema:
            $ref: "#/definitions/WorkbooksListResult"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/WorkbookError"
      x-ms-examples:
        WorkbooksList:
          parameters:
            api-version: 2018-06-17-preview
            category: workbook
            resourceGroupName: my-resource-group
            sourceId: /subscriptions/ad2f1a83-caac-4e21-9d2a-9ca3f87105e2/resourceGroups/Default-Web-WestUS/providers/Microsoft.Web/sites/MyTestApp-CodeLens1
            subscriptionId: 6b643656-33eb-422f-aee8-3ac145d124af
          responses:
            "200":
              body:
                - id: c0deea5e-3344-40f2-96f8-6f8e1c3b5722
                  kind: shared
                  location: westus
                  name: deadb33f-8bee-4d3b-a059-9be8dac93960
                  properties:
                    category: workbook
                    displayName: My Workbook 1
                    serializedData: "{\"verion\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook.  This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"
                    timeModified: null
                    userId: userId
                    version: ME
                  tags: []
                  type: ""
                - id: c0deea5e-3344-40f2-96f8-6f8e1c3b5722
                  kind: shared
                  location: westus
                  name: deadb33f-8bee-4d3b-a059-9be8dac93960
                  properties:
                    category: workbook
                    displayName: My Workbook 2
                    serializedData: "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook.  This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"
                    timeModified: null
                    userId: userId
                    version: ME
                  tags:
                    - SampleTag01
                    - SampleTag2
                  type: ""
      x-ms-pageable:
        nextLinkName: null
  "/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}":
    delete:
      description: Delete a workbook.
      operationId: Workbooks_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/WorkbookResourceNameParameter"
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
      responses:
        "201":
          description: The workbook has been successfully deleted.
        "204":
          description: The resource doesn't exist.
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/WorkbookError"
      x-ms-examples:
        WorkbookDelete:
          parameters:
            api-version: 2018-06-17-preview
            resourceGroupName: my-resource-group
            resourceName: deadb33f-5e0d-4064-8ebb-1a4ed0313eb2
            subscriptionId: subid
          responses:
            "201": {}
            "204": {}
    get:
      description: Get a single workbook by its resourceName.
      operationId: Workbooks_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/WorkbookResourceNameParameter"
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
      responses:
        "200":
          description: A workbook definition.
          schema:
            $ref: "#/definitions/Workbook"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/WorkbookError"
      x-ms-examples:
        WorkbookGet:
          parameters:
            api-version: 2018-06-17-preview
            resourceGroupName: my-resource-group
            resourceName: deadb33f-5e0d-4064-8ebb-1a4ed0313eb2
            subscriptionId: 6b643656-33eb-422f-aee8-3ac145d124af
          responses:
            "200":
              body:
                id: c0deea5e-3344-40f2-96f8-6f8e1c3b5722
                kind: shared
                location: westus
                name: deadb33f-8bee-4d3b-a059-9be8dac93960
                properties:
                  category: workbook
                  displayName: My New Workbook
                  serializedData: "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook.  This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"
                  timeModified: null
                  userId: userId
                  version: ME
                tags: null
                type: ""
    patch:
      description: Updates a workbook that has already been added.
      operationId: Workbooks_Update
      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/WorkbookResourceNameParameter"
        - $ref: "#/parameters/SourceIdParameter"
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - description: Properties that need to be specified to create a new workbook.
          in: body
          name: WorkbookUpdateParameters
          required: false
          schema:
            $ref: "#/definitions/WorkbookUpdateParameters"
      responses:
        "200":
          description: The workbook definition updated.
          schema:
            $ref: "#/definitions/Workbook"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/WorkbookError"
      x-ms-examples:
        WorkbookUpdate:
          parameters:
            api-version: 2018-06-17-preview
            resourceGroupName: my-resource-group
            resourceName: deadb33f-5e0d-4064-8ebb-1a4ed0313eb2
            sourceId: /subscriptions/ad2f1a83-caac-4e21-9d2a-9ca3f87105e2/resourceGroups/Default-Web-WestUS/providers/Microsoft.Web/sites/MyTestApp-CodeLens1
            subscriptionId: 6b643656-33eb-422f-aee8-3ac145d124af
            workbookProperties:
              kind: shared
              location: west us
              name: deadb33f-8bee-4d3b-a059-9be8dac93960
              properties:
                category: workbook
                displayName: Blah Blah Blah
                serializedData: "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook.  This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"
                timeModified: null
                userId: userId
                version: ME
              tags: null
          responses:
            "200":
              body:
                id: c0deea5e-3344-40f2-96f8-6f8e1c3b5722
                kind: shared
                location: westus
                name: deadb33f-8bee-4d3b-a059-9be8dac93960
                properties:
                  category: workbook
                  displayName: Blah Blah Blah
                  serializedData: "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook.  This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"
                  timeModified: null
                  userId: userId
                  version: ME
                tags: null
                type: ""
    put:
      description: Create a new workbook.
      operationId: Workbooks_CreateOrUpdate
      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/WorkbookResourceNameParameter"
        - $ref: "#/parameters/SourceIdParameter"
        - description: The API version to use for this operation.
          in: query
          minLength: 1
          name: api-version
          required: true
          type: string
        - description: Properties that need to be specified to create a new workbook.
          in: body
          name: workbookProperties
          required: true
          schema:
            $ref: "#/definitions/Workbook"
      responses:
        "200":
          description: The newly created workbook.
          schema:
            $ref: "#/definitions/Workbook"
        "201":
          description: The newly created workbook.
          schema:
            $ref: "#/definitions/Workbook"
        default:
          description: Error response describing why the operation failed.
          schema:
            $ref: "#/definitions/WorkbookError"
      x-ms-examples:
        WorkbookAdd:
          parameters:
            api-version: 2018-06-17-preview
            resourceGroupName: my-resource-group
            resourceName: deadb33f-8bee-4d3b-a059-9be8dac93960
            sourceId: /subscriptions/ad2f1a83-caac-4e21-9d2a-9ca3f87105e2/resourceGroups/Default-Web-WestUS/providers/Microsoft.Web/sites/MyTestApp-CodeLens1
            subscriptionId: subid
            workbookProperties:
              id: c0deea5e-3344-40f2-96f8-6f8e1c3b5722
              kind: shared
              location: west us
              name: deadb33f-8bee-4d3b-a059-9be8dac93960
              properties:
                category: workbook
                displayName: Blah Blah Blah
                serializedData: "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook.  This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"
                timeModified: null
                userId: userId
                version: ME
              tags: null
          responses:
            "200":
              body:
                id: c0deea5e-3344-40f2-96f8-6f8e1c3b5722
                kind: shared
                location: westus
                name: deadb33f-8bee-4d3b-a059-9be8dac93960
                properties:
                  category: workbook
                  displayName: Blah Blah Blah
                  serializedData: "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook.  This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"
                  timeModified: null
                  userId: userId
                  version: ME
                tags: null
                type: ""
            "201":
              body:
                id: c0deea5e-3344-40f2-96f8-6f8e1c3b5722
                kind: shared
                location: westus
                name: deadb33f-8bee-4d3b-a059-9be8dac93960
                properties:
                  category: workbook
                  displayName: Blah Blah Blah
                  serializedData: "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":\"{\"json\":\"## New workbook\\r\\n---\\r\\n\\r\\nWelcome to your new workbook.  This area will display text formatted as markdown.\\r\\n\\r\\n\\r\\nWe've included a basic analytics query to get you started. Use the `Edit` button below each section to configure it or add more sections.\"}\",\"halfWidth\":null,\"conditionalVisibility\":null},{\"type\":3,\"content\":\"{\"version\":\"KqlItem/1.0\",\"query\":\"union withsource=TableName *\\n| summarize Count=count() by TableName\\n| render barchart\",\"showQuery\":false,\"size\":1,\"aggregation\":0,\"showAnnotations\":false}\",\"halfWidth\":null,\"conditionalVisibility\":null}],\"isLocked\":false}"
                  timeModified: null
                  userId: userId
                  version: ME
                tags: null
                type: ""
definitions:
  ErrorFieldContract:
    description: Error Field contract.
    properties:
      code:
        description: Property level error code.
        type: string
      message:
        description: Human-readable representation of property-level error.
        type: string
      target:
        description: Property name.
        type: string
  Resource:
    description: An azure resource object
    properties:
      id:
        description: Azure resource Id
        readOnly: true
        type: string
      kind:
        description: The kind of workbook. Choices are user and shared.
        enum:
          - user
          - shared
        type: string
        x-ms-enum:
          modelAsString: true
          name: SharedTypeKind
      location:
        description: Resource location
        type: string
        x-ms-mutability:
          - create
          - read
      name:
        description: Azure resource name. This is GUID value. The display name should be assigned within properties field.
        readOnly: true
        type: string
      tags:
        additionalProperties:
          type: string
        description: Resource tags
        type: object
      type:
        description: Azure resource type
        readOnly: true
        type: string
    required:
      - location
    x-ms-azure-resource: true
  Workbook:
    allOf:
      - $ref: "#/definitions/Resource"
    description: An Application Insights workbook definition.
    properties:
      properties:
        $ref: "#/definitions/WorkbookProperties"
        description: Metadata describing a workbook for an Azure resource.
        x-ms-client-flatten: true
  WorkbookError:
    description: Error message body that will indicate why the operation failed.
    properties:
      code:
        description: Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response.
        type: string
      details:
        description: The list of invalid fields send in request, in case of validation error.
        items:
          $ref: "#/definitions/ErrorFieldContract"
        type: array
      message:
        description: Human-readable representation of the error.
        type: string
  WorkbookProperties:
    description: Properties that contain a workbook.
    properties:
      category:
        description: Workbook category, as defined by the user at creation time.
        type: string
      displayName:
        description: The user-defined name (display name) of the workbook.
        type: string
      serializedData:
        description: Configuration of this particular workbook. Configuration data is a string containing valid JSON
        type: string
      tags:
        description: A list of 0 or more tags that are associated with this workbook definition
        items:
          type: string
        type: array
      timeModified:
        description: Date and time in UTC of the last modification that was made to this workbook definition.
        readOnly: true
        type: string
      userId:
        description: Unique user id of the specific user that owns this workbook.
        type: string
      version:
        description: Workbook version
        type: string
    required:
      - displayName
      - category
      - serializedData
      - userId
  WorkbookPropertiesUpdateParameters:
    description: Properties that contain a workbook for PATCH operation.
    properties:
      category:
        description: Workbook category, as defined by the user at creation time.
        type: string
      displayName:
        description: The user-defined name (display name) of the workbook.
        type: string
      serializedData:
        description: Configuration of this particular workbook. Configuration data is a string containing valid JSON
        type: string
      tags:
        description: A list of 0 or more tags that are associated with this workbook definition
        items:
          type: string
        type: array
  WorkbookUpdateParameters:
    description: The parameters that can be provided when updating workbook properties properties.
    properties:
      kind:
        description: The kind of workbook. Choices are user and shared.
        enum:
          - user
          - shared
        type: string
        x-ms-enum:
          modelAsString: true
          name: SharedTypeKind
      properties:
        $ref: "#/definitions/WorkbookPropertiesUpdateParameters"
        description: Metadata describing a workbook for an Azure resource.
        x-ms-client-flatten: true
      tags:
        additionalProperties:
          type: string
        description: Resource tags
        type: object
  WorkbooksListResult:
    description: Workbook list result.
    properties:
      value:
        description: An array of workbooks.
        items:
          $ref: "#/definitions/Workbook"
        type: array
