Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can use Jira's REST API to view, create or change data within the STAGIL Table field. The following section will help you to set up your API requests.

...

Table of Contents
excludeContent

...

Table

GET TABLE

Use this request to get all tabular data from a concrete table. You will need the issue ID or key from the issue you want to pull the data from and the custom field ID:

BASEURL/rest/api/2/issue/{issueIDOrKey}

Example URL:

https://yourjiraURL/rest/api/2/issue/SAJ-2837?fields=customfield_22504&expand=renderedFields

Customfield_22504 and renderedFields are the query params:

...

Update Table

Method:

Status
colourGreen
titlePUT

Updating the entire table is possible via Jira’s REST API.

Request:

Code Block
BaseURL/rest/api/2/issue/{issueIdOrKey}
Expand
titleBody example: Update table (existing rows)
Code Block
{
   "fields":{
      "customfield_id":"{\"values\":[
         {
            \"field-191\":[104],
            \"field-219\":\"text\",
            \"field-192\":\"BD-7\",
            \"field-190\":[\"vkisil\"],
            \"field-247\":8.5,
            \"field-248\":1028.5,
            \"orderPosition\":0,
            \"field-189\":false,
            \"id\":-1
         }
      ]}"
   }
}

Expand
titleBody example: Update table (add new row)

{
"fields":{
"customfield_id":"{\"values\":[
{
\"field-191\":[104],
\"field-219\":\"text\",
\"field-192\":\"BD-7\",
\"field-190\":[\"vkisil\"],
\"field-247\":8.5,
\"field-248\":1028.5,
\"orderPosition\":0,
\"field-189\":false,
\"id\":-1 //add new row
}
]}"
}
}

GET TABLE SUM

If you want to get the sum of your table directly, you can use the following syntax:

...

Example URL:

http://yourjiraURL/rest/stj/1.0/api/table/sum/customfield/22007/issue/DEMO-4/field/10

Response:

...

You can also get a csv export of your table by using REST API:

  • URL: https://yourjiraURL/rest/stj/1.0/api/table/{{fieldConfigId}}/{{issueIdOrKey}}/COMMA/csv

  • Response: you will receive the data of your table in csv format (separator = comma)

...

Table History

Method:

Status
colourGreen
titleGET

Description: provides data about changes in the STAGIL Tables & Checklist field or Table History.

...

Expand
titleParameters

{{customfieldID}} - STAGIL Tables & Checklists custom field ID.

{{issuekey}} - issue key of a target Jira issue.

Expand
titleResponse: 200

GET CSV FILE

You can also get a csv export of your table by using REST API:

  • URL: https://yourjiraURL/rest/stj/1.0/api/table/{{fieldConfigId}}/{{issueIdOrKey}}/COMMA/csv

  • Response: you will receive the data of your table in csv format (separator = comma)

PUT, POST, DELETE Requests

...

  • URL: https://yourjiraURL.xyz/rest/stj/1.0/api/table/data/customField/{{customFieldId}}/issue/{{issuekey}}/row/row/ID

  • Headers:

    • Your type of authorization

    • Content-Type: application/json;charset=UTF-8;

    • Accept: application/json;

  • You can get the row ID from the GET request, looking at the "id" of the row you want to modify.

  • URL example: http://localhost:8080/rest/stj/1.0/api/table/data/customField/25504/issue/KEY-4/row/123

  • With the GET request you can also see all the available fields and the structure of the table data. When you have drop-down, text or user columns, you only need the "field-1" part of the body. The "field-1-html" or "field-1-name" is not needed and will be added automatically. At the end of the body you don't need to add the custom field ID and the issue ID.

  • Example body: {"field-1": "Customer 7", "field-3": [2], "field-5": "anorth", "field-6": [8]}
    This structure is simply retrieved from the GET request and you only modify the fields that you want to change. In this example, field-1 is a text field, field-3 and field-6 are select lists and field-5 is a user picker.

  • For select list it is possible to use just "field-1-name": [“option1“, “option2“].

  • Please make sure to include all the used columns of your row in your PUT request. Missing columns will be overwritten with empty values!

POST Request - CREATE ROW

...

You can get the row ID from the GET request, looking at the "id" of the row you want to modify.

Managing Select List column options

GET Select List options

Returns the list of select list options