Skip to content
TestsigmaDOCS

Help

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

  • 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.