Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA API CLOUD: How to insert a table in the description field using api

Deleted user July 17, 2023

Hello
I am trying to insert a table in the description field when creating a ticket in cloud via api.
I have tried with the following json but it gives me an error.

{

  "fields": {

    "project": {

      "key": "DES"

    },

    "summary": "Test api table",

    "description": {

      "type": "doc",

      "version": 1,

      "content": [

        {

          "type": "table",

          "content": {

            "type": "tableRow",

            "content": [

              {

                "type": "tableHeader",

                "content": [

                  {

                    "type": "text",

                    "text": "Columna 1"

                  }

                ]

              },

              {

                "type": "tableHeader",

                "content": [

                  {

                    "type": "text",

                    "text": "Columna 2"

                  }

                ]

              },

              {

                "type": "tableHeader",

                "content": [

                  {

                    "type": "text",

                    "text": "Columna 3"

                  }

                ]

              }

            ]

          }

        },

        {

          "type": "table",

          "content": {

            "type": "tableRow",

            "content": [

              {

                "type": "tableCell",

                "content": [

                  {

                    "type": "text",

                    "text": "Dato 1"

                  }

                ]

              },

              {

                "type": "tableCell",

                "content": [

                  {

                    "type": "text",

                    "text": "Dato 2"

                  }

                ]

              },

              {

                "type": "tableCell",

                "content": [

                  {

                    "type": "text",

                    "text": "Dato 3"

                  }

                ]

              }

            ]

          }

        },

        {

          "type": "table",

          "content": {

            "type": "tableRow",

            "content": [

              {

                "type": "tableCell",

                "content": [

                  {

                    "type": "text",

                    "text": "Dato 4"

                  }

                ]

              },

              {

                "type": "tableCell",

                "content": [

                  {

                    "type": "text",

                    "text": "Dato 5"

                  }

                ]

              },

              {

                "type": "tableCell",

                "content": [

                  {

                    "type": "text",

                    "text": "Dato 6"

                  }

                ]

              }

            ]

          }

        }

      ]

    },

    "issuetype": {

      "name": "Task"

    }

  }

}

The error is as follows.

{

    "errorMessages": [

        "INVALID_INPUT"

    ],

    "errors": {}

}
Can someone tell me how to do it correctly or where is the error?

Thanks

1 answer

1 accepted

4 votes
Answer accepted
Ajay _view26_
Community Champion
July 17, 2023

Hi @[deleted] 

Welcome to the community ... You can use the ADF library utilities below 

One is to verify Html to ADF and other does the opposite. By doing a comparison of your input with the playground, you can find the issue with the INVALID_INPUT

https://developer.atlassian.com/cloud/jira/platform/apis/document/playground/

https://developer.atlassian.com/cloud/jira/platform/apis/document/viewer/

 

Hope it helps 

Cheers

Ajay

Deleted user July 17, 2023

Hi @Ajay _view26_ 

With this tool I have been able to solve the problem perfectly.

Thank you very much for your help :)

Cheers!

Ajay _view26_
Community Champion
July 17, 2023

Your are welcome :)

Anmol Agarwal
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 3, 2024

Hi @[deleted] , can you share the payload here what you used to create table in the description

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events