Campaigns

This chapter focuses on services for the campaigns.

Get all campaigns

A GET to /campaigns returns all the campaigns that the client is allowed to read.

HTTP request

GET /api/rest/latest/campaigns?size=2&page=1 HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

page

number of the page to retrieve (optional)

size

size of the page to retrieve (optional)

sort

which attributes of the returned entities should be sorted on (optional)

fields

which fields of the elements should be returned (optional)

type

which type of the test case should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Length: 1074
Content-Type: application/json;charset=UTF-8

{
  "_embedded" : {
    "campaigns" : [ {
      "_type" : "campaign",
      "id" : 41,
      "name" : "sample campaign 1",
      "reference" : "SAMP_CAMP_1",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/campaigns/41"
        }
      }
    }, {
      "_type" : "campaign",
      "id" : 46,
      "name" : "sample campaign 2",
      "reference" : "SAMP_CAMP_2",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/campaigns/46"
        }
      }
    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns?page=0&size=2"
    },
    "prev" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns?page=0&size=2"
    },
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns?page=1&size=2"
    },
    "last" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns?page=1&size=2"
    }
  },
  "page" : {
    "size" : 2,
    "totalElements" : 4,
    "totalPages" : 2,
    "number" : 1
  }
}

Response fields

Path Type Description

_embedded.campaigns

Array

the list of elements for that page

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements the client is allowed to read

page.totalPages

Number

how many pages can be browsed

page.number

Number

the page number

_links

Object

related links

Relation Description

first

link to the first page (optional)

prev

link to the previous page (optional)

self

link to this page

next

link to the next page (optional)

last

link to the last page (optional)

Create campaign

A POST to /campaigns creates a new campaign.

HTTP request

POST /api/rest/latest/campaigns HTTP/1.1
Accept: application/json
Content-Length: 719
Content-Type: application/json
Host: localhost:8080

{
  "_type" : "campaign",
  "name" : "Campaign Test",
  "reference" : "ABCD",
  "status" : "PLANNED",
  "description" : "<p>Sed eget rhoncus sapien. Nam et pulvinar nisi. su Do</p>",
  "scheduled_start_date" : "2021-08-31T22:00:00.000+0000",
  "scheduled_end_date" : "2031-09-29T22:00:00.000+0000",
  "actual_start_date" : "2034-09-29T22:00:00.000+0000",
  "actual_end_date" : "2035-09-29T22:00:00.000+0000",
  "actual_start_auto" : false,
  "actual_end_auto" : false,
  "custom_fields" : [ {
    "code" : "CUF_A",
    "label" : "Cuf A",
    "value" : "value of A"
  }, {
    "code" : "CUF_B",
    "label" : "Cuf B",
    "value" : "value of B"
  } ],
  "parent" : {
    "_type" : "campaign-folder",
    "id" : 104
  }
}

HTTP response

HTTP/1.1 201 Created
Content-Length: 1432
Content-Type: application/json;charset=UTF-8

{
  "_type" : "campaign",
  "id" : 332,
  "name" : "Campaign Test",
  "reference" : "ABCD",
  "description" : "<p>Sed eget rhoncus sapien. Nam et pulvinar nisi. su Do</p>",
  "status" : "PLANNED",
  "project" : {
    "_type" : "project",
    "id" : 44,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/projects/44"
      }
    }
  },
  "path" : "/sample project/campaign folder/Campaign Test",
  "parent" : {
    "_type" : "campaign-folder",
    "id" : 7,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/campaign-folders/7"
      }
    }
  },
  "created_by" : "admin",
  "created_on" : "2017-06-15T10:00:00.000+0000",
  "last_modified_by" : "admin",
  "last_modified_on" : "2017-06-15T10:00:00.000+0000",
  "scheduled_start_date" : "2021-08-31T10:00:00.000+0000",
  "scheduled_end_date" : "2031-09-29T10:00:00.000+0000",
  "actual_start_date" : "2034-09-29T10:00:00.000+0000",
  "actual_end_date" : "2035-09-29T10:00:00.000+0000",
  "actual_start_auto" : false,
  "actual_end_auto" : false,
  "custom_fields" : [ {
    "code" : "CUF_A",
    "label" : "Cuf A",
    "value" : "value of A"
  }, {
    "code" : "CUF_B",
    "label" : "Cuf B",
    "value" : "value of B"
  } ],
  "iterations" : [ ],
  "test_plan" : [ ],
  "attachments" : [ ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/332"
    }
  }
}

Get campaign

A GET to /campaigns/{id} returns the campaign with the given id.

Path parameters

Table 1. /api/rest/latest/campaigns/{id}
Parameter Description

id

the id of the campaign

HTTP request

GET /api/rest/latest/campaigns/112 HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

fields

which fields of the elements should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Length: 2981
Content-Type: application/json;charset=UTF-8

{
  "_type" : "campaign",
  "id" : 112,
  "name" : "sample campaign",
  "reference" : "SAMP_CAMP",
  "description" : "<p>This is a sample campaign.</p>",
  "status" : "UNDEFINED",
  "project" : {
    "_type" : "project",
    "id" : 44,
    "name" : "sample project",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/projects/44"
      }
    }
  },
  "path" : "/sample project/campaign folder/sample campaign",
  "parent" : {
    "_type" : "campaign-folder",
    "id" : 7,
    "name" : "campaign folder",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/campaign-folders/7"
      }
    }
  },
  "created_by" : "User-1",
  "created_on" : "2017-07-20T10:00:00.000+0000",
  "last_modified_by" : "User-2",
  "last_modified_on" : "2017-07-21T10:00:00.000+0000",
  "scheduled_start_date" : "2017-08-01T10:00:00.000+0000",
  "scheduled_end_date" : "2017-08-31T10:00:00.000+0000",
  "actual_start_date" : "2017-08-01T10:00:00.000+0000",
  "actual_end_date" : "2017-08-31T10:00:00.000+0000",
  "actual_start_auto" : false,
  "actual_end_auto" : false,
  "custom_fields" : [ {
    "code" : "CUF_A",
    "label" : "Cuf A",
    "value" : "value of A"
  }, {
    "code" : "CUF_B",
    "label" : "Cuf B",
    "value" : "value of B"
  } ],
  "iterations" : [ {
    "_type" : "iteration",
    "id" : 91,
    "name" : "iteration 1",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/iterations/91"
      }
    }
  }, {
    "_type" : "iteration",
    "id" : 92,
    "name" : "iteration 2",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/iterations/92"
      }
    }
  } ],
  "test_plan" : [ {
    "_type" : "campaign-test-plan-item",
    "id" : 41,
    "referenced_test_case" : null,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/campaign-test-plan-items/41"
      }
    }
  }, {
    "_type" : "campaign-test-plan-item",
    "id" : 42,
    "referenced_test_case" : null,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/campaign-test-plan-items/42"
      }
    }
  }, {
    "_type" : "campaign-test-plan-item",
    "id" : 43,
    "referenced_test_case" : null,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/campaign-test-plan-items/43"
      }
    }
  } ],
  "attachments" : [ ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/112"
    },
    "project" : {
      "href" : "http://localhost:8080/api/rest/latest/projects/44"
    },
    "iterations" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/112/iterations"
    },
    "test-plan" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/112/test-plan"
    },
    "attachments" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/112/attachments"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of this entity

id

Number

the id of this campaign

name

String

the name of this campaign

reference

String

the reference of this campaign

description

String

the description of this campaign

status

String

the status of this campaign

project

Object

the project of this campaign

path

String

the path of this campaign

parent

Object

the parent entity of this campaign

created_by

String

user that created the entity

created_on

String

timestamp of the creation (ISO 8601)

last_modified_by

String

user that modified the entity the most recently

last_modified_on

String

timestamp of last modification (ISO 8601)

actual_start_date

String

actual start date

actual_end_date

String

actual end date

actual_start_auto

Boolean

whether the actual start date is automatically computed

actual_end_auto

Boolean

whether the actual end date is automatically computed

scheduled_start_date

String

scheduled start date

scheduled_end_date

String

scheduled end date

custom_fields

Array

the custom fields of this campaign

iterations

Array

the iterations of this campaign

test_plan

Array

the test-plan of this campaign

attachments

Array

the attachments of this campaign

_links

Object

related links

Relation Description

self

link to this campaign

project

link to the project of this campaign

iterations

link to the iterations of this campaign

test-plan

link to the test plan of this campaign

attachments

link to the attachments of this campaign

Get campaigns by name

A GET to /campaignsByName with a given campaignName returns the campaigns with the given name. Be careful, both the name of the parameter campaignName and the value of the campaign name are case-sensitive.

HTTP request

GET /api/rest/latest/campaignsByName/sample%20campaign HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

page

number of the page to retrieve (optional)

size

size of the page to retrieve (optional)

sort

which attributes of the returned entities should be sorted on (optional)

fields

which fields of the elements should be returned (optional)

type

which type of the test case should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Length: 792
Content-Type: application/json;charset=UTF-8

{
  "_embedded" : {
    "campaigns" : [ {
      "_type" : "campaign",
      "id" : 41,
      "name" : "sample campaign",
      "reference" : "SAMP_CAMP_1",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/campaigns/41"
        }
      }
    }, {
      "_type" : "campaign",
      "id" : 46,
      "name" : "sample campaign",
      "reference" : "SAMP_CAMP_2",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/campaigns/46"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/campaignsByName/sample%20campaign?page=0&size=20"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 2,
    "totalPages" : 1,
    "number" : 0
  }
}

Response fields

Path Type Description

_embedded.campaigns

Array

the list of elements for that page

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements the client is allowed to read

page.totalPages

Number

how many pages can be browsed

page.number

Number

the page number

_links

Object

related links

Relation Description

first

link to the first page (optional)

prev

link to the previous page (optional)

self

link to this page

next

link to the next page (optional)

last

link to the last page (optional)

Modify campaign

A Patch to /campaigns/{id} modifies the campaign with the given id.

HTTP request

PATCH /api/rest/latest/campaigns/332 HTTP/1.1
Accept: application/json
Content-Length: 413
Content-Type: application/json
Host: localhost:8080

{
  "_type" : "campaign",
  "name" : "Campaign Test",
  "reference" : "ABCD",
  "status" : "IN_PROGRESS",
  "description" : "<p>Sed eget rhoncus sapien. Nam et pulvinar nisi. su Do</p>",
  "scheduled_start_date" : "2021-08-31T22:00:00.000+0000",
  "scheduled_end_date" : "2031-09-29T22:00:00.000+0000",
  "actual_start_date" : "2034-09-29T22:00:00.000+0000",
  "actual_end_date" : "2035-09-29T22:00:00.000+0000"
}

HTTP response

HTTP/1.1 200 OK
Content-Length: 1279
Content-Type: application/json;charset=UTF-8

{
  "_type" : "campaign",
  "id" : 332,
  "name" : "Campaign Test",
  "reference" : "ABCD",
  "description" : "<p>Sed eget rhoncus sapien. Nam et pulvinar nisi. su Do</p>",
  "status" : "IN_PROGRESS",
  "project" : {
    "_type" : "project",
    "id" : 44,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/projects/44"
      }
    }
  },
  "path" : "/sample project/campaign folder/Campaign Test",
  "parent" : {
    "_type" : "campaign-folder",
    "id" : 7,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/campaign-folders/7"
      }
    }
  },
  "created_by" : "admin",
  "created_on" : "2017-06-15T10:00:00.000+0000",
  "last_modified_by" : "admin",
  "last_modified_on" : "2017-06-15T10:00:00.000+0000",
  "scheduled_start_date" : "2021-08-31T10:00:00.000+0000",
  "scheduled_end_date" : "2031-09-29T10:00:00.000+0000",
  "actual_start_date" : "2034-09-29T10:00:00.000+0000",
  "actual_end_date" : "2035-09-29T10:00:00.000+0000",
  "actual_start_auto" : false,
  "actual_end_auto" : false,
  "custom_fields" : [ ],
  "iterations" : [ ],
  "test_plan" : [ ],
  "attachments" : [ ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/332"
    }
  }
}

Delete campaign

A DELETE to /campaigns/{ids} deletes one or several campaign(s) with the given id(s).

Path parameters

Table 1. /api/rest/latest/campaigns/{ids}
Parameter Description

ids

the list of ids of the campaigns

HTTP request

DELETE /api/rest/latest/campaigns/169 HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: localhost:8080

Get iterations of campaign

A GET to /campaigns/{id}/iterations returns all the iterations of the campaign with the given id.

Path parameters

Table 1. /api/rest/latest/campaigns/{id}/iterations
Parameter Description

id

the id of the campaign

HTTP request

GET /api/rest/latest/campaigns/36/iterations?size=1&page=1 HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

page

number of the page to retrieve (optional)

size

size of the page to retrieve (optional)

sort

which attributes of the returned entities should be sorted on (optional)

fields

which fields of the elements should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 2756

{
  "_embedded" : {
    "iterations" : [ {
      "_type" : "iteration",
      "id" : 10,
      "name" : "sample iteration 1",
      "reference" : "SAMP_IT_1",
      "description" : "<p>This iteration is a sample one...</p>",
      "uuid" : "2f7194ca-eb2e-4379-f82d-ddc207c866bd",
      "parent" : {
        "_type" : "campaign",
        "id" : 36,
        "name" : "sample parent campaign",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/campaigns/36"
          }
        }
      },
      "created_by" : "User-1",
      "created_on" : "2017-07-21T10:00:00.000+0000",
      "last_modified_by" : "admin",
      "last_modified_on" : "2017-07-22T10:00:00.000+0000",
      "scheduled_start_date" : null,
      "scheduled_end_date" : null,
      "actual_start_date" : "2017-08-01T10:00:00.000+0000",
      "actual_end_date" : "2017-08-30T10:00:00.000+0000",
      "actual_start_auto" : false,
      "actual_end_auto" : false,
      "custom_fields" : [ {
        "code" : "CUF_Z",
        "label" : "Cuf Z",
        "value" : "value of Z"
      }, {
        "code" : "CUF_Y",
        "label" : "Cuf Y",
        "value" : "value of Y"
      } ],
      "test_suites" : [ {
        "_type" : "test-suite",
        "id" : 88,
        "name" : null,
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/test-suites/88"
          }
        }
      }, {
        "_type" : "test-suite",
        "id" : 11,
        "name" : null,
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/test-suites/11"
          }
        }
      }, {
        "_type" : "test-suite",
        "id" : 14,
        "name" : null,
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/test-suites/14"
          }
        }
      } ],
      "attachments" : [ ],
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/iterations/10"
        }
      }
    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/36/iterations?page=0&size=1"
    },
    "prev" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/36/iterations?page=0&size=1"
    },
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/36/iterations?page=1&size=1"
    },
    "next" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/36/iterations?page=2&size=1"
    },
    "last" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/36/iterations?page=2&size=1"
    }
  },
  "page" : {
    "size" : 1,
    "totalElements" : 3,
    "totalPages" : 3,
    "number" : 1
  }
}

Response fields

Path Type Description

_embedded.iterations

Array

the list of elements for that page

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements the client is allowed to read

page.totalPages

Number

how many pages can be browsed

page.number

Number

the page number

_links

Object

related links

Relation Description

first

link to the first page (optional)

prev

link to the previous page (optional)

self

link to this page

next

link to the next page (optional)

last

link to the last page (optional)

Get test plans of campaign

A GET to /campaigns/{id}/test-plan returns all the test-plans of the campaign with the given id.

Path parameters

Table 1. /api/rest/latest/campaigns/{id}/test-plan
Parameter Description

id

the id of the campaign

HTTP request

GET /api/rest/latest/campaigns/64/test-plan?size=2&page=1 HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

page

number of the page to retrieve (optional)

size

size of the page to retrieve (optional)

sort

which attributes of the returned entities should be sorted on (optional)

fields

which fields of the elements should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Content-Length: 3949

{
  "_embedded" : {
    "campaign-test-plan-items" : [ {
      "_type" : "campaign-test-plan-item",
      "id" : 4,
      "referenced_test_case" : {
        "_type" : "test-case",
        "id" : 8,
        "name" : "sample test case 8",
        "reference" : "TC-8",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/test-cases/8"
          }
        }
      },
      "referenced_dataset" : {
        "_type" : "dataset",
        "id" : 90,
        "name" : "sample dataset 90",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/datasets/90"
          }
        }
      },
      "assigned_to" : "User-1",
      "campaign" : {
        "_type" : "campaign",
        "id" : 64,
        "name" : "sample campaign 64",
        "reference" : "SAMP_CAMP_64",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/campaigns/64"
          }
        }
      },
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/campaign-test-plan-items/4"
        }
      }
    }, {
      "_type" : "campaign-test-plan-item",
      "id" : 70,
      "referenced_test_case" : {
        "_type" : "scripted-test-case",
        "id" : 10,
        "name" : "sample test case 10",
        "reference" : "TC-10",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/test-cases/10"
          }
        }
      },
      "referenced_dataset" : {
        "_type" : "dataset",
        "id" : 2,
        "name" : "sample dataset 2",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/datasets/2"
          }
        }
      },
      "assigned_to" : "User-1",
      "campaign" : {
        "_type" : "campaign",
        "id" : 64,
        "name" : "sample campaign 64",
        "reference" : "SAMP_CAMP_64",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/campaigns/64"
          }
        }
      },
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/campaign-test-plan-items/70"
        }
      }
    }, {
      "_type" : "campaign-test-plan-item",
      "id" : 71,
      "referenced_test_case" : {
        "_type" : "keyword-test-case",
        "id" : 11,
        "name" : "sample test case 11",
        "reference" : "TC-11",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/test-cases/11"
          }
        }
      },
      "referenced_dataset" : {
        "_type" : "dataset",
        "id" : 3,
        "name" : "sample dataset 3",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/datasets/3"
          }
        }
      },
      "assigned_to" : "User-1",
      "campaign" : {
        "_type" : "campaign",
        "id" : 64,
        "name" : "sample campaign 64",
        "reference" : "SAMP_CAMP_64",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/campaigns/64"
          }
        }
      },
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/campaign-test-plan-items/71"
        }
      }
    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/64/test-plan?page=0&size=2"
    },
    "prev" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/64/test-plan?page=0&size=2"
    },
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/64/test-plan?page=1&size=2"
    },
    "last" : {
      "href" : "http://localhost:8080/api/rest/latest/campaigns/64/test-plan?page=1&size=2"
    }
  },
  "page" : {
    "size" : 2,
    "totalElements" : 4,
    "totalPages" : 2,
    "number" : 1
  }
}

Response fields

Path Type Description

_embedded.campaign-test-plan-items

Array

the list of elements for that page

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements the client is allowed to read

page.totalPages

Number

how many pages can be browsed

page.number

Number

the page number

_links

Object

related links

Relation Description

first

link to the first page (optional)

prev

link to the previous page (optional)

self

link to this page

next

link to the next page (optional)

last

link to the last page (optional)