Requirements

This chapter focuses on services for the requirements.

Browse all the requirements

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

HTTP request

GET /api/rest/latest/requirements?page=2&size=1&page=2&size=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: 1192

{
  "_embedded" : {
    "requirements" : [ {
      "_type" : "requirement",
      "id" : 60,
      "name" : "sample requirement",
      "current_version" : {
        "_type" : "requirement-version",
        "id" : 12,
        "reference" : "REQ_SAMP",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/requirement-versions/12"
          }
        }
      },
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/requirements/60"
        }
      }
    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://localhost:8080/api/rest/latest/requirements?page=0&size=1"
    },
    "prev" : {
      "href" : "http://localhost:8080/api/rest/latest/requirements?page=1&size=1"
    },
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/requirements?page=2&size=1"
    },
    "next" : {
      "href" : "http://localhost:8080/api/rest/latest/requirements?page=3&size=1"
    },
    "last" : {
      "href" : "http://localhost:8080/api/rest/latest/requirements?page=5&size=1"
    }
  },
  "page" : {
    "size" : 1,
    "totalElements" : 6,
    "totalPages" : 6,
    "number" : 2
  }
}

Response fields

Path Type Description

_embedded.requirements

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 a requirement

A GET to /requirements/{id} returns the requirement with the given id.

Path parameters

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

id

the id of the requirement

HTTP request

GET /api/rest/latest/requirements/624 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-Type: application/json;charset=UTF-8
Content-Length: 3038

{
  "_type" : "requirement",
  "id" : 624,
  "name" : "sample requirement 98-3",
  "project" : {
    "_type" : "project",
    "id" : 44,
    "name" : "sample project",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/projects/44"
      }
    }
  },
  "path" : "/sample project/domain 1/sample requirement 98-3",
  "parent" : {
    "_type" : "requirement-folder",
    "id" : 6,
    "name" : "domain 1",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/requirement-folders/6"
      }
    }
  },
  "mode" : "NATIVE",
  "current_version" : {
    "_type" : "requirement-version",
    "id" : 98,
    "name" : "sample requirement 98-3",
    "reference" : "REQ01",
    "version_number" : 3,
    "created_by" : "User-1",
    "created_on" : "2017-07-17T10:00:00Z",
    "last_modified_by" : "User-1",
    "last_modified_on" : "2017-07-17T10:00:00Z",
    "criticality" : "MAJOR",
    "category" : {
      "code" : "CAT_FUNCTIONAL"
    },
    "status" : "WORK_IN_PROGRESS",
    "description" : "<p>Description of the sample requirement.</p>",
    "custom_fields" : [ {
      "code" : "CF_TXT",
      "label" : "cuf text",
      "value" : "text value"
    }, {
      "code" : "CF_TAG",
      "label" : "cuf tag",
      "value" : [ "tag_1", "tag_2" ]
    } ],
    "verifying_test_cases" : [ {
      "_type" : "test-case",
      "id" : 100,
      "name" : "sample test case 1",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/test-cases/100"
        }
      }
    }, {
      "_type" : "test-case",
      "id" : 101,
      "name" : "sample test case 2",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/test-cases/101"
        }
      }
    } ],
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/requirement-versions/98"
      }
    }
  },
  "versions" : [ {
    "_type" : "requirement-version",
    "id" : 78,
    "name" : "sample requirement 98-1",
    "version_number" : 1,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/requirement-versions/78"
      }
    }
  }, {
    "_type" : "requirement-version",
    "id" : 88,
    "name" : "sample requirement 98-2",
    "version_number" : 2,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/requirement-versions/88"
      }
    }
  }, {
    "_type" : "requirement-version",
    "id" : 98,
    "name" : "sample requirement 98-3",
    "version_number" : 3,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/requirement-versions/98"
      }
    }
  } ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/requirements/624"
    },
    "project" : {
      "href" : "http://localhost:8080/api/rest/latest/projects/44"
    },
    "current_version" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-versions/98"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the requirement

_type

String

the type of the entity

name

String

the name of the current (latest) requirement version of this requirement

project

Object

the project which this requirement belongs to

path

String

the path of this requirement

parent

Object

the parent node of this requirement

mode

String

the management mode of the requirement

current_version

Object

the current requirement version of this requirement

versions

Array

the requirement versions of this requirement

_links

Object

related links

Relation Description

self

link to this requirement

project

link to the project this requirement belongs to

current_version

link to the current version of this requirement

Get all the children of a requirement

A GET to /requirements/{id}/children returns the children of the requirement with the given id.

Path parameters

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

id

the id of the requirement

HTTP request

GET /api/rest/latest/requirements/99/children?page=2&size=2&page=2&size=2 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)

include

level of depth of the content that should be returned (optional)

HTTP response

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

{
  "_embedded" : {
    "children" : [ {
      "_type" : "requirement",
      "id" : 47,
      "name" : "sample requirement 1",
      "current_version" : {
        "_type" : "requirement-version",
        "id" : 33,
        "reference" : "REQ_SAMP_1",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/requirement-versions/33"
          }
        }
      },
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/requirements/47"
        }
      }
    }, {
      "_type" : "requirement",
      "id" : 88,
      "name" : "sample requirement 2",
      "current_version" : {
        "_type" : "requirement-version",
        "id" : 11,
        "reference" : "REQ_SAMP_2",
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/requirement-versions/11"
          }
        }
      },
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/requirements/88"
        }
      }
    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://localhost:8080/api/rest/latest/requirements/99/children?page=0&size=2"
    },
    "prev" : {
      "href" : "http://localhost:8080/api/rest/latest/requirements/99/children?page=1&size=2"
    },
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/requirements/99/children?page=2&size=2"
    },
    "last" : {
      "href" : "http://localhost:8080/api/rest/latest/requirements/99/children?page=2&size=2"
    }
  },
  "page" : {
    "size" : 2,
    "totalElements" : 6,
    "totalPages" : 3,
    "number" : 2
  }
}

Response fields

Path Type Description

_embedded.children

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)