# Get APM logs

Retrieve APM logs generated for the context variable web hook. Logs are only generated when the web hook call fails, or response evaluation fails.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "APM",
    "version": "4.0.10"
  },
  "servers": [
    {
      "url": "https://apm.digitalcx.com",
      "description": "APM API"
    }
  ],
  "tags": [
    {
      "name": "APM",
      "description": "Conversational AI Cloud's APM API provides insights into web hook performance."
    }
  ],
  "paths": {
    "/{customerKey}/projects/{projectKey}/contextvariablewebhooklogs": {
      "get": {
        "tags": [
          "APM"
        ],
        "summary": "Get APM logs",
        "description": "Retrieve APM logs generated for the context variable web hook. Logs are only generated when the web hook call fails, or response evaluation fails.",
        "security": [
          {
            "accessToken": []
          }
        ],
        "parameters": [
          {
            "name": "customerKey",
            "in": "path",
            "description": "Customer identifier used for authenticating the request.",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "projectKey",
            "in": "path",
            "description": "Project identifier used for authenticating the request, and to determine what project environment the interaction will take place in.",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "name": "environment",
            "in": "query",
            "description": "The environment you want to retrieve logs from.",
            "schema": {
              "type": "string",
              "enum": [
                "development",
                "staging",
                "production"
              ]
            },
            "required": true
          },
          {
            "name": "date",
            "in": "query",
            "description": "The day to retrieve the logs for (YYYY-MM-DD).",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "$ref": "#/components/parameters/offsetParam"
          },
          {
            "$ref": "#/components/parameters/maxParam"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/APMLogAPI"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "offsetParam": {
        "name": "offset",
        "in": "query",
        "description": "Starting point in the data for the query",
        "schema": {
          "type": "integer",
          "format": "int32"
        },
        "required": false
      },
      "maxParam": {
        "name": "max",
        "in": "query",
        "description": "Maximum number of search results.",
        "schema": {
          "type": "integer",
          "format": "int32"
        },
        "required": false
      }
    },
    "securitySchemes": {
      "accessToken": {
        "description": "JWT used to access the APM API",
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "APMLogAPI": {
        "type": "object",
        "description": "Response object containing the logs for a specific web hook defined for this project.",
        "properties": {
          "result": {
            "type": "array",
            "description": "Array containing logs for a specific web hook.",
            "items": {
              "$ref": "#/components/schemas/APMLogObject"
            }
          },
          "total": {
            "type": "number",
            "description": "Total number of items in the result array.",
            "example": 1
          }
        }
      },
      "APMLogObject": {
        "type": "object",
        "properties": {
          "correlationId": {
            "type": "string",
            "description": "Guid generated for each web hook request to relate the request, and the APM logs.",
            "example": "00000000-0000-0000-000000000000"
          },
          "interactionId": {
            "type": "string",
            "description": "Guid generated for each request to the Gateway API which is used to identify the Gateway request in subsequent requests and reporting.",
            "example": "00000000-0000-0000-000000000000"
          },
          "requestStarted": {
            "type": "string",
            "description": "Timestamp on which the request reached the Gateway API",
            "example": "2022-01-01T00:00:00.3Z"
          },
          "requestMethod": {
            "type": "string",
            "description": "HTTP Method used to call the webhook",
            "example": "POST"
          },
          "requestUrl": {
            "type": "string",
            "description": "Url that was called to trigger the web hook",
            "example": "https://www.cm.com/api/webhook"
          },
          "responseStatus": {
            "type": "string",
            "description": "Response status returned from the web hook call",
            "example": "NotFound"
          },
          "responseBody": {
            "type": "string",
            "description": "Parsed response body returned from the web hook call",
            "example": "Not found"
          },
          "errorMessage": {
            "type": "string",
            "description": "Error message that caused the web hook call to fail.",
            "example": "Not found"
          },
          "responseStatusCode": {
            "type": "number",
            "description": "Response status code returned from the web hook call",
            "example": 404
          },
          "responseTime": {
            "type": "number",
            "description": "Response time in MS from the web hook call",
            "example": 704
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 102,
      "1": 39,
      "2": 114,
      "3": 29,
      "4": 105,
      "5": 62,
      "6": 69,
      "7": 0,
      "8": 16,
      "9": 196,
      "10": 142,
      "11": 176
    }
  }
}
```