Datasets

This chapter focuses on services for the datasets.

Get dataset

A GET to /datasets/{id} returns the dataset with the given id.

Path parameters

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

id

the id of the dataset

HTTP request

GET /api/rest/latest/datasets/7 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: 841
Content-Type: application/json;charset=UTF-8

{
  "_type" : "dataset",
  "id" : 7,
  "name" : "sample dataset",
  "parameters" : [ {
    "_type" : "parameter",
    "id" : 1,
    "name" : "param_1"
  }, {
    "_type" : "parameter",
    "id" : 2,
    "name" : "param_2"
  } ],
  "parameter_values" : [ {
    "parameter_test_case_id" : 9,
    "parameter_value" : "login_1",
    "parameter_name" : "param_1",
    "parameter_id" : 1
  }, {
    "parameter_test_case_id" : 9,
    "parameter_value" : "password_1",
    "parameter_name" : "param_2",
    "parameter_id" : 2
  } ],
  "test_case" : {
    "_type" : "test-case",
    "id" : 9,
    "name" : "login test",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/test-cases/9"
      }
    }
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/datasets/7"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the dataset

_type

String

the type of the entity

name

String

the name of the dataset

parameters

Array

the parameters of the dataset

parameter_values

Array

the parameter values of the dataset

test_case

Object

the test case this dataset belongs to

_links

Object

related links

Relation Description

self

link to this dataset

Create dataset

A POST to /datasets creates a new dataset.

HTTP request

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

{
  "_type" : "dataset",
  "name" : "sample dataset",
  "parameter_values" : [ {
    "parameter_test_case_id" : 238,
    "parameter_value" : "login_1",
    "parameter_name" : "param_1",
    "parameter_id" : 1
  }, {
    "parameter_test_case_id" : 238,
    "parameter_value" : "password_1",
    "parameter_name" : "param_2",
    "parameter_id" : 2
  } ],
  "test_case" : {
    "_type" : "test-case",
    "id" : 238
  }
}

HTTP response

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

{
  "_type" : "dataset",
  "id" : 23,
  "name" : "sample dataset",
  "parameters" : [ {
    "_type" : "parameter",
    "id" : 1
  }, {
    "_type" : "parameter",
    "id" : 2
  } ],
  "parameter_values" : [ {
    "parameter_test_case_id" : 238,
    "parameter_value" : "login_1",
    "parameter_name" : "param_1",
    "parameter_id" : 1
  }, {
    "parameter_test_case_id" : 238,
    "parameter_value" : "password_1",
    "parameter_name" : "param_2",
    "parameter_id" : 2
  } ],
  "test_case" : {
    "_type" : "test-case",
    "id" : 238,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/test-cases/238"
      }
    }
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/datasets/23"
    },
    "test-case" : {
      "href" : "http://localhost:8080/api/rest/latest/test-cases/238"
    }
  }
}

Modify dataset

A Patch to /datasets/{id} modifies the dataset with the given id. You can modify name or parameter values or the both.

Path parameters

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

id

the id of the dataset

HTTP request

PATCH /api/rest/latest/datasets/2 HTTP/1.1
Accept: application/json
Content-Type: application/json
Content-Length: 190
Host: localhost:8080

{
  "_type" : "dataset",
  "name" : "modified data sample",
  "parameter_values" : [ {
    "parameter_value" : "new_login_1",
    "parameter_name" : "param_1",
    "parameter_id" : 1
  } ]
}

HTTP response

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

{
  "_type" : "dataset",
  "id" : 23,
  "name" : "modified data sample",
  "parameters" : [ {
    "_type" : "parameter",
    "id" : 1
  } ],
  "parameter_values" : [ {
    "parameter_test_case_id" : 238,
    "parameter_value" : "new_login_1",
    "parameter_name" : "param_1",
    "parameter_id" : 1
  } ],
  "test_case" : {
    "_type" : "test-case",
    "id" : 238,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/test-cases/238"
      }
    }
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/datasets/23"
    },
    "test-case" : {
      "href" : "http://localhost:8080/api/rest/latest/test-cases/238"
    }
  }
}

Delete dataset

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

Path parameters

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

id

the list of ids of the dataset

HTTP request

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