Parameters

This chapter focuses on services for the parameters.

Get parameter

A GET to /parameters/{id} returns the parameter with the given id.

Path parameters

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

id

the id of the parameter

HTTP request

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

{
  "_type" : "parameter",
  "id" : 47,
  "name" : "sampleParameter",
  "description" : "<p>My parameter</p>",
  "test_case" : {
    "_type" : "test-case",
    "id" : 102,
    "name" : "sample test case",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/test-cases/102"
      }
    }
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/parameters/47"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the parameter

_type

String

the type of the entity

name

String

the name of the parameter

description

String

the description of the parameter

test_case

Object

the test case this parameter belongs to

_links

Object

related links

Relation Description

self

link to this parameter

Create parameter

A POST to /parameters creates a new parameter.

HTTP request

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

{
  "_type" : "parameter",
  "name" : "sampleParameter",
  "description" : "<p>My parameter</p> ",
  "test_case" : {
    "_type" : "test-case",
    "id" : 102
  }
}

HTTP response

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

{
  "_type" : "parameter",
  "id" : 47,
  "name" : "sampleParameter",
  "description" : "<p>My parameter</p>",
  "test_case" : {
    "_type" : "test-case",
    "id" : 102,
    "name" : "sample test case",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/test-cases/102"
      }
    }
  },
  "_links" : {
    "self" : [ {
      "href" : "http://localhost:8080/api/rest/latest/parameters/47"
    }, {
      "href" : "http://localhost:8080/api/rest/latest/parameters/47"
    } ]
  }
}

Modify parameter

A Patch to /parameters/{id} modifies the parameter with the given id. You can modify name and/or description.

Path parameters

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

id

the id of the parameter

HTTP request

PATCH /api/rest/latest/parameters/47 HTTP/1.1
Accept: application/json
Content-Type: application/json
Host: localhost:8080
Content-Length: 113

{
  "_type" : "parameter",
  "name" : "Update-sampleParameter",
  "description" : "<p>Update My parameter</p> "
}

HTTP response

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

{
  "_type" : "parameter",
  "id" : 47,
  "name" : "Update-sampleParameter",
  "description" : "<p>Update My parameter</p>",
  "test_case" : {
    "_type" : "test-case",
    "id" : 102,
    "name" : "sample test case",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/test-cases/102"
      }
    }
  },
  "_links" : {
    "self" : [ {
      "href" : "http://localhost:8080/api/rest/latest/parameters/47"
    }, {
      "href" : "http://localhost:8080/api/rest/latest/parameters/47"
    } ]
  }
}

Delete parameter

A DELETE to /parameters/{id} deletes one parameter with the given id.

Path parameters

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

id

the list of id of the parameter

HTTP request

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