NAV Navbar
Home Functional Performance Mock Services API Monitoring Test Data
cURL
  • Introduction
  • Test Data Usage Scenarios
  • Asset Repository
  • Test Data Models
  • Test Data Generation
  • Test Data Orchestration
  • Appendix
  • Introduction

    Welcome to the Test Data section of the BlazeMeter API reference! This section will cover the APIs used for creating, updating, and utilizing Data Models in Functional and Performance tests, as well as associating Data Models with Mock Services.

    Instead of hard-coding values such as user names, passwords, numbers, or options in your tests, it is recommended to parameterize tests and replace values by dynamic test data. You can load test data from CSV files -- or let BlazeMeter generate it for each test run, according to your specific requirements.

    Once a Data Entity has been defined in a workspace, you can associate it with any Functional tests, Performance tests, and Mock Services, and provide it during test execution using APIs. The test data integration uses two APIs, the Asset Repository API and the Test Data API.

    The following figure illustrates that test data is available to all components.

    This API reference uses the following conventions for your convenience:

    Swagger documentation: Links to the API explorer are provided in the following format: * tdm.blazemeter.com/docs/ for the Test Data Management API * ar.blazemeter.com/api-doc/v3/ for the Asset Repository API

    To use the Swagger documentation, you must first log in to a.blazemeter.com to establish authentication. If you need an account, sign up for a free account (first and last name, and a valid email address are required). If you use cookie authentication in the browser, (for example, if you use a browser plugin to invoke the API,) you must specify a CSRF token. This step is not needed if you use API Key authentication. Currently, the "Try it out" button does not work in the Test Data Management Swagger UI.

    Overview

    Your Account provides access to different levels of the API:

    The following figure illustrates the relationship between the levels.

    The test data integration uses two separate APIs:

    Basics

    Request Format

    All requests to the API are sent over HTTPS and use the following base URL:

    https://a.blazemeter.com/api/v4

    Test data related requests use the following base URL:

    https://tdm.blazemeter.com/api/v1

    Response Format

    {
      "limit": ...,
      "skip": ...,
      "total": ...,
      "hidden": ...,
      "api_version": ...,
      "error": {...} or null,
      "result": {...} or [...]
    }
    

    Responses are returned as JSON data in the format shown to the right. A description of the attributes can be found below:

    Attributes

    Reading the Attribute Tables

    Below is a list of the various tags that are present in the attribute tables and what they represent:

    Attribute Tag Description

    required

    This indicates that this attribute is required for any POST requests

    read-only

    This indicates that this attribute is not edittable (either through POST, PATCH, or PUT)

    Result List Only

    Indicates that this attribute appears for APIs that return lists

    Multi Test Only

    Indicates that this attribute is used for multi test or collection object only

    Test Only

    Indicates that this attribute is used for test object only

    Private Cloud Only

    Indicates that this attribute is only available to Private Cloud

    Shared Type Only

    Indicates that this attribute is only available to Shared private location type

    Legacy Only

    Indicates that this attribute is only available for legacy BlazeMeter users

    Exclusive

    Indicates that this attribute cannot be used in conjunction with another Exclusive attribute

    Authorization Using Basic Authentication

    Authorization

    curl 'https://a.blazemeter.com/api/v4/user' \
        --user 'api_key_id:api_key_secret'
    

    Response 200 OK

    {
      "api_version": 4,
      "error": null,
      "result": {
        "id": 123456,
        "email": "my.name@my_email.com",
        "access": 1522676762,
        "login": 1521724222,
        "firstName": "my",
        "lastName": "name",
        "timezone": 0,
        "enabled": true,
        "roles": [
          "user",
          "new-billing",
          "authenticated"
        ]
        }
      }
    }
    

    API Explorer: /user

    To use the BlazeMeter API, pass your BlazeMeter API key using Basic Authentication (Basic Auth) credentials. These credentials contain a Key ID and a Secret Key:

    id:secret

    For example: f817e22f1526b048799f75da:7641251982b983cfd92b5a25fa97cd3ee9e21920f21d8b14cd705831826935723f3033f0

    All API requests must be made over HTTPS. Calls made over plain HTTP will fail. API requests without authentication will also fail. In the code sample, replace 'api_key_id:api_key_secret' with your credentials.

    Create the API Key

    Use the linked BlazeMeter article to create your API key.

    Test Data Usage Scenarios

    Sample flow 1 - Add test data to an existing test

    To add a Test Data Model to an existing GUI Functional (or Performance) test, you need to know the Test ID, the Workspace identifier, and the Test Data Model identifier.

    1. Define test data in the entity as data requirements.
    2. CREATE the data entity and note down its ID.
    3. GET the test and note down the "dependencies" section.
    4. Insert the data entity in the dependencies > data > entities section, and PUT the updated test.

    Sample flow 2 - Get generated data from a standalone model

    To generate data, you need to know your Workspace identifier and the Data Model identifier.

    1. Define test data in the entity as data requirements.
    2. CREATE the data entity and note down its ID.
    3. Generate data into a CSV file.

    You can generate data of a Data Model that is stored in the Asset Repository, or you can pass the Data Model inside a request to the generate endpoint. To generate data for one entity, use the generate endpoint; To generate data for all entities, use the /generatefile endpoint .

    Asset Repository

    Create a Package

    If you want to organize your assets in packages, you need to create the packages first. Using packages is optional, if no packgeID is specified, the asset will be stored in the default package.

    API Explorer: /packages

    Create a Package

    curl 'https://ar.blazemeter.com/api-doc/v3/api/v1/workspaces/123456/packages
    -X POST \
    -H 'accept: application/json' 
    -H 'Content-Type: application/json'
    

    Sample body

    {
      "name": "myPackage",
      "displayName": "My Package",
      "version": "1.0.0",
      "dependencies": {}
    }
    

    Sample 200 response

    {
      "timestamp": "2022-06-07T14:33:04+00:00",
      "request_id": "b156551692708eb934c76dbd7e80304a",
      "result": {
        "dependencies": {},
        "id": "e1d7cf96-3d53-4337-a178-b6ce6aa3ab3a",
        "accountId": 1142842,
        "workspaceId": 123456,
        "name": "myPackage",
        "displayName": "My Package",
        "version": "1.0.0",
        "createdAt": "2022-06-07T14:33:04.808Z",
        "createdBy": 1620964,
        "updatedAt": "2022-06-07T14:33:04.808Z",
        "updatedBy": 1620964
      }
    }
    

    Store an Asset

    When you store an Asset (a Data Model) in the Asset Repository, the packageId is optional. If not specified, the asset will be placed in the default package. To store a Data Model in the Asset Repository, you do:

    Store an Asset

    curl 'https://ar.blazemeter.com/api-doc/v3/workspaces/123456/assets
    -X POST \
    -H 'accept: application/json' 
    -H 'Content-Type: application/json'
    

    Sample body

    {
      "packageId": "aaea361d-ab56-4853-8d73-6fc9be04360a",
      "name": "NewModel",
      "displayName": "A New Model",
      "type": "data-model",
      "metadata": {
        "kind": "tdm",
        "contentType": "application/json",
        "fileName": "data-model.json"
      },
      "data": {
        "contentType": "application/json",
        "fileName": "data-model.json",
        "content": "{"schema":"http://perforce.com/blazedata/schema","id":"b57abac9-174b-4312-9511-ee5f202492a1","title":"ssddfd","description":"","kind":"tdm","type":"object","entities":{"ssddfd":{"title":"ssddfd","type":"object","properties":{},"requirements":{},"targets":{"defaultCsv":{"type":"csv","file":"ssddfd.csv","isHeadless":false}}}}}"
      }
    }
    

    Sample 201 response:

    {
      "timestamp": "2022-06-08T12:56:17+00:00",
      "request_id": "cb2e521a2be69b02fe732a148a55b854",
      "result": {
        "data": {
          "contentType": "application/json",
          "fileName": "data-model.json",
          "content": "{"schema":"http://perforce.com/blazedata/schema","id":"b57abac9-174b-4312-9511-ee5f202492a1","title":"ssddfd","description":"","kind":"tdm","type":"object","entities":{"ssddfd":{"title":"ssddfd","type":"object","properties":{},"requirements":{},"targets":{"defaultCsv":{"type":"csv","file":"ssddfd.csv","isHeadless":false}}}}}"
        },
        "id": "46282480-0ae3-478d-be02-9a3a1c990424",
        "accountId": 514413,
        "workspaceId": 517389,
        "packageId": "aaea361d-ab56-4853-8d73-6fc9be04360a",
        "name": "NewModel",
        "displayName": "A New Model",
        "type": "data-model",
        "metadata": {
          "kind": "tdm",
          "contentType": "application/json",
          "fileName": "data-model.json"
        },
        "createdAt": "2022-06-08T12:56:17.168Z",
        "createdBy": 1620964,
        "updatedAt": "2022-06-08T12:56:17.168Z",
        "updatedBy": 1620964
      }
    }
    

    Test Data Models

    This API deals with creating and storing test data. A data model consists of reuseable Data Entities that contain Data Parameters, for example, username and password pairs of your tester accounts.

    Instead of hard-coding values such as usernames and passwords in your tests, you can parameterize your test scenarios by replacing values with Data Parameters. Then you provide Data Parameter names and their values in CSV files -- or you let BlazeMeter generate suitable values synthetically.

    Create a Data Model

    The Data Model defines what test data to generate, for example, credit card numbers or email addresses.

    To create a Data Model in your workspace, you need to know your workspace identifier. The sample code uses a workspaceId of 123456. Use the actual ID value of your workspace.

    The response contains a Data Model identifier ( "id": "09af09af-09af-09af-09af-09af09af09af") that you should note down. You will need this dataModelID when you want to configure, deploy, or delete this Data Model later.

    Create a Data Model

    curl 'https://ar.blazemeter.com/​api​/v1​/workspaces​/123456/assets' 
        -X POST \
        -H 'accept: application/json' \
        -H 'Content-Type: application/json' \
        -d '{
          "metadata": {
            "kind": "tdm",
            "fileName": "data-model.json",
            "contentType": "application/json"
          },
          "packageId": "7775df96-a80a-451d-999f-5751d146873f",
          "name": "Pet",
          "displayName": "Pet",
          "type": "data-model",
          "data": {
            "fileName": "data-model.json",
            "contentType": "application/json",
            "content": "{\"id\":\"262e943c-f3be-49d7-872d-dcc2827d7838\",\"kind\":\"tdm\",\"title\":\"Pet\",\"type\":\"object\",\"entities\":{\"default\":{\"type\":\"object\",\"title\":\"Pet\",\"repeat\":1,\"properties\":{\"age\":{\"type\":\"integer\"},\"name\":{\"type\":\"string\"},\"email\":{\"type\":\"string\"}},\"description\":\"A Pet can be dog or cat\",\"requirements\":{\"age\":\"randInt(18, 99)\",{\"name\":\"randText(5, 10)\",\"email\":\"$name + '@google.com'\"},\"targets\":{\"default\":{\"type\":\"csv\",\"file\":\"blazedata-test.csv\"}},\"datasources\":[]}}}"
          }
        }'
    

    API Explorer: /datamodels

    Create A Data Model Request Attributes

    The following JSON sample provides a more readable version of the content contained in the above curl example. This example represents the attributes and values contained in the -d flag of the curl example.

    Create a Data Model Create a Data Model POST Body (JSON)

    Data Model file: json "packageId": "79ca6d76-0eac-4e89-917a-dc8b7cb66cbf", "name": "mytestdata.csv", "displayName": "mytestdata.csv", "type": "data-model-file", "metadata": { "fileName": "mytestdata.csv", "contentType": "text/csv", "modelAssetId": "53de0dd6-05bd-4b5b-8190-aa2aa41e543e" }, "data": { "fileName": "mytestdata.csv", "contentType": "text/csv", "content": "id,name\r\n1,Joe" }, "dependencies": {}

    Data Model:

    {
        "metadata": {
            "kind": "tdm",
            "fileName": "data-model.json",
            "contentType": "application/json"
        },
        "packageId": "7775df96-a80a-451d-999f-5751d146873f",
        "name": "Pet",
        "displayName": "Pet",
        "type": "data-model",
        "data": {
            "fileName": "data-model.json",
            "contentType": "application/json",
            "content": {
                "kind": "tdm",
                "title": "Pet",
                "type": "object",
                "entities": {
                    "default": {
                        "type": "object",
                        "title": "Pet",
                        "repeat": 1,
                        "properties": {
                            "age": { "type": "integer" },
                            "name": { "type": "string" },
                            "email": { "type": "string" }
                        },
                        "description": "A Pet can be dog or cat",
                        "requirements": {
                            "age": "randInt(18, 99)",
                            "name": "randText(5, 10)",
                            "email": "$name + '@google.com'"
                        },
                        "targets": {
                            "default": {
                                "type": "csv",
                                "file": "blazedata-test.csv"
                            }
                        },
                        "datasources": []
                    }
                }
            }
        }
    }
    

    Attributes

    The following parameters are the base parameters required to create a Data Model.

    Create A Data Model Response Attributes

    Response 201 Created

    {
      "timestamp": "2022-07-22T13:43:47+00:00",
      "request_id": "758339fe4eb5f9ae267718da7768e38c",
      "result": {
        "data": {
          "fileName": "mytestdata.csv",
          "contentType": "text/csv",
          "content": "id,name\r\n1,Joe"
        },
        "dependencies": {},
        "id": "09af09af-09af-09af-09af-09af09af09af",
        "accountId": 514413,
        "workspaceId": 123456,
        "packageId": "79ca6d76-0eac-4e89-917a-dc8b7cb66cbf",
        "name": "mytestdata.csv",
        "displayName": "mytestdata.csv",
        "type": "data-model-file",
        "metadata": {
          "fileName": "mytestdata.csv",
          "contentType": "text/csv"
        },
        "createdAt": "2022-07-22T13:43:47.952Z",
        "createdBy": 432,
        "updatedAt": "2022-07-22T13:43:47.952Z",
        "updatedBy": 432
      }
    }
    

    Attributes

    Get a Data Model

    To get details about an existing Data Model, you need to know your workspace identifier and the Data Model identifier. The sample code uses a dataModelId of 55 and a workspaceId of 123456. Use the actual ID values of your workspace and Data Model.

    Get a Data Model

    curl 'https://tdm.blazemeter.com/api/v1/workspaces/123456/datamodels/55' \
        -X GET \
        -H 'accept: application/json;charset=UTF-8'
    

    The following parameters are the base parameters required to get a Data Model.

    Get a Data Model Response Attributes

    Response 200 OK

    {
      "api_version": 1,
      "request_id": "string",
      "result": {
        "id": "datamodel/Pet",
        "title": "Pet",
        "description": "A Pet can be dog or cat",
        "type": "object",
        "kind": "tdm",
        "repeat": 1,
        "properties": {
          "name": {
            "type": "string"
          },    
          "email": {
            "type": "string"
          }
        },
        "requirements": {
          "name": "randText(5, 10)",
          "email": "$name + '@google.com'"
        }
      }
    }
    

    Attributes

    List All Data Models

    To get details about all Data Models, you need to know your workspace identifier. The sample code uses a workspaceId of 123456. Use the actual ID values of your workspace.

    List All Data Models

    curl 'https://ar.blazemeter.com/api/v1/workspaces/123456/assets?q=type%3Ddata-model' \
        -X GET \
        -H 'accept: application/json;charset=UTF-8' \
    

    The following parameters are the base parameters required to list all Data Models.

    List All Data Models Response Attributes

    Response 200 OK

      "timestamp": "string",
      "request_id": "string",
      "result": [
        {
          "id": "datamodel/Pet",
          "title": "Pet",
          "description": "A Pet can be dog or cat",
          "type": "object",
          "kind": "tdm",
          "repeat": 1,
          "properties": {
            "name": {
              "type": "string"
            },
            "age": {
              "type": "integer"
            },
            "email": {
              "type": "string"
            }
          },
          "requirements": {
            "name": "randText(5, 10)",
            "email": "$name + '@google.com'"
          }
        }
      ]
    }
    

    Update a Data Model

    To update a Data Model, you need to know your workspace identifier and the Data Model identifier. The sample code uses a dataModelId of 55 and a workspaceId of 123456. Use the actual ID values of your workspace and Data Model.

    Update Data Model

    curl 'https://ar.blazemeter.com/api/v1/workspaces/123456/assets/55' \
      -H 'accept: application/json' \
      -H 'Content-Type: application/json' \
      -d '{
        "packageId": "string",
        "name": "string",
        "displayName": "string",
        "type": "string",
        "metadata": {},
        "data": 
          { "type":"datamodel", 
            "attributes": { 
              "id": "datamodel/emailaddress", 
              "title": "email contact", 
              "description": "random string at domain dot com", 
              "type":"object", 
              "kind":"tdm", 
              "repeat":1, 
              "properties": { 
                "name":{ "type":"string"}, 
                "age":{"type":"integer"},  
                "email":{"type":"string"} }, 
              "requirements": { 
                "name":"randText(5, 10)", 
                "email":"$name + '@google.com'" } 
            }
        }},
        "dependencies": {}
    }'
    

    The following parameters are the base parameters required to update a Data Model.

    Update a Data Model Response Attributes

    Response 200 OK

    {
      "api_version": 1,
      "request_id": "string",
      "result": {
        "id": "datamodel/emailaddress", 
              "title": "email contact", 
              "description": "random string at domain dot com", 
              "type":"object", 
              "kind":"tdm", 
              "repeat":1, 
              "properties": { 
                "name":{ "type":"string"}, 
                "age":{"type":"integer"},  
                "email":{"type":"string"} }, 
              "requirements": { 
                "name":"randText(5, 10)", 
                "email":"$name + '@google.com'" 
              } 
        }
    }
    

    Attributes

    Validate Data Model (Asset Repository)

    To validate an existing Data Model, you need to know your workspace identifier and the Data Model identifier. The sample code uses a dataModelId of 55 and a workspaceId of 123456. Use the actual ID values of your workspace and Data Model.

    When validating data models, you can choose whether you want to validate a data model stored in the Asset Repository (including applying overrides), or whether you want to validate a Data Model JSON document.

    Assuming you have stored the Data Model in the Asset Repository and have the id of the asset (modelId), you can validate it using the following call. The Body can optionally contain a Model Override.

    Validate a Data Model (Asset Repository)

    API Explorer: /datamodels

    curl '/api/v1/workspaces/123456/datamodels/55/validate' \
        -X POST \
        -H 'accept: application/json;charset=UTF-8'
    

    The following parameters are the base parameters required to validate a Data Model.

    Validate a Data Model Response Attributes

    Response 200 OK

    {
      "api_version": 1,
      "result": {
        "isValid": false,
        "entities": {
          "user": {
            "isValid": false,
            "report": {
              "message": "Expected 2 arguments, but got 3.",
              "properties": {
                "name": {
                  "message": "Expected 2 arguments, but got 3.",
                  "start": 16,
                  "end": 17
                }
              }
            }
          }
        }
      },
      "request_id": "128fa23b"
    }
    

    In this example response, the model contained the randText(5,10,30) expression, which is reported as incorrect, because the randText() function takes only two arguments. The validation report contains also the exact position where the problem has been found.

    Attributes

    Validate a Data Model (JSON Document)

    To validate an existing Data Model, you need to know your workspace identifier and the Data Model identifier. The sample code uses a dataModelId of 55 and a workspaceId of 123456. Use the actual ID values of your workspace and Data Model.

    When validating data models, you can choose whether you want to validate a data model stored in the Asset Repository (including applying overrides), or whether you want to validate a Data Model JSON document.

    Similar to the generate endpoint, there is a validate endpoint validating a JSON document with a Data Model. The Body contains the Data Model.

    Validate a Data Model (Asset Repository)

    API Explorer: /datamodels

    curl '/api/v1/workspaces/123456/datamodels/validate' \
        -X POST \
        -H 'accept: application/json;charset=UTF-8'
    

    It returns the same structures as the "Validate Data Model (Asset Repository)" endpoint.

    Delete a Data Model

    To delete a Data Model from your workspace, you need to know your workspace identifier and the Data Model identifier. The sample code uses a dataModelId of 09af09af-09af-09af-09af-09af09af09af and a workspaceId of 123456. Use the actual ID value of your workspace.

    Delete a Data Model

    curl 'https://ar.blazemeter.com/​api​/v1​/workspaces​/123456/assets/09af09af-09af-09af-09af-09af09af09af' 
        -X DELETE \
        -H 'accept: application/json' \
        -H 'Content-Type: application/json'
    

    API Explorer: /assets

    Delete A Data Model Response Attributes

    Response 200 Success

    {
      "timestamp": "2022-07-22T13:43:47+00:00",
      "request_id": "758339fe4eb5f9ae267718da7768e38c",
      "result": [],
      "error": "string"
    }
    

    Test Data Generation

    After you have parameterized your tests to use Data Parameters instead of hard-coded values, you either load data from CSV files — or use this API to make BlazeMeter generate test data in bulk.

    Synthetic test data generation is very useful when you want to test thousands of combinations of non-arbitrary values: For example, names of international persons and places, plausible international addresses, strings and numbers generated according to custom constraints, fake credit card numbers with valid checksums, random valid dates and times within custom constraints, and so on.

    Generate Test Data

    To generate test data, you need to know your workspace identifier and Data Model. The sample code uses a workspaceId of 123456. Use the actual ID values of your workspace and Data Model.

    You can generate data for a data model that is stored in the Asset Repository, or you can pass the Data Model in a request to the generate endpoint.

    Generate Data for a Data Entity (Asset Repository)

    Assuming you have stored the Data Model in the Asset Repository and have the id of the asset (dataModelId), you can generate data using the following call.

    API Explorer: /testdata

    Generate Test Data

    curl 'https://tdm.blazemeter.com/api/v1/workspaces/123456/datamodels/55/generate'
    -X POST \
    -H 'accept: application/json' 
    -H 'Content-Type: application/json'
    

    Optionally, the body can contain a so-called Model Override; for more information, see Data Structures.

    Sample 200 response

    {
      "api_version": 1,
      "total": 5,
      "billingLimits": {
        "total": 10000,
        "entity": {
          "user": {
            "apply": true,
            "applied": false,
            "requested": 5,
            "generated": 5
          }
        }
      },
      "user": [
        {      "randomName": "RE5ONP3"    },
        {      "randomName": "YDBgwvWn3"  },
        {      "randomName": "c0BcQJg"    },
        {      "randomName": "HPgVyan"    },
        {      "randomName": "yanUhmHqs"  }
      ],
      "request_id": "a2c28c09"
    }
    

    The response contains a JSON array with generated data and billingLimits information. The billingLimits conveys information whether the billing limits have been applied or not.

    In case of a Data Model validation error, a 400 response code and a detailed validation report are retuned.

    Generate Data for a Data Entity (Single Entity)

    In some situations you don’t have a Data Model stored in the Asset Repository, but you store it somewhere else, or you keep it in memory. To generate data for such a model, use the /generate endpoint. Note that this endpoint generates data for one entity only (use /generatefile below if you need to generate all entities).

    API Explorer: /testdata

    Generate Test Data

    curl 'https://tdm.blazemeter.com/api/v1/workspaces/123456/testdata/generate?entityName=user' \
        -X POST \
        -H 'accept: application/json' 
        -H 'Content-Type: application/json' \
        -d '{  "data": {
            "type": "datamodel",
            "attributes": {
                "model": {
                "schema": "http://perforce.com/blazedata/schema",
                "id": "datamodels/testParameters", "title": "Test Parameters",
                "description": "", "kind": "tdm", "type": "object",
                "entities": {
                  "user": {
                    "title": "user", "type": "object",
                    "properties": { "name": { "type": "string"  } },
                    "requirements": { "name": "randText(3, 10)" },
                    "targets": { "defaultCsv": { "type": "csv", "file": "user.csv", "isHeadless": false } },
                    "datasources": [], "repeat": 1
                  }
                }
              },
              "context": { "csvs": [] }
            }
        }}'
    

    The following JSON sample provides a more readable version of the content contained in the above curl example. This example represents the attributes and values contained in the -d flag of the curl example.

    Generate Test Data Generate Test Data POST Body (JSON)

    {
        "data": {
        "type": "datamodel",
        "attributes": {
          "model": {
            "schema": "http://perforce.com/blazedata/schema",
            "id": "datamodels/testParameters",
            "title": "Test Parameters",
            "description": "",
            "kind": "tdm",
            "type": "object",
            "entities": {
              "user": {
                "title": "user",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  }
                },
                "requirements": {
                  "name": "randText(3, 10)"
                },
                "targets": {
                  "defaultCsv": {
                    "type": "csv",
                    "file": "user.csv",
                    "isHeadless": false
                  }
                },
                "datasources": [],
                "repeat": 1
              }
            }
          },
          "context": {
            "csvs": []
          }
        }
      }
    } 
    }
    

    The following parameters are the base parameters required to generate test data.

    Generate Test Data Response Attributes

    Response 200 OK

    {
      "api_version": 1,
      "total": 1,
      "billingLimits": {
        "total": 10000,
        "entity": {
          "user": {
            "apply": true,
            "applied": false,
            "requested": 1,
            "generated": 1
          }
        }
      },
      "result": [
        {
          "name": "2Gu3Nrxq"
        }
      ],
      "request_id": "d712a082"
    }
    

    Attributes

    Generate Data for all Data Entities

    Use /generatefile if you need data generated for all Data Entities in the Data Model.

    These endpoints work the same as their “generate” counterparts, but always generate the whole model. You can use the accept HTTP header to control whether you want a file to be retuned, or just generate a JSON document. If you specify text/csv, a CSV file is generated. In all other cases, a JSON document is returned with application/json content-type.

    Get List of Data Generator Functions

    When creating a Data Model to generate test data, it is helpful to view the list of Data Generator Functions. Alternatively, you can also use Seed Lists and Card Issuers to generate test data, or a combination of all three.

    Get List of Data Generator Functions

    curl 'https://tdm.blazemeter.com/api/v1/generator/functions' \
        -X GET \
        -H 'accept: application/json;charset=UTF-8'
    

    The following parameters are the base parameters required to get data generator functions.

    Get Data Generator Functions Response Attributes

    Response 200 OK

    The following JSON sample provides a more readable version of the content contained in the above curl example. See also the Test Data Object for details.

    Get Data Generator Functions Get Data Generator Functions GET Body (JSON)

    {
      "api_version": 1,
      "request_id": "string",
      "result": [
        {
          "group": "string",
          "function": "string",
          "name": "string",
          "description": "string",
          "example": "string"
        }
      ]
    }
    

    Detailed List of Functions

    {
      "api_version": 1,
      "result": [
        {
          "group": "text",
          "function": "nameGenerator()",
          "name": "nameGenerator",
          "description": "nameGenerator",
          "example": ""
        },
        {
          "group": "numeric",
          "function": "sequenceGenerator(start: number = 0)",
          "name": "sequenceGenerator",
          "description": "Generate sequence number",
          "example": ""
        },
        {
          "group": "text",
          "function": "randText(minLen: number, maxLen: number)",
          "name": "randText",
          "description": "Generate random text",
          "example": "randText(3, 10) -> \"ATrf3kJ\""
        },
        {
          "group": "numeric",
          "function": "addRand(input: number, min: number, max: number)",
          "name": "addRand",
          "description": "Add random number in specified boundaries",
          "example": "addRand(10,1,5) -> 13"
        },
        {
          "group": "numeric",
          "function": "randDigits(min: number, max: number)",
          "name": "randDigits",
          "description": "Returns a random string of digits of a length between minlen and maxlen",
          "example": "randDigits(1,5) -> 2103"
        },
        {
          "group": "numeric",
          "function": "randRange(min: number, max: number, width?: number)",
          "name": "randRange",
          "description": "Returns a random integer between min and max. Adds 0 padding to match specified width",
          "example": "randRange(10,15,3) -> 013"
        },
        {
          "group": "numeric",
          "function": "convBase(input: number, base: number)",
          "name": "convBase",
          "description": "Convert decimal input to specific base",
          "example": "convBase(5,2) -> 0101"
        },
        {
          "group": "text",
          "function": "randlov(percnull: number, source: string[])",
          "name": "randlov",
          "description": "Returns random value from array, perclist function or seedlist",
          "example": "randlov(0, [\"one\", \"two\", \"three\"]) -> \"two\"\n randlov(10, perclist(\"10%ten\", \"20%twenty\", \"70%seventy\")) -> \"twenty\"\n randlov(10, seedlist(\"femalenames\"), 1) -> \"Jenny\""
        },
        {
          "group": "special",
          "function": "perclist(values: string[])",
          "name": "perclist",
          "description": "Represents value list with their percentage probability\n Can't be used as standalone generator function. Usable only as RANDLOV generator parameter",
          "example": "perclist(\"10%ten\", \"20%twenty\", \"70%seventy\")"
        },
        {
          "group": "special",
          "function": "seedlist(seedListName: string)",
          "name": "seedlist",
          "description": "Represents seed list object\n Can't be used as standalone generator function. Usable only as RANDLOV generator parameter",
          "example": "seedlist(\"femalenames\")"
        },
        {
          "group": "text",
          "function": "percval(values: string[])",
          "name": "percval",
          "description": "Returns random value from input list. Number of occurrences is affected by probability percentage",
          "example": "percval(\"10%ten\", \"20%twenty\", \"70%seventy\") -> \"seventy\""
        },
        {
          "group": "text",
          "function": "uuidGenerator()",
          "name": "uuidGenerator",
          "description": "Returns universally unique identifier (UUID) string",
          "example": "uuidGenerator() -> \"660b45c8-f8a8-4929-bb08-da9ad94f389a\""
        },
        {
          "group": "numeric",
          "function": "abs(input: number)",
          "name": "abs",
          "description": "Returns the absolute value of the argument.",
          "example": "abs(-5) -> 5"
        },
        {
          "group": "numeric",
          "function": "add(valueA: number, valueB: number)",
          "name": "add",
          "description": "Adds two values together.",
          "example": "add(5, 5) -> 10"
        },
        {
          "group": "numeric",
          "function": "divide(valueA: number, valueB: number)",
          "name": "divide",
          "description": "Divides the first number by the second. The function expects integer or floating point numbers",
          "example": "divide(6, 3) -> 2"
        },
        {
          "group": "numeric",
          "function": "multiply(valueA: number, valueB: number)",
          "name": "multiply",
          "description": "Multiplies the two numbers",
          "example": "multiply(6, 3) -> 18"
        },
        {
          "group": "numeric",
          "function": "mod(divident: number, divisor: number)",
          "name": "mod",
          "description": "Returns the modulo of two numbers. This is the remainder of the first\n number divided by the second number",
          "example": "mod(5, 2) -> 1"
        },
        {
          "group": "numeric",
          "function": "exp(input: number, power: number)",
          "name": "exp",
          "description": "Returns the natural exponent of a specified number.",
          "example": "exp(2, 4) -> 16"
        },
        {
          "group": "logical",
          "function": "and(values: boolean[])",
          "name": "and",
          "description": "Performs a logical AND function on a variable list of arguments.",
          "example": "and(true, false, true) -> false"
        },
        {
          "group": "logical",
          "function": "or(values: boolean[])",
          "name": "or",
          "description": "Perform a logical OR operation on a list of Boolean expressions.",
          "example": "or(true, false, true) -> true"
        },
        {
          "group": "logical",
          "function": "not(input: boolean)",
          "name": "not",
          "description": "Applies a logical NOT operation to a Boolean expression",
          "example": "not(false) -> true"
        },
        {
          "group": "logical",
          "function": "booleanCompare(valueA: number|string, valueB: number|string, operator: string)",
          "name": "booleanCompare",
          "description": "Compares the left and right values using an operator. If left and right values are numbers,\n a number comparison is used with the operator and if left or right values are a string,\n a string comparison is used.",
          "example": "booleanCompare(200, 201, \">\") -> false\n booleanCompare(a, c, \">\") -> true"
        },
        {
          "group": "datetime",
          "function": "date(input: string, format?: string)",
          "name": "date",
          "description": "Returns a string as a date.",
          "example": "date(\"2018/13/12\", \"YYYY-DD-MM\") -> \"2018-12-13\""
        },
        {
          "group": "datetime",
          "function": "datetime(input: string, format?: string)",
          "name": "datetime",
          "description": "Returns a string as a datetime.",
          "example": "datetime(\"2018/13/12 12:12:12.500\", \"YYYY-DD-MM HH:MM:SS.sss\") -> \"2018-12-13 12:12:12\""
        },
        {
          "group": "datetime",
          "function": "randDate(min: string, max: string)",
          "name": "randDate",
          "description": "Returns a random date between the minimum and maximum values.",
          "example": "randdate(\"2009/01/01\",\"2010/01/01\") -> \"2009-05-06\""
        },
        {
          "group": "datetime",
          "function": "randTime(min: string, max: string)",
          "name": "randTime",
          "description": "Returns a random time between a min and max.",
          "example": "randTime(00:00:00,23:59:59) -> \"12:34:01\""
        },
        {
          "group": "datetime",
          "function": "addSecondsToDateTime(input: string, seconds: number)",
          "name": "addSecondsToDateTime",
          "description": "Adds a number of seconds to a datetime, or subtracts them, if it is a negative number.\n Datetime parsing variant",
          "example": "addSecondsToDateTime(\"2013-02-08 15:15:15\", -1) -> \"2013-02-08 15:15:14\""
        },
        {
          "group": "datetime",
          "function": "addMillisecs(input: string, milliSeconds: number)",
          "name": "addMillisecs",
          "description": "Adds a number of milliseconds to a datetime, or subtracts them, if it is a negative number.",
          "example": "addMillisecs(\"2013-02-08 24:00:00.000\", 160) -> \"2013-02-08 24:00:00.160\""
        },
        {
          "group": "datetime",
          "function": "addSecondsToTime(input: string, seconds: number)",
          "name": "addSecondsToTime",
          "description": "Adds a number of seconds to a time, or subtracts them, if it is a negative number.",
          "example": "addSecondsToTime(\"15:15:15\", -1) -> \"15:15:14\""
        },
        {
          "group": "datetime",
          "function": "secondsAfter(start: string, end: string)",
          "name": "secondsAfter",
          "description": "Return the number of seconds between a start and end datetime or time.",
          "example": "secondsAfter(\"2013-02-08 09:30:00\", \"2013-02-08 09:30:05\") -> 5"
        },
        {
          "group": "datetime",
          "function": "addDays(input: string, days: number)",
          "name": "addDays",
          "description": "Adds a number of days to a date, or subtracts them, if it is a negative number.",
          "example": "addDays(\"2018/12/13\", -1) -> \"2018-12-12\""
        },
        {
          "group": "datetime",
          "function": "dow(input: string)",
          "name": "dow",
          "description": "Returns the day of the week for the date specified.",
          "example": "dow(\"2019/19/24\") -> 2"
        },
        {
          "group": "datetime",
          "function": "lastDay(input: string)",
          "name": "lastDay",
          "description": "Returns the last day of the month that the specified date is in",
          "example": "lastDay(\"2054/07/04\") -> \"2054-04-30\""
        },
        {
          "group": "datetime",
          "function": "daysAfter(start: string, end: string)",
          "name": "daysAfter",
          "description": "Returns the difference in days between the end date and the start date.",
          "example": "daysAfter(\"2000-01-01\",\"2000-01-05\") -> 4"
        },
        {
          "group": "datetime",
          "function": "addRandDays(input: string, min: number, max: number)",
          "name": "addRandDays",
          "description": "Adds a random number of days between the min and max to the date.\n If MAX is less than MIN, the value returned is the DATE plus the MIN minus 1",
          "example": "addRandDays(\"2000-01-01\", 3, 10) -> \"2000-01-05\""
        },
        {
          "group": "datetime",
          "function": "addMonths(input: string, months: number)",
          "name": "addMonths",
          "description": "Adds a number of months to a date, or subtracts them, if it is a negative number.",
          "example": "addMonths(\"2018/12/13\", -1) -> \"2018-11-13\""
        },
        {
          "group": "datetime",
          "function": "addYears(input: string, years: number)",
          "name": "addYears",
          "description": "Adds a number of years to a date, or subtracts them, if it is a negative number.",
          "example": "addYears(\"2018/12/13\", -1) -> \"2017-12-13\""
        },
        {
          "group": "datetime",
          "function": "time(input: string)",
          "name": "time",
          "description": "Returns the time portion of a datetime in the project format.",
          "example": "time(\"26/02/2008:12:23:22\") -> \"12:23:22\""
        },
        {
          "group": "datetime",
          "function": "dob(minAge: number, maxAge: number, input: string)",
          "name": "dob",
          "description": "Determines a date of birth, given a random age between a minimum and a maximum, on a specified date.",
          "example": "dob(4, 99, \"1901-12-08\") -> \"1861-09-18\""
        },
        {
          "group": "numeric",
          "function": "elfProef(sequence: string, sign: string)",
          "name": "elfProef",
          "description": "Find the next 11 proof number from the sequence, + or - for the sign",
          "example": "elfProef(\"100000003\", \"+\") -> 100000010"
        },
        {
          "group": "numeric",
          "function": "addLuhn(input: number)",
          "name": "addLuhn",
          "description": "Adds luhn checkdigit to number",
          "example": "addLuhn(123) -> 1236"
        },
        {
          "group": "numeric",
          "function": "luhn(input: number)",
          "name": "luhn",
          "description": "Create luhn-compliant number of specific length",
          "example": "luhn(4) -> 1236"
        },
        {
          "group": "numeric",
          "function": "customLuhn(input: number, index: number, targetLength: number, seedValue?: number)",
          "name": "customLuhn",
          "description": "Return a valid luhn number by inserting LENGTH 'random' digits after position INDEX",
          "example": "luhn(123467897,4,1) -> 1234567897"
        },
        {
          "group": "text",
          "function": "length(input: string)",
          "name": "length",
          "description": "Returns the number of characters in a string",
          "example": "length(\"abc\") -> 3"
        },
        {
          "group": "text",
          "function": "lower(input: string)",
          "name": "lower",
          "description": "Return a string in lower case",
          "example": "lower(\"ABC\") -> \"abc\""
        },
        {
          "group": "text",
          "function": "upper(input: string)",
          "name": "upper",
          "description": "Return a string in upper case",
          "example": "lower(\"abc\") -> \"ABC\""
        },
        {
          "group": "text",
          "function": "wordcap(input: string)",
          "name": "wordcap",
          "description": "Capitalizes a string",
          "example": "wordcap(\"hello world\") -> \"Hello World\""
        },
        {
          "group": "text",
          "function": "mid(input: string, startPos: number, stringLength?: number)",
          "name": "mid",
          "description": "Returns a substring starting from the given position, up to the end of the string",
          "example": "mid(\"ABCDEFGHIJKL\", 3, 4) -> \"CDEF\""
        },
        {
          "group": "numeric",
          "function": "randCreditCard(issuer: string)",
          "name": "randCreditCard",
          "description": "Returns a random credit card number from various issuers\n If issuer allow various card lengths it can be specified with _NUMBER suffix\n For example SOLO_18\n\n Supported issuer keys:\n AMEX - American Express\n CHINAT - China T-Union\n CHINAUNION - China UnionPay\n DINNERSCLUBA - Diners Club enRoute\n DINNERSCLUBB - Diners Club International\n DINNERSCLUBUS - Diners Club United States & Canada\n DISCOVERCARD - Discover Card\n UKRCARD - UkrCard\n RUPAY - RuPay\n INTERPAYMENT - InterPayment\n INSTAPAYMENT - InstaPayment\n JCB - JCB\n MAESTROUK - Maestro UK\n MAESTRO - Maestro\n DANKORT - Dankort\n MIR - MIR\n NPS - NPS Pridnestrovie\n MASTERCARD - Mastercard\n TROY - Troy\n VISA - Visa\n UATP - UATP\n VERVE - Verve\n LANKAPAY - LankaPay",
          "example": "randCreditCard(\"MASTERCARD\") -> \"2439709289227044\""
        },
        {
          "group": "csv",
          "function": "valueOfCSV(csvFileName: string, columnName: string)",
          "name": "valueOfCSV",
          "description": "Returns a value of column from a csv. Row number is calculated based on iteration",
          "example": "valueOfCSV(\"data.csv\", \"city\") -> \"Prague\""
        },
        {
          "group": "csv",
          "function": "valueOfCSVByColumn(csvFileName: string, columnNumber: number)",
          "name": "valueOfCSVByColumn",
          "description": "Returns a value for column number from a csv. Row number is calculated based on iteration",
          "example": "valueOfCSVByColumn(\"data.csv\", 2) -> \"Prague\""
        },
        {
          "group": "numeric",
          "function": "randInt(min: number, max: number, width?: number)",
          "name": "randInt",
          "description": "Alias for function randInt(min: number, max: number, width?: number)",
          "example": "randInt(10,15,3) -> 013"
        },
        {
          "group": "datetime",
          "function": "dateOfBirth(minAge: number, maxAge: number, input: string)",
          "name": "dateOfBirth",
          "description": "Alias for function dob(minAge: number, maxAge: number, input: string)",
          "example": "dateOfBirth(4, 99, \"1901-12-08\") -> \"1861-09-18\""
        },
        {
          "group": "datetime",
          "function": "dayOfWeek(input: string)",
          "name": "dayOfWeek",
          "description": "Alias for function dow(input: string)",
          "example": "dayOfWeek(\"2019/19/24\") -> 2"
        },
        {
          "group": "text",
          "function": "randFromSeedlist(percnull: number, seedListName: string, column: number = 1)",
          "name": "randFromSeedlist",
          "description": "Returns random value from seedlist",
          "example": "randFromSeedlist(10, \"femalenames\", 1) -> \"Jenny\""
        },
        {
          "group": "text",
          "function": "randFromList(percnull: number, source: string[])",
          "name": "randFromList",
          "description": "Alias for function randlov()",
          "example": "randFromList(0, [\"one\", \"two\", \"three\"]) -> \"two\"\n randFromList(10, perclist(\"10%ten\", \"20%twenty\", \"70%seventy\")) -> \"twenty\"\n randFromList(10, seedlist(\"femalenames\"), 1) -> \"Jenny\""
        }
      ],
      "request_id": "7402d6d8"
    }
    

    Attributes

    Get List of Card Issuers

    When creating a Data Model to generate test data, it is helpful to view the list of card issuers. Alternatively, you can also use Seed Lists and Data Generator Functions to generate test data, or a combination of all three.

    To choose among different providers when generating credit card numbers as test data, use the listed card issuer codes and ranges. Valid combinations of length range and code are, for example, AMEX_15 or VISA_16.

    Get List of Card Issuers

    curl 'https://tdm.blazemeter.com/api/v1/generator/cardIssuers' \
        -X GET \
        -H 'accept: application/json;charset=UTF-8'
    

    The following parameters are the base parameters required to get CardIssuers.

    Get List of Card Issuers Response Attributes

    Response 200 OK

    {
      "api_version": 1,
      "result": [
        {
          "code": "AMEX",
          "lengthRanges": [
            "15"
          ],
          "name": "American Express"
        },
        {
          "code": "CHINAT",
          "lengthRanges": [
            "19"
          ],
          "name": "China T-Union"
        },
        {
          "code": "CHINAUNION",
          "lengthRanges": [
            "16-19"
          ],
          "name": "China UnionPay"
        },
        {
          "code": "DINNERSCLUBA",
          "lengthRanges": [
            "14-19"
          ],
          "name": "Diners Club International"
        },
        {
          "code": "DINNERSCLUBB",
          "lengthRanges": [
            "16-19"
          ],
          "name": "Diners Club International"
        },
        {
          "code": "DINNERSCLUBUS",
          "lengthRanges": [
            "16"
          ],
          "name": "Diners Club United States & Canada"
        },
        {
          "code": "DISCOVERCARD",
          "lengthRanges": [
            "16-19"
          ],
          "name": "Discover Card"
        },
        {
          "code": "UKRCARD",
          "lengthRanges": [
            "16"
          ],
          "name": "UkrCard"
        },
        {
          "code": "RUPAY",
          "lengthRanges": [
            "16"
          ],
          "name": "RuPay"
        },
        {
          "code": "INTERPAYMENT",
          "lengthRanges": [
            "16-19"
          ],
          "name": "InterPayment"
        },
        {
          "code": "INSTAPAYMENT",
          "lengthRanges": [
            "16"
          ],
          "name": "InstaPayment"
        },
        {
          "code": "JCB",
          "lengthRanges": [
            "16-19"
          ],
          "name": "JCB"
        },
        {
          "code": "MAESTROUK",
          "lengthRanges": [
            "12-19"
          ],
          "name": "Maestro UK"
        },
        {
          "code": "MAESTRO",
          "lengthRanges": [
            "12-19"
          ],
          "name": "Maestro"
        },
        {
          "code": "DANKORT",
          "lengthRanges": [
            "16"
          ],
          "name": "Dankort"
        },
        {
          "code": "MIR",
          "lengthRanges": [
            "16"
          ],
          "name": "MIR"
        },
        {
          "code": "NPS",
          "lengthRanges": [
            "16"
          ],
          "name": "NPS Pridnestrovie"
        },
        {
          "code": "MASTERCARD",
          "lengthRanges": [
            "16"
          ],
          "name": "Mastercard"
        },
        {
          "code": "TROY",
          "lengthRanges": [
            "16"
          ],
          "name": "Troy"
        },
        {
          "code": "VISA",
          "lengthRanges": [
            "16"
          ],
          "name": "Visa"
        },
        {
          "code": "UATP",
          "lengthRanges": [
            "15"
          ],
          "name": "UATP"
        },
        {
          "code": "VERVE",
          "lengthRanges": [
            "16",
            "19"
          ],
          "name": "Verve"
        },
        {
          "code": "LANKAPAY",
          "lengthRanges": [
            "16"
          ],
          "name": "LankaPay"
        }
      ],
      "request_id": "c56a79dd"
    }
    

    Attributes

    Get List of Seed Lists

    When creating a Data Model to generate test data, it is helpful to view the list of seed lists. Seed lists are provided files that contain sample text such as names of countries, persons, streets, banks, months and weekdays, and so on, that you can use as test data. Alternatively, you can also use Data Generator Functions and Card Issuers functions to generate test data, or a combination of all three.

    Get List of Seed Lists

    curl 'https://tdm.blazemeter.com/api/v1/generator/seedlists' \
        -X GET \
        -H 'accept: application/json;charset=UTF-8'
    

    The following parameters are the base parameters required to get seed lists.

    Get List of Seed Lists Response Attributes

    Response (abbreviated) 200 OK

    {
      "api_version": 1,
      "result": [
        {
          "name": "banknames",
          "path": "seedlist/banknames.sqlite3",
          "size": 20480
        },
        {
          "name": "companies",
          "path": "seedlist/companies.sqlite3",
          "size": 24576
        },
        {
          "name": "computergames",
          "path": "seedlist/computergames.sqlite3",
          "size": 155648
        },
        {
          "name": "country",
          "path": "seedlist/country.sqlite3",
          "size": 20480
        },
        {
          "name": "creditcard",
          "path": "seedlist/creditcard.sqlite3",
          "size": 106496
        },
        {
          "name": "currencycode",
          "path": "seedlist/currencycode.sqlite3",
          "size": 12288
        },
        {
          "name": "dayofweek",
          "path": "seedlist/dayofweek.sqlite3",
          "size": 12288
        },
        {
          "name": "emailaddresses",
          "path": "seedlist/emailaddresses.sqlite3",
          "size": 77824
        },
        {
          "name": "energycompanies",
          "path": "seedlist/energycompanies.sqlite3",
          "size": 57344
        },
        {
          "name": "firstnames",
          "path": "seedlist/firstnames.sqlite3",
          "size": 20480
        },
        {
          "name": "lastnames",
          "path": "seedlist/lastnames.sqlite3",
          "size": 106496
        },
        {
          "name": "month",
          "path": "seedlist/month.sqlite3",
          "size": 12288
        },
        {
          "name": "streetnames",
          "path": "seedlist/streetnames.sqlite3",
          "size": 28672
        }
      ],
      "request_id": "48d03af4"
    }
    

    Attributes

    Test Data Orchestration

    After you have parameterized your tests to use Data Parameters from stored Data Entities, your test is ready for testing of stateless operations. However, if you want to test stateful operations, you have the requirement that the test environment needs to be initialized with specific test data. Test Data Orchestrations lets you prepare the test environment by reading values from, and posting values to your test environment, before and after the test runs.

    Publish Data Model

    API Publishing means taking, for example, generated data and initializing a service by publishing the data to it before running the test. Orchtestration can read, write, or delete data to prepare your test environment. For more information, check the Data Structures section.

    You can associate a Data Model with an API Publish target; in this case, the API publishing is done automatically for you before the test is being executed.

    However, there are also situations when you want to execute Orchestration stand-alone, without running a test, for example, when debugging. Stand-alone publishing is done using the following API Publish endpoint:

    Publish Data Model

    curl 'https://tdm.blazemeter.com/api/v1/api-publish/publish' \
        -X POST \
        -H 'accept: application/json;charset=UTF-8'
        -d '{
      "data": {
        "type": "api-publish",
        "attributes": {
          "data": [
            {
              "name": "Samantha"
            }
          ],
          "publishConfig": {
            "user": {
              "create": [
                {
                  "method": "GET",
                  "url": "http://www.google.com/search?q=${user.name}",
                  "headers": {},
                  "request": "",
                  "result": {}
                }
              ]
            }
          },
          "publishKey": "user",
          "requestConfig": {},
          "properties": [
            "name"
          ],
          "privateLocation": {}
        }
      }
    }
    '
    

    The following parameters are the base parameters required to publish a Data Model.

    Publish a Data Model Response Attributes

    Response 200 OK

    {
      "api_version": 1,
      "result": [
        {
          "steps": [
            {
              "httpRequest": {
                "method": "GET",
                "url": "http://www.google.com/search?q=Samantha",
                "body": "",
                "headers": {}
              },
              "httpResponse": {
                "data": "...",
                "status": 200,
                "statusText": "OK",
                "headers": {
                  "content-type": "text/html; charset=ISO-8859-1",
                  "date": "Tue, 07 Jun 2022 12:28:01 GMT",
                  "expires": "-1",
                  "cache-control": "private, max-age=0",
                  "p3p": "CP=\"This is not a P3P policy! See g.co/p3phelp for more info.\"",
                  "server": "gws",
                  "x-xss-protection": "0",
                  "x-frame-options": "SAMEORIGIN",
                  "set-cookie": [
                    "1P_JAR=2022-06-07-12; expires=Thu, 07-Jul-2022 12:28:01 GMT; path=/; domain=.google.com; Secure",
                    "AEC=AakniGPwno52PIyrieywNKjkVTHfj04eNTVgtt_nVh_eUN5f3n28QYxUnQs; expires=Sun, 04-Dec-2022 12:28:01 GMT; path=/; domain=.google.com; Secure; HttpOnly; SameSite=lax",                "NID=511=qKUT2oXph20S_V3WsQovbZt1w0UJF8EI1zy4NwbBJynYBgHTJQfCpMCSSX50YWlCzComI0dza6Q8qWCqmzbab0ewW2oyXLk_UzUBbkUvV630_PncU0N88uccIWCJVI9JNme_QMAzUGKsVfRCHiW2yUm7Zf4e43AxMcn7jquTk-8; expires=Wed, 07-Dec-2022 12:28:01 GMT; path=/; domain=.google.com; HttpOnly"
                  ],
                  "accept-ranges": "none",
                  "vary": "Accept-Encoding",
                  "connection": "close",
                  "transfer-encoding": "chunked"
                }
              },
              "extractedResponse": {}
            }
          ],
          "updatedModel": {}
        }
      ],
      "request_id": "fd9f93dc"
    }
    

    Attributes

    Appendix

    This section contains additional details you may find useful as you progress in your use of the BlazeMeter API beyond typical use cases.

    Data Structures

    Model Override

    There are situations when you need to generate more rows than what is specified in the iteration settings in the model, or you need to use different CSV files than the ones that are defined in the model. In these situations, use a Model Override.

    A Model Override consists of three optional sections:

    Model Override Structure

    {
        model: DataModel,                     // Data Model Override
        context: DataSourceContext,           // Context Override (CSV)
        iterationOverride: IterationOverride, // Iteration Override
    }
    

    Data Model Override

    You use a Data Model Override when you need to override some entities in the Data Model. Entities from the Data Model Override are copied to the Data Model that we generate data for. If a Data Entity with that name already exists, it’s replaced, if it doesn’t exist, the Data Entity is added to the Data Model. The structure of the override is a Multi Entity Model.

    Sample Data Model Override

    "model": {
        "id": "datamodel/PetStore",
        "title": "Pet Store",
        "description": "A Pet Store model",
        "kind": "tdm",
        "entities": {
          "pet": {
            "type": "object",
            "repeat": 1,
            "properties": {
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            },
            "requirements": {
              "name": "randText(5, 10)",
              "email": "$name + '@google.com'"
            }
          },
          "user": {
            "type": "object",
            "repeat": 1,
            "properties": {
              "name": {
                "type": "string"
              },
              "ownerOf": {
                "type": "string"
              }
            },
            "requirements": {
              "name": "randText(5, 10)",
              "ownerOf": "${pet.name}"
            }
          }
        }
    }
    

    Iteration Override

    You use an Iteration Override when you want to use different iteration settings than what is defined in the Data Model.

    Sample Iteration Override

    "iterationOverride": {
        "user": {
            "repeat": 10
        }
    }
    

    Context Override

    The Context Override is used when you want to change the CSV files used in the Data Sources to generate data.

    Sample Context Override

    "context": {
        "csvs": [
            "name": "some name",        // name used in the data source to reference the file
            "location": "some_file.csv" // URL of the CSV file
    ]
    }
    

    Billing Limits

    The Billing limits structure describes how your account's billing limits were applied when data was generated.

    Sample Billing Limits

    "billingLimits": {
        "total": 10000,         // max generated rows from billing plan
        "entity": {
          "user": {
            "apply": true,      // billing limits should be applied to this entity
            "applied": false,   // were billing limits applied? (e.g. was the number of rows higher than “total”
            "requested": 5,     // how many were requested to generate
            "generated": 5      // how many were actually generated
          }
        }
    }
    

    API Publish Config

    The API Publish Config maps data to sequences of one or more HTTP requests. The goal is to publish data to a target service or delete data from target service.

    The API Publish Config is an associative array, where the keys are the names of Data Model Entities, and the values are
    create and optionally delete configurations. Each configuration can contain one or more Publish steps that create or delete data.

    Note: The ? symbol denotes that a property is optional. In this case, the delete step is optional.

    Sample API Publish Config

    {
        someEntityName: {
            create: CreateConfig[],
            delete?: DeleteConfig[]
        }
    }
    

    Each CreateConfig structure is one step. Steps are executed sequentially. The CreateConfig and DeleteConfig both have the same structure.

    Sample CreateConfig/DeleteConfig structure

    {
        method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH",
        url: string,
        headers?: {
            [header: string]: string
        },
        request?: string;
        result?: {
            [paramName: string]: string
        }
    }
    

    The properties `url, headers, and request are TypesScript template literals. Please consult the TypeScript documentation to find out what can be done in these templates.

    Use the result to extract values from the HTTP response and store the value in a local or data model variable. The keys in the resulting associative array are variable names, and the values are JSON pointers.

    Request Config

    Use a Request Config if you need to configure authentication and an HTTP proxy for the Publish Config HTTP requests.

    Sample Request Config

    {
        auth?: {
            username: string;
            password: string;
        };
        xsrfCookieName?: string;
        xsrfHeaderName?: string;
        proxy?: {
            protocol?: string;
            host?: string;
            port?: number;
            auth?: {
                username: string;
                password: string;
            };
        };
    };
    

    Note: Only basic authentication is supported at this time.

    Private Location Config

    When you want to publish data to a Private Location, you need to specify the private location by providing it's shipID and harborId.

    Sample Private Location Config

    {
        harborId: string,
        shipId: string,
    }
    

    The Test Data Object

    A Test Data Model is defined in the entity array of a test's dependencies > data section. Each Test Data Model can contain Entities and CSV files. An Entity can contain one or more data parameters.

    The Test Data Object

    The Test Data Object

    {
        "data": {
            "type": "datamodel",
            "attributes": {
                "model": {
                    "schema": "http://blazemeter.com/blazedata/schema",
                    "id": "datamodel/emailaddress",
                    "title": "email contact",
                    "description": "random string at domain dot com",
                    "type": "object",
                    "kind": "tdm",
                    "entities": {
                        "MyDataEntity": {
                            "title": "MyDataEntity",
                            "type": "object",
                            "properties": {
                                "name": { "type": "string" },
                                "email": { "type": "string" }
                            },
                            "requirements": {
                                "name": "randText(5, 10)",
                                "email": "$name + '@google.com'"
                            }
                        }
                    }
                }
            }
        }
    }
    

    Glossary

    This section covers the various terms that are used throughout the APIs.

    Asset Dependencies

    An example of an Asset dependency is that a Mock Service uses test data from a specific Data Entity. Assets within the Asset Repository of one workspace can depend on each other; the dependency has a type and can be within one Asset Package, or inter-package.

    Asset Package

    Assets within the same workspace can be organized in Asset Packages. For example, a package can contain all the assets describing one application or one service. Packages are versioned.

    Asset Repository

    The Asset Repository stores all shared Assets for a workspace. An Asset is a test data entity, such as a CSV file.

    An Asset is comprised of the following parts:

    An Asset Repository's scope is that of a BlazeMeter workspace. This means you cannot search assets and packages across workspaces, nor can you create dependencies between assets from different workspaces.

    Data Model ID

    The Data Model ID is the unique identifier of a Data Model for test data generation. It is used in the following APIs:

    It is found in the response of the following APIs:

    Test Data Model

    To manage test data for a service or a web application, you create a data model for it. A data model consists of one or more Data Entities. Data Entities can be in relationships with one another (currently only a 1-to-1 relationship is supported). The Data Model is a JSON document based on a JSON schema.

    Test Data Entity

    A Data Entity is a set of data parameters that you typically use together in a test run, such as username and password pairs of tester accounts. A Data Entity contains a type declaration for each parameter, and the so-called Data Requirements for the parameter. Data Parameters can reference each other, and they can also reference parameters from another entity in the same data model.

    Test Data Requirements

    A Data Requirement is an ECMAScript expression (specifically, ES6 with some syntax extensions) which defines the test data that is supposed to be in an instance of the property.

    The properties section is where you declare data properties and their types. The syntax is based on the property type section of the JSON Schema specification. The following examples declares three data parameters, name, email, and age as strings and integer, respectively.

    Test Data Requirements

    { "data":{  
        "type":"datamodel", 
            "attributes":{ 
                "id":"datamodel/Accounts", 
                "title":"User Account Data", 
                "description":"user account data includes name, age, and email", 
                "type":"object", 
                "kind":"tdm", 
                "repeat":1, 
                "properties":{ 
                    "name":{ "type":"string"}, 
                    "age":{"type":"integer"}, 
                    "email":{"type":"string"} 
                }, 
                "requirements":{ 
                    "name":"randText(5, 10)", 
                    "email":"$name + '@acme.com'" 
                    "age":"randRange(18,99)"
                } 
            } 
        }
    }
    

    Test Data Requirements: Properties

    "properties":{ 
        "name":{ "type":"string"}, 
        "age":{"type":"integer"}, 
        "email":{"type":"string"} 
    }
    

    The requirements section is BlazeMeter's custom extension of the JSON Schema. In this section, you define requirements for the values of each property. The requirements are expressions using ECMAScript 6 syntax, such as “randInt(x,y) + 10” or "$name".

    Requirements commonly rely on BlazeMeter data generator functions, such as randText(5,10). For more information about supported functions and their arguments, see Get List of Data Generator Functions, Get List of Seedlists, and Get List of CardIssuers.

    The following example shows a Data Requirement that generates values the for three data parameters, name, email, and age, and initializes them using function calls and string concatenations.

    Test Data Requirements: Requirements

    "requirements":{ 
        "name":"randText(5,10)", 
        "email":"$name + '@acme.com'" 
        "age":"randRange(18,99)"
    }
    

    In the requirements, you can also use standard JavaScript expressions such as yield, await, new, delete, typeof, void, instanceof, in, arrow functions, spread, shift; variables; and operators, such as $name + '@acme.com' for string concatenation. Valid number literals are limited to decimal literals; hex, octal and binary literals are not supported.

    Test Data Model Inheritance

    A Data Model can extend one or more other models and override their parameters within a test with local values.

    Entity Data Source

    Some Data Requirements in an Entity may need to read data from sources, for example, CSV files or TDM F&R Models.

    Entity Data Target

    a Data Target describes which actions to perform with test data when a Data Model is published. The action can be to publish a Mock Service, to generate a CSV file, to read data to initialize values, to publish data to an API endpoint, to delete data from the test environment, and more.

    Test Data Model Publish

    Before a test is executed, BlazeMeter generates the requested test data and publishes Entity Data Targets to your test environments. This helps ensure that test data required for a test in the test environment is in a consistent state.