# DEX Tests ## List Device DEX tests `client.zeroTrust.devices.dexTests.list(DEXTestListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/dex/devices/dex_tests` Fetch all DEX tests. ### Parameters - `params: DEXTestListParams` - `account_id: string` Path param: Unique identifier linked to an account. - `kind?: "http" | "traceroute"` Query param: Filter by test type. - `"http"` - `"traceroute"` - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Number of results per page. - `testName?: string` Query param: Filter by test name. ### Returns - `SchemaHTTP` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: string` The desired endpoint to test. - `kind: "http" | "traceroute"` The type of test. - `"http"` - `"traceroute"` - `method?: "GET"` The HTTP request method type. - `"GET"` - `enabled: boolean` Determines whether or not the test is active. - `interval: string` How often the test will run. - `name: string` The name of the DEX test. Must be unique. - `created?: string` Date the test was created, in RFC 3339 format. - `description?: string` Additional details about the test. - `target_policies?: Array` DEX rules targeted by this test - `id: string` The id of the DEX rule. - `default?: boolean` Whether the DEX rule is the account default. - `name?: string` The name of the DEX rule. - `targeted?: boolean` - `test_id?: string` The unique identifier for the test. - `updated?: string` Date the test was last updated, in RFC 3339 format. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const schemaHTTP of client.zeroTrust.devices.dexTests.list({ account_id: '01a7362d577a6c3019a474fd6f485823', })) { console.log(schemaHTTP.test_id); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "interval": "30m", "name": "HTTP dash health check", "created": "2023-10-11T00:00:00Z", "description": "Checks the dash endpoint every 30 minutes", "target_policies": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "default": true, "name": "name" } ], "targeted": true, "test_id": "372e67954025e0ba6aaa6d586b9e0b59", "updated": "2023-10-11T00:00:00Z" } ] } ``` ## Get Device DEX test `client.zeroTrust.devices.dexTests.get(stringdexTestID, DEXTestGetParamsparams, RequestOptionsoptions?): SchemaHTTP` **get** `/accounts/{account_id}/dex/devices/dex_tests/{dex_test_id}` Fetch a single DEX test. ### Parameters - `dexTestID: string` The unique identifier for the test. - `params: DEXTestGetParams` - `account_id: string` Unique identifier linked to an account. ### Returns - `SchemaHTTP` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: string` The desired endpoint to test. - `kind: "http" | "traceroute"` The type of test. - `"http"` - `"traceroute"` - `method?: "GET"` The HTTP request method type. - `"GET"` - `enabled: boolean` Determines whether or not the test is active. - `interval: string` How often the test will run. - `name: string` The name of the DEX test. Must be unique. - `created?: string` Date the test was created, in RFC 3339 format. - `description?: string` Additional details about the test. - `target_policies?: Array` DEX rules targeted by this test - `id: string` The id of the DEX rule. - `default?: boolean` Whether the DEX rule is the account default. - `name?: string` The name of the DEX rule. - `targeted?: boolean` - `test_id?: string` The unique identifier for the test. - `updated?: string` Date the test was last updated, in RFC 3339 format. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const schemaHTTP = await client.zeroTrust.devices.dexTests.get('372e67954025e0ba6aaa6d586b9e0b59', { account_id: '01a7362d577a6c3019a474fd6f485823', }); console.log(schemaHTTP.test_id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "interval": "30m", "name": "HTTP dash health check", "created": "2023-10-11T00:00:00Z", "description": "Checks the dash endpoint every 30 minutes", "target_policies": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "default": true, "name": "name" } ], "targeted": true, "test_id": "372e67954025e0ba6aaa6d586b9e0b59", "updated": "2023-10-11T00:00:00Z" } } ``` ## Create Device DEX test `client.zeroTrust.devices.dexTests.create(DEXTestCreateParamsparams, RequestOptionsoptions?): SchemaHTTP` **post** `/accounts/{account_id}/dex/devices/dex_tests` Create a DEX test. ### Parameters - `params: DEXTestCreateParams` - `account_id: string` Path param: Unique identifier linked to an account. - `data: SchemaData` Body param: The configuration object which contains the details for the WARP client to conduct the test. - `host: string` The desired endpoint to test. - `kind: "http" | "traceroute"` The type of test. - `"http"` - `"traceroute"` - `method?: "GET"` The HTTP request method type. - `"GET"` - `enabled: boolean` Body param: Determines whether or not the test is active. - `interval: string` Body param: How often the test will run. - `name: string` Body param: The name of the DEX test. Must be unique. - `description?: string` Body param: Additional details about the test. - `target_policies?: Array` Body param: DEX rules targeted by this test - `id: string` The id of the DEX rule. - `default?: boolean` Whether the DEX rule is the account default. - `name?: string` The name of the DEX rule. - `targeted?: boolean` Body param ### Returns - `SchemaHTTP` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: string` The desired endpoint to test. - `kind: "http" | "traceroute"` The type of test. - `"http"` - `"traceroute"` - `method?: "GET"` The HTTP request method type. - `"GET"` - `enabled: boolean` Determines whether or not the test is active. - `interval: string` How often the test will run. - `name: string` The name of the DEX test. Must be unique. - `created?: string` Date the test was created, in RFC 3339 format. - `description?: string` Additional details about the test. - `target_policies?: Array` DEX rules targeted by this test - `id: string` The id of the DEX rule. - `default?: boolean` Whether the DEX rule is the account default. - `name?: string` The name of the DEX rule. - `targeted?: boolean` - `test_id?: string` The unique identifier for the test. - `updated?: string` Date the test was last updated, in RFC 3339 format. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const schemaHTTP = await client.zeroTrust.devices.dexTests.create({ account_id: '01a7362d577a6c3019a474fd6f485823', data: { host: 'https://dash.cloudflare.com', kind: 'http' }, enabled: true, interval: '30m', name: 'HTTP dash health check', }); console.log(schemaHTTP.test_id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "interval": "30m", "name": "HTTP dash health check", "created": "2023-10-11T00:00:00Z", "description": "Checks the dash endpoint every 30 minutes", "target_policies": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "default": true, "name": "name" } ], "targeted": true, "test_id": "372e67954025e0ba6aaa6d586b9e0b59", "updated": "2023-10-11T00:00:00Z" } } ``` ## Update Device DEX test `client.zeroTrust.devices.dexTests.update(stringdexTestID, DEXTestUpdateParamsparams, RequestOptionsoptions?): SchemaHTTP` **put** `/accounts/{account_id}/dex/devices/dex_tests/{dex_test_id}` Update a DEX test. ### Parameters - `dexTestID: string` API Resource UUID tag. - `params: DEXTestUpdateParams` - `account_id: string` Path param: Unique identifier linked to an account. - `data: SchemaData` Body param: The configuration object which contains the details for the WARP client to conduct the test. - `host: string` The desired endpoint to test. - `kind: "http" | "traceroute"` The type of test. - `"http"` - `"traceroute"` - `method?: "GET"` The HTTP request method type. - `"GET"` - `enabled: boolean` Body param: Determines whether or not the test is active. - `interval: string` Body param: How often the test will run. - `name: string` Body param: The name of the DEX test. Must be unique. - `description?: string` Body param: Additional details about the test. - `target_policies?: Array` Body param: DEX rules targeted by this test - `id: string` The id of the DEX rule. - `default?: boolean` Whether the DEX rule is the account default. - `name?: string` The name of the DEX rule. - `targeted?: boolean` Body param ### Returns - `SchemaHTTP` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: string` The desired endpoint to test. - `kind: "http" | "traceroute"` The type of test. - `"http"` - `"traceroute"` - `method?: "GET"` The HTTP request method type. - `"GET"` - `enabled: boolean` Determines whether or not the test is active. - `interval: string` How often the test will run. - `name: string` The name of the DEX test. Must be unique. - `created?: string` Date the test was created, in RFC 3339 format. - `description?: string` Additional details about the test. - `target_policies?: Array` DEX rules targeted by this test - `id: string` The id of the DEX rule. - `default?: boolean` Whether the DEX rule is the account default. - `name?: string` The name of the DEX rule. - `targeted?: boolean` - `test_id?: string` The unique identifier for the test. - `updated?: string` Date the test was last updated, in RFC 3339 format. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const schemaHTTP = await client.zeroTrust.devices.dexTests.update( 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { account_id: '01a7362d577a6c3019a474fd6f485823', data: { host: 'https://dash.cloudflare.com', kind: 'http' }, enabled: true, interval: '30m', name: 'HTTP dash health check', }, ); console.log(schemaHTTP.test_id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "interval": "30m", "name": "HTTP dash health check", "created": "2023-10-11T00:00:00Z", "description": "Checks the dash endpoint every 30 minutes", "target_policies": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "default": true, "name": "name" } ], "targeted": true, "test_id": "372e67954025e0ba6aaa6d586b9e0b59", "updated": "2023-10-11T00:00:00Z" } } ``` ## Delete Device DEX test `client.zeroTrust.devices.dexTests.delete(stringdexTestID, DEXTestDeleteParamsparams, RequestOptionsoptions?): DEXTestDeleteResponse` **delete** `/accounts/{account_id}/dex/devices/dex_tests/{dex_test_id}` Delete a Device DEX test. Returns the remaining device dex tests for the account. ### Parameters - `dexTestID: string` API Resource UUID tag. - `params: DEXTestDeleteParams` - `account_id: string` Unique identifier linked to an account. ### Returns - `DEXTestDeleteResponse` - `dex_tests?: Array` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: string` The desired endpoint to test. - `kind: "http" | "traceroute"` The type of test. - `"http"` - `"traceroute"` - `method?: "GET"` The HTTP request method type. - `"GET"` - `enabled: boolean` Determines whether or not the test is active. - `interval: string` How often the test will run. - `name: string` The name of the DEX test. Must be unique. - `created?: string` Date the test was created, in RFC 3339 format. - `description?: string` Additional details about the test. - `target_policies?: Array` DEX rules targeted by this test - `id: string` The id of the DEX rule. - `default?: boolean` Whether the DEX rule is the account default. - `name?: string` The name of the DEX rule. - `targeted?: boolean` - `test_id?: string` The unique identifier for the test. - `updated?: string` Date the test was last updated, in RFC 3339 format. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const dexTest = await client.zeroTrust.devices.dexTests.delete( 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { account_id: '01a7362d577a6c3019a474fd6f485823' }, ); console.log(dexTest.dex_tests); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "dex_tests": [ { "data": { "host": "https://dash.cloudflare.com", "kind": "http", "method": "GET" }, "enabled": true, "interval": "30m", "name": "HTTP dash health check", "created": "2023-10-11T00:00:00Z", "description": "Checks the dash endpoint every 30 minutes", "target_policies": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "default": true, "name": "name" } ], "targeted": true, "test_id": "372e67954025e0ba6aaa6d586b9e0b59", "updated": "2023-10-11T00:00:00Z" } ] } } ``` ## Domain Types ### Schema Data - `SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: string` The desired endpoint to test. - `kind: "http" | "traceroute"` The type of test. - `"http"` - `"traceroute"` - `method?: "GET"` The HTTP request method type. - `"GET"` ### Schema HTTP - `SchemaHTTP` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: string` The desired endpoint to test. - `kind: "http" | "traceroute"` The type of test. - `"http"` - `"traceroute"` - `method?: "GET"` The HTTP request method type. - `"GET"` - `enabled: boolean` Determines whether or not the test is active. - `interval: string` How often the test will run. - `name: string` The name of the DEX test. Must be unique. - `created?: string` Date the test was created, in RFC 3339 format. - `description?: string` Additional details about the test. - `target_policies?: Array` DEX rules targeted by this test - `id: string` The id of the DEX rule. - `default?: boolean` Whether the DEX rule is the account default. - `name?: string` The name of the DEX rule. - `targeted?: boolean` - `test_id?: string` The unique identifier for the test. - `updated?: string` Date the test was last updated, in RFC 3339 format. ### DEX Test Delete Response - `DEXTestDeleteResponse` - `dex_tests?: Array` - `data: SchemaData` The configuration object which contains the details for the WARP client to conduct the test. - `host: string` The desired endpoint to test. - `kind: "http" | "traceroute"` The type of test. - `"http"` - `"traceroute"` - `method?: "GET"` The HTTP request method type. - `"GET"` - `enabled: boolean` Determines whether or not the test is active. - `interval: string` How often the test will run. - `name: string` The name of the DEX test. Must be unique. - `created?: string` Date the test was created, in RFC 3339 format. - `description?: string` Additional details about the test. - `target_policies?: Array` DEX rules targeted by this test - `id: string` The id of the DEX rule. - `default?: boolean` Whether the DEX rule is the account default. - `name?: string` The name of the DEX rule. - `targeted?: boolean` - `test_id?: string` The unique identifier for the test. - `updated?: string` Date the test was last updated, in RFC 3339 format.