Requirement Folders

This chapter focuses on services for the requirement folders.

Get all requirement folders

A GET to /requirement-folders returns all the requirement folders that the user is allowed to read.

HTTP request

GET /api/rest/latest/requirement-folders?page=1&size=3 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 element should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1438

{
  "_embedded" : {
    "requirement-folders" : [ {
      "_type" : "requirement-folder",
      "id" : 23,
      "name" : "sample folder 1",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/requirement-folders/23"
        }
      }
    }, {
      "_type" : "requirement-folder",
      "id" : 26,
      "name" : "sample folder 2",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/requirement-folders/26"
        }
      }
    }, {
      "_type" : "requirement-folder",
      "id" : 31,
      "name" : "sample folder 3",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/requirement-folders/31"
        }
      }
    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders?page=0&size=3"
    },
    "prev" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders?page=0&size=3"
    },
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders?page=1&size=3"
    },
    "next" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders?page=2&size=3"
    },
    "last" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders?page=3&size=3"
    }
  },
  "page" : {
    "size" : 3,
    "totalElements" : 10,
    "totalPages" : 4,
    "number" : 1
  }
}

Response fields

Path Type Description

_embedded.requirement-folders

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 user 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 requirement folders tree by projects

A GET to /requirement-folders/tree/{ids} returns the requirement folders tree by projects that the user is allowed to read.

HTTP request

GET /api/rest/latest/requirement-folders/tree/10,11 HTTP/1.1
Accept: application/json
Host: localhost:8080

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 709

[ {
  "_type" : "project",
  "id" : 10,
  "name" : "project-1",
  "folders" : [ {
    "_type" : "requirement-folder",
    "id" : 100,
    "name" : "folder1",
    "url" : "http://localhost:8080/api/rest/latest/requirement-folders/100",
    "children" : [ ]
  }, {
    "_type" : "requirement-folder",
    "id" : 110,
    "name" : "folder2",
    "url" : "http://localhost:8080/api/rest/latest/requirement-folders/110",
    "children" : [ ]
  } ]
}, {
  "_type" : "project",
  "id" : 11,
  "name" : "project-2",
  "folders" : [ {
    "_type" : "requirement-folder",
    "id" : 120,
    "name" : "folder3",
    "url" : "http://localhost:8080/api/rest/latest/requirement-folders/120",
    "children" : [ ]
  } ]
} ]

Response fields

Path Type Description

[]._type

String

the type of the entity

[].id

Number

id of project

[].name

String

name of project

[].folders

Array

all folders for the given project

[].folders[]._type

String

the type of the entity

[].folders[].id

Number

id of the requirement folder

[].folders[].name

String

name of the requirement folder

[].folders[].url

String

url of the requirement folder

[].folders[].children

Array

children folders

Create requirement folder

A POST to /requirement-folders creates a new requirement folder. The parent object and the name are required; refer to the complete reference of Get requirement folder for the other attributes.

HTTP request

POST /api/rest/latest/requirement-folders HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 223
Host: localhost:8080

{
  "_type" : "requirement-folder",
  "name" : "Requirement subfolder 1",
  "custom_fields" : [ {
    "code" : "cuf1",
    "value" : "Cuf1 Value"
  } ],
  "parent" : {
    "_type" : "requirement-folder",
    "id" : 11
  }
}

HTTP response

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 1394

{
  "_type" : "requirement-folder",
  "id" : 33,
  "project" : {
    "_type" : "project",
    "id" : 14,
    "name" : "Test Project 1",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/projects/14"
      }
    }
  },
  "path" : "/Folder 1/Requirement subfolder 1",
  "parent" : {
    "_type" : "requirement-folder",
    "id" : 11,
    "name" : null,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/requirement-folders/11"
      }
    }
  },
  "custom_fields" : [ {
    "code" : "cuf1",
    "label" : "Lib Cuf1",
    "value" : "Cuf1 Value"
  }, {
    "code" : "cuf2",
    "label" : "Lib Cuf2",
    "value" : "true"
  } ],
  "name" : "Requirement subfolder 1",
  "created_by" : "admin",
  "created_on" : "2017-07-19T10:00:00.000+00:00",
  "last_modified_by" : "admin",
  "last_modified_on" : "2017-07-19T10:00:00.000+00:00",
  "description" : null,
  "attachments" : [ ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/33"
    },
    "project" : {
      "href" : "http://localhost:8080/api/rest/latest/projects/14"
    },
    "content" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/33/content"
    },
    "attachments" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/33/attachments"
    }
  }
}

Get requirement folder

A GET to /requirement-folders/{id} returns the requirement folder with the given id.

Path parameters

Table 1. /api/rest/latest/requirement-folders/{id}
Parameter Description

id

the id of the requirement folder

HTTP request

GET /api/rest/latest/requirement-folders/356 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
Content-Length: 1300

{
  "_type" : "requirement-folder",
  "id" : 356,
  "project" : {
    "_type" : "project",
    "id" : 12,
    "name" : "sample project",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/projects/12"
      }
    }
  },
  "path" : "/sample project/sample parent folder/embedded folder",
  "parent" : {
    "_type" : "requirement-folder",
    "id" : 34,
    "name" : "sample parent folder",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/requirement-folders/34"
      }
    }
  },
  "custom_fields" : [ ],
  "name" : "embedded folder",
  "created_by" : "User-1",
  "created_on" : "2017-07-19T10:00:00.000+00:00",
  "last_modified_by" : "User-2",
  "last_modified_on" : "2017-07-20T10:00:00.000+00:00",
  "description" : "<p>An embedded folder...</p>",
  "attachments" : [ ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/356"
    },
    "project" : {
      "href" : "http://localhost:8080/api/rest/latest/projects/12"
    },
    "content" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/356/content"
    },
    "attachments" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/356/attachments"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the entity

_type

String

the type of the entity

name

String

name of the entity

project

Object

project of the entity

parent

Object

the location of the entity (either a folder or the project if located at the root of the library)

path

String

the path of the entity

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)

description

String

description of that entity (html)

attachments

Array

the attachments of that entity

_links

Varies

related links

custom_fields

Array

the custom fields of this execution step

Relation Description

self

the link of the folder

project

the link of its project

content

the link of its content

attachments

the link of its attachments

Modify requirement folder

A Patch to /requirement-folders/{id} modifies the requirement folder with the given id.

HTTP request

PATCH /api/rest/latest/requirement-folders/33 HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 258
Host: localhost:8080

{
  "_type" : "requirement-folder",
  "name" : "Update - Requirement subfolder 1",
  "description" : "Update - Description Requirement subfolder 1",
  "custom_fields" : [ {
    "code" : "cuf1",
    "label" : "Lib Cuf1",
    "value" : "Cuf1 new value"
  } ]
}

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1454

{
  "_type" : "requirement-folder",
  "id" : 33,
  "project" : {
    "_type" : "project",
    "id" : 14,
    "name" : "Test Project 1",
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/projects/14"
      }
    }
  },
  "path" : "/Folder 1/Update - Requirement subfolder 1",
  "parent" : {
    "_type" : "requirement-folder",
    "id" : 11,
    "name" : null,
    "_links" : {
      "self" : {
        "href" : "http://localhost:8080/api/rest/latest/requirement-folders/11"
      }
    }
  },
  "custom_fields" : [ {
    "code" : "cuf1",
    "label" : "Lib Cuf1",
    "value" : "Cuf1 Value"
  }, {
    "code" : "cuf2",
    "label" : "Lib Cuf2",
    "value" : "true"
  } ],
  "name" : "Update - Requirement subfolder 1",
  "created_by" : "admin",
  "created_on" : "2017-07-19T10:00:00.000+00:00",
  "last_modified_by" : "admin",
  "last_modified_on" : "2017-07-19T10:00:00.000+00:00",
  "description" : "Update - Description Requirement subfolder 1",
  "attachments" : [ ],
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/33"
    },
    "project" : {
      "href" : "http://localhost:8080/api/rest/latest/projects/14"
    },
    "content" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/33/content"
    },
    "attachments" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/33/attachments"
    }
  }
}

Delete requirement folder

A DELETE to /requirement-folders/{ids} deletes one or several requirement folder with the given id(s). Remember that deleting a folder entails that its content is deleted as well !

Path parameters

Table 1. /api/rest/latest/requirement-folders/{ids}
Parameter Description

ids

the list of ids of the requirement folders

HTTP request

DELETE /api/rest/latest/requirement-folders/21,22 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080

Get requirement folder contents

A GET to /requirement-folders/{id}/content returns the content of the requirement folder with the given id.

Path parameters

Table 1. /api/rest/latest/requirement-folders/{id}/content
Parameter Description

id

the id of the requirement-folder

HTTP request

GET /api/rest/latest/requirement-folders/71/content?size=3&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)

include

level of depth of the content that should be returned (optional), available values : root or nested (more info in Parameter 'include' section)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1344

{
  "_embedded" : {
    "content" : [ {
      "_type" : "requirement",
      "id" : 78,
      "name" : "embedded requirement 1",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/requirements/78"
        }
      }
    }, {
      "_type" : "requirement",
      "id" : 44,
      "name" : "embedded requirement 2",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/requirements/44"
        }
      }
    }, {
      "_type" : "requirement-folder",
      "id" : 12,
      "name" : "embedded folder",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/requirement-folders/12"
        }
      }
    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/71/content?page=0&size=3"
    },
    "prev" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/71/content?page=0&size=3"
    },
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/71/content?page=1&size=3"
    },
    "last" : {
      "href" : "http://localhost:8080/api/rest/latest/requirement-folders/71/content?page=1&size=3"
    }
  },
  "page" : {
    "size" : 3,
    "totalElements" : 6,
    "totalPages" : 2,
    "number" : 1
  }
}

Response fields

Path Type Description

_embedded.content

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 user 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)