Functions

Update an Function

Update an existing Function. This replaces the entire Function with the new data provided.

put/workspace/functions/{function_id}

Path parameters

function_idinteger required

A unique integer value identifying the function.

Request body

namestring required
activeboolean
runtime'azion_js'
  • azion_js - Azion JavaScript
execution_environment'firewall' | 'application'
  • firewall - Firewall
  • application - Application
codestring required

String containing the function code. Maximum size: 50.0MB

Example request

{
  "default_args": {
    "arg_01": "value_01"
  },
  "azion_form": {
    "type": "object",
    "properties": {
      "domain": {
        "type": "string",
        "title": "Domain",
        "description": "Domain where the cookie will be valid (use '.' at the beginning for subdomains)",
        "default": ".azion.com",
        "pattern": "^[.]?[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]*\\.[a-zA-Z]{2,}$"
      },
      "max_age": {
        "type": "integer",
        "title": "Max Age (seconds)",
        "description": "Cookie lifetime in seconds",
        "default": 180,
        "minimum": 1,
        "maximum": 31536000
      },
      "path": {
        "type": "string",
        "title": "Path",
        "description": "Path where the cookie will be valid",
        "default": "/",
        "pattern": "^/"
      },
      "values": {
        "type": "array",
        "title": "Test Variations",
        "description": "List of A/B test variations with their respective weights",
        "minItems": 2,
        "maxItems": 10,
        "items": {
          "type": "object",
          "properties": {
            "value": {
              "type": "string",
              "title": "Variation Value",
              "description": "Unique variation identifier",
              "minLength": 1,
              "maxLength": 50,
              "pattern": "^[a-zA-Z0-9_-]+$"
            },
            "weight": {
              "type": "integer",
              "title": "Weight",
              "description": "Variance weight (higher weight = higher probability)",
              "minimum": 1,
              "maximum": 100
            }
          },
          "required": [
            "value",
            "weight"
          ],
          "additionalProperties": false
        }
      }
    },
    "required": [
      "domain",
      "max_age",
      "path",
      "values"
    ],
    "additionalProperties": false
  }
}

Response

Function updated successfully.

statestring

Example response

{
  "data": {
    "default_args": {
      "arg_01": "value_01"
    },
    "azion_form": {
      "type": "object",
      "properties": {
        "domain": {
          "type": "string",
          "title": "Domain",
          "description": "Domain where the cookie will be valid (use '.' at the beginning for subdomains)",
          "default": ".azion.com",
          "pattern": "^[.]?[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]*\\.[a-zA-Z]{2,}$"
        },
        "max_age": {
          "type": "integer",
          "title": "Max Age (seconds)",
          "description": "Cookie lifetime in seconds",
          "default": 180,
          "minimum": 1,
          "maximum": 31536000
        },
        "path": {
          "type": "string",
          "title": "Path",
          "description": "Path where the cookie will be valid",
          "default": "/",
          "pattern": "^/"
        },
        "values": {
          "type": "array",
          "title": "Test Variations",
          "description": "List of A/B test variations with their respective weights",
          "minItems": 2,
          "maxItems": 10,
          "items": {
            "type": "object",
            "properties": {
              "value": {
                "type": "string",
                "title": "Variation Value",
                "description": "Unique variation identifier",
                "minLength": 1,
                "maxLength": 50,
                "pattern": "^[a-zA-Z0-9_-]+$"
              },
              "weight": {
                "type": "integer",
                "title": "Weight",
                "description": "Variance weight (higher weight = higher probability)",
                "minimum": 1,
                "maximum": 100
              }
            },
            "required": [
              "value",
              "weight"
            ],
            "additionalProperties": false
          }
        }
      },
      "required": [
        "domain",
        "max_age",
        "path",
        "values"
      ],
      "additionalProperties": false
    }
  }
}

Changes

No recorded changes to this endpoint across all 1 revision of this API.