---
updatedAt: 2026-03-01T18:59:08.000Z
agentTools:
  siteIndex: https://techdocs.akamai.com/llms.txt
  projectIndex: https://techdocs.akamai.com/test-ctr/llms.txt
---

# Check how functions work

```curl cURL
egcurl --eg-section default --request POST \
  --url "https://$hostname/test-management/v3/functional/functions/try-it" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --data '
{
    "functionExpression": "fn_getResponseHeaderValue(Server)",
    "variables": [
        {
            "variableName": "var1",
            "variableValue": "name"
        }
    ],
    "responseData": {
        "response": {
            "status": 200,
            "statusText": "OK",
            "httpVersion": "HTTP/1.1",
            "cookies": [],
            "headers": [
                {
                    "name": "Server",
                    "value": "Apache/2.2.15 (CentOS)"
                },
                {
                    "name": "Content-Type",
                    "value": "text/html; charset=utf-8"
                },
                {
                    "name": "Content-Encoding",
                    "value": "gzip"
                },
                {
                    "name": "Cache-Control",
                    "value": "no-cache, no-store"
                },
                {
                    "name": "Date",
                    "value": "Tue, 14 Mar 2023 16:30:14 GMT"
                },
                {
                    "name": "Content-Length",
                    "value": "37120"
                },
                {
                    "name": "Vary",
                    "value": "Accept-Encoding"
                },
                {
                    "name": "Set-Cookie",
                    "value": "id=abc; path=/; Secure;domain=example.com"
                },
                {
                    "name": "Set-Cookie",
                    "value": "theme=light"
                },
                {
                    "name": "Set-Cookie",
                    "value": "sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT"
                }
            ]
        }
    }
}'
```

```node Node
const EdgeGrid = require("akamai-edgegrid");
const os = require("os");
const edgercPath = os.homedir + "/.edgerc";
const edgercSection = "default";
const eg = new EdgeGrid({
  path: edgercPath,
  section: edgercSection,
});

eg.auth({
  path: `/test-management/v3/functional/functions/try-it`,
  method: "POST",
  headers: {
    "Content-Type": "application/json",

    Accept: "application/json",
  },
  body: {
    functionExpression: "fn_getResponseHeaderValue(Server)",
    variables: [
      {
        variableName: "var1",
        variableValue: "name",
      },
    ],
    responseData: {
      response: {
        status: 200,
        statusText: "OK",
        httpVersion: "HTTP/1.1",
        cookies: [],
        headers: [
          {
            name: "Server",
            value: "Apache/2.2.15 (CentOS)",
          },
          {
            name: "Content-Type",
            value: "text/html; charset=utf-8",
          },
          {
            name: "Content-Encoding",
            value: "gzip",
          },
          {
            name: "Cache-Control",
            value: "no-cache, no-store",
          },
          {
            name: "Date",
            value: "Tue, 14 Mar 2023 16:30:14 GMT",
          },
          {
            name: "Content-Length",
            value: "37120",
          },
          {
            name: "Vary",
            value: "Accept-Encoding",
          },
          {
            name: "Set-Cookie",
            value: "id=abc; path=/; Secure;domain=example.com",
          },
          {
            name: "Set-Cookie",
            value: "theme=light",
          },
          {
            name: "Set-Cookie",
            value: "sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT",
          },
        ],
      },
    },
  },
});
eg.send(function (error, response, body) {
  console.log(JSON.stringify(JSON.parse(body), null, 2));
});
```

```python Python
import requests
import json
from akamai.edgegrid import EdgeGridAuth, EdgeRc
from urllib.parse import urljoin

edgerc = EdgeRc('~/.edgerc')
section = 'default'
baseurl = 'https://%s' % edgerc.get(section, 'host')

session = requests.Session()
session.auth = EdgeGridAuth.from_edgerc(edgerc, section)
 

path = '/test-management/v3/functional/functions/try-it'
headers = {
  "Content-Type": "application/json",

  "Accept": "application/json"}
payload = {
    "functionExpression": "fn_getResponseHeaderValue(Server)",
    "variables": [
        {
            "variableName": "var1",
            "variableValue": "name"
        }
    ],
    "responseData": {
        "response": {
            "status": 200,
            "statusText": "OK",
            "httpVersion": "HTTP/1.1",
            "cookies": [],
            "headers": [
                {
                    "name": "Server",
                    "value": "Apache/2.2.15 (CentOS)"
                },
                {
                    "name": "Content-Type",
                    "value": "text/html; charset=utf-8"
                },
                {
                    "name": "Content-Encoding",
                    "value": "gzip"
                },
                {
                    "name": "Cache-Control",
                    "value": "no-cache, no-store"
                },
                {
                    "name": "Date",
                    "value": "Tue, 14 Mar 2023 16:30:14 GMT"
                },
                {
                    "name": "Content-Length",
                    "value": "37120"
                },
                {
                    "name": "Vary",
                    "value": "Accept-Encoding"
                },
                {
                    "name": "Set-Cookie",
                    "value": "id=abc; path=/; Secure;domain=example.com"
                },
                {
                    "name": "Set-Cookie",
                    "value": "theme=light"
                },
                {
                    "name": "Set-Cookie",
                    "value": "sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT"
                }
            ]
        }
    }
}  

result = session.post(urljoin(baseurl, path), headers=headers, json=payload)
print(result.status_code)
print(json.dumps(result.json(), indent=2)) 
```

```json Response Example
{
  "functionExpression": "fn_getResponseHeaderValue(Server)",
  "responseData": {
    "response": {
      "cookies": [],
      "headers": [
        {
          "name": "Server",
          "value": "Apache/2.2.15 (CentOS)"
        },
        {
          "name": "Content-Type",
          "value": "text/html; charset=utf-8"
        },
        {
          "name": "Content-Encoding",
          "value": "gzip"
        },
        {
          "name": "Cache-Control",
          "value": "no-cache, no-store"
        },
        {
          "name": "Date",
          "value": "Tue, 14 Mar 2023 16:30:14 GMT"
        },
        {
          "name": "Content-Length",
          "value": "37120"
        },
        {
          "name": "Vary",
          "value": "Accept-Encoding"
        },
        {
          "name": "Set-Cookie",
          "value": "id=abc; path=/; Secure;domain=example.com"
        },
        {
          "name": "Set-Cookie",
          "value": "theme=light"
        },
        {
          "name": "Set-Cookie",
          "value": "sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT"
        }
      ],
      "httpVersion": "HTTP/1.1",
      "status": 200,
      "statusText": "OK"
    }
  },
  "result": "Apache/2.2.15 (CentOS)"
}
```

# Set up authorization



Before you can use this API, you need to [Create authentication credentials](https://techdocs.akamai.com/developer/docs/set-up-authentication-credentials). 

Then, you can use these code samples to apply the token values to your requests.

# Provide a function expression

<!-- curl@7 -->
<!-- node@19 -->
<!-- python@20 -->

Provide a function expression you want to test. To learn more about supported functions, see [Available functions](https://techdocs.akamai.com/test-ctr/reference/variables-overview#available-functions).

# Define variables

<!-- curl@8-13 -->
<!-- node@20-25 -->
<!-- python@21-26 -->

Define variables used in the function expression.

# Provide response data

<!-- curl@14-61 -->
<!-- node@26-73 -->
<!-- python@27-75 -->

Provide aample response for Test Center to run the function evaluation on.

# Call the API

<!-- curl@1-100 -->
<!-- node@1-100 -->
<!-- python@1-100 -->

Call POST on the request URL, providing the object in the body of the request.

# Review the response



The response returns 200 status, details of the request and resolution of the function expression. A function is valid for use in a test case if the response's `results` value returns only one value.