GraphQL Campaign Mutations¶
Overview¶
Best Practices¶
API Use Recommendations¶
Campaign templates aren't as critical as Test Case templates. They're useful in the UI for creating repeatable tests. They also make it much easier for a purple team operator to get started, however they aren't as critical for reporting as Test Case templates.
Campaign Mutation Examples¶
Create Campaign Template¶
Note
Creates a Campaign template that will be visible in the Library -> Campaign Templates section of VECTR. Additionally, Campaign templates show up as selection options when creating a new Assessment in the VECTR UI. This makes it easy to plan and populate a new Assessment with all the Test Cases you want to run.
mutation ($input: CreateCampaignTemplateInput!) {
campaign {
createTemplate(input: $input) {
campaigns {
id, name, description, createTime
}
}
}
}
{
"input": {
"campaignTemplateData": [
{
"name": "Test Campaign 1",
"organizationIds": ["1cf413ba-326a-4d18-979c-367eb1306f69"],
"description": "Campaign Description",
"testCaseTemplateIds": [
"a0de7667-6b88-455b-b672-b841c2e02f01"
]
}
]
}
}
{
"data": {
"campaign": {
"createTemplate": {
"campaigns": [
{
"id": "34ca7e40-540d-464d-8a1a-c5487f03f079",
"name": "Test Campaign 1",
"description": "Campaign Description",
"createTime": 1643941634684
}
]
}
}
}
}
Create a local Campaign¶
Note
Creates a campaign in the local db
. To add Test Cases to a campaign you've created, check out the Test Cases GraphQL documentation.
mutation ($input: CreateCampaignInput!) {
campaign {
create(input: $input) {
campaigns {
id, name, description, createTime
}
}
}
}
{
"input": {
"db": "MY_USER_DB",
"assessmentId": "d48751ef-8a64-406b-bb64-517c8b136562",
"campaignData": [
{
"name": "Test Campaign 1",
"organizationIds": ["1cf413ba-326a-4d18-979c-367eb1306f69"],
"description": "Campaign Description"
}
]
}
}
{
"data": {
"campaign": {
"create": {
"campaigns": [
{
"id": "cfc70c80-d501-4df2-aa95-32e8c094658d",
"name": "Test Campaign 1",
"description": "Campaign Description",
"createTime": 1643925646857
}
]
}
}
}
}