Skip to content
Testsigma DOCS

FAQs

How to Insert Test Data in RAW Body for POST API?


You can insert test data into the raw body of a POST API request by using Test Data Profiles (TDPs) and Data Generators. This allows you to send dynamic values instead of hard-coded data.

To quickly help you understand, this video demonstrates how to insert test data in RAW Body for POST API request.


  • To reference a parameter from a Test Data Profile, use: ”@|<ParameterName>|”
  • To generate dynamic data at runtime, use: ”!|<FunctionName>(arguments)|“

Example: Posting a Pet to Swagger Petstore

Section titled “Example: Posting a Pet to Swagger Petstore”
Terminal window
{
"id": "!|Number.digits(int:3)|",
"category": {
"id": 1,
"name": "dog"
},
"name": "@|DogName|",
"photoUrls": [
"https://example.com/photo1.png"
],
"tags": [
{
"id": 101,
"name": "friendly"
}
],
"status": "available"
}

In this example:

  • The id is generated dynamically using the Number.digits function from Data Generators, which creates a random 3-digit number at runtime.
  • The name is parameterized with the DogName field from the Test Data Profile.
  • Other fields, such as category, tags, and status are static but can also be parameterized if needed.