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
Parameter | Description |
---|---|
|
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 |
---|---|
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 841
{
"_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 |
---|---|---|
|
|
the id of the dataset |
|
|
the type of the entity |
|
|
the name of the dataset |
|
|
the parameters of the dataset |
|
|
the parameter values of the dataset |
|
|
the test case this dataset belongs to |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this dataset |
Create dataset
A POST
to /datasets
creates a new dataset.
HTTP request
POST /api/rest/latest/datasets HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 419
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
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
Parameter | Description |
---|---|
|
the id of the dataset |
HTTP request
PATCH /api/rest/latest/datasets/2 HTTP/1.1
Content-Type: application/json
Accept: 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-Type: application/json
Content-Length: 698
{
"_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
Parameter | Description |
---|---|
|
the list of ids of the dataset |
HTTP request
DELETE /api/rest/latest/datasets/44 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080