Skip to main content

Seed Test Groups (v1)

Method & Path

POST /api/v1/workspace/:workspaceId/labs/test-groups/seed

Actual backend path: /v1/workspace/:workspaceId/labs/test-groups/seed

Description

Seed test groups from external API source. This fetches test groups from the external API and stores them in the database. Also seeds the associated tests for each test group.

Authentication

Required: JWT token in Authorization header

Required Permissions:

  • labs.manage

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token: Bearer <token>

Path Parameters

ParameterTypeRequiredDescription
workspaceIdstringYesWorkspace identifier (MongoDB ObjectId)

Response 200 OK

{
"success": true,
"message": "Test groups seeded successfully",
"count": 150,
"testsCount": 1200
}

Response Fields

FieldTypeDescription
successbooleanWhether the seeding was successful
messagestringSuccess message
countnumberNumber of test groups seeded
testsCountnumberTotal number of tests associated with groups

Common Errors

  • 401 Unauthorized: Missing or invalid authentication token
  • 403 Forbidden: Insufficient permissions (requires labs.manage)
  • 404 Not Found: Workspace not found
  • 500 Internal Server Error: Server error or external API failure

Notes

  • This operation may take some time depending on the number of test groups
  • Test groups are upserted (updated if exists, created if new)
  • Associated tests for each group are also seeded
  • Source data is cached in JSON files in lab-seed/testgroups/ directory