{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Analytics Integration",
    "version": "9.1.20.0",
    "description": "Provide access to manage google analytics integration.",
    "x-introduced": "9.1.0.0"
  },
  "servers": [
    {
      "url": "https://{hostname}:{port}/rest/admin/v2",
      "variables": {
        "port": {
          "default": "443",
          "enum": [
            "443",
            "8000"
          ]
        },
        "hostname": {
          "default": "localhost",
          "enum": [
            "localhost",
            "test.hcl.com"
          ]
        }
      }
    }
  ],
  "tags": [
    {
      "name": "Google Analytics",
      "description": "Provides RESTful services to manage google analytics integration."
    }
  ],
  "paths": {
    "/google-analytics/token": {
      "get": {
        "tags": [
          "Google Analytics"
        ],
        "summary": "Get a Google Access Token, for use with Google Analytics.",
        "description": "Get a Google Access Token, for use with Google Analytics.",
        "operationId": "getGoogleOAuthAccessToken",
        "responses": {
          "200": {
            "description": "The request completed successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GoogleAccessToken"
                }
              }
            }
          },
          "400": {
            "description": "Bad request. The request could not be understood by the server due to malformed syntax.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. The user session is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "403": {
            "description": "The user is not authorized to perform the specified request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. For details, see the server log files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        }
      }
    },
    "/google-analytics/configuration": {
      "get": {
        "tags": [
          "Google Analytics"
        ],
        "summary": "Get a Google Access Token, for use with Google Analytics.",
        "description": "Get a Google Access Token, for use with Google Analytics.",
        "operationId": "getGoogleAnalyticsConfiguration",
        "parameters": [
          {
            "name": "storeId",
            "in": "query",
            "description": "The store to return the configuration for.  Default is store ID 0 (all stores)",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The request completed successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GoogleAnalyticsConfiguration"
                }
              }
            }
          },
          "400": {
            "description": "Bad request. The request could not be understood by the server due to malformed syntax.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated. The user session is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "403": {
            "description": "The user is not authorized to perform the specified request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error. For details, see the server log files.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponseContainer"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ErrorResponseContainer": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Error"
            }
          },
          "requestId": {
            "type": "string",
            "description": "The request identifier."
          }
        },
        "description": "The error message model."
      },
      "Error": {
        "type": "object",
        "properties": {
          "errorCode": {
            "type": "string",
            "description": "The error message code."
          },
          "errorMessage": {
            "type": "string",
            "description": "The error message."
          },
          "errorKey": {
            "type": "string",
            "description": "The error message key."
          },
          "errorParameters": {
            "type": "array",
            "description": "The arguments used to construct the error message.",
            "items": {
              "type": "object",
              "properties": {}
            }
          },
          "errorLevel": {
            "type": "string",
            "description": "The error level."
          },
          "errorHref": {
            "type": "string",
            "description": "The error hypertext reference."
          }
        },
        "description": "The error message item model."
      },
      "GoogleAccessTokenContainer": {
        "type": "object",
        "properties": {
          "response": {
            "$ref": "#/components/schemas/GoogleAccessToken"
          }
        },
        "description": "The google access token container."
      },
      "GoogleAccessToken": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "description": "The Google Access Token"
          },
          "expirationTime": {
            "type": "string",
            "description": "The Google Access Token expiration time"
          },
          "scopes": {
            "type": "string",
            "description": "The configured allowed scopes for Google Authorization"
          }
        }
      },
      "GoogleAnalyticsConfigurationContainer": {
        "type": "object",
        "properties": {
          "response": {
            "$ref": "#/components/schemas/GoogleAnalyticsConfiguration"
          }
        },
        "description": "The google analytics configuration container."
      },
      "GoogleAnalyticsConfiguration": {
        "type": "object",
        "properties": {
          "propertyGa4": {
            "type": "string",
            "description": "(GA4) The Google Analytics GA4 property ID the service account is allowed access to."
          },
          "viewId": {
            "type": "string",
            "description": "(Universal Analytics) The Google Analytics view ID the service account is allowed access to."
          },
          "scopes": {
            "type": "string",
            "description": "The configured allowed scopes for Google Authorization."
          }
        }
      }
    },
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "security": [
    {
      "basicAuth": []
    }
  ]
}
