Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

POST API call - {"errorMessages":[],"errors":{"summary":"The summary is invalid because it contains

Hi There

I am trying to read data from excel from column 'Summary' and 'Description' which contains multiple lines but I am getting below error.

{"errorMessages":[],"errors":{"summary":"The summary is invalid because it contains newline characters."}}

Can someone please guide how to fix the issue ?

Here is my python code

 

# Read Json file
strGlobalVarPath = os.path.abspath(some path '/LogIssueinJira.json')
with open(strGlobalVarPath,mode='r') as json_file:
json_data = json.load(json_file)
json_file.close()

url = baseURL + '/rest/api/2/issue'
headers = {'Content-Type': 'application/json'}

#Read Jira Defect file from sys location
data_folder = Path("some path")
file_to_open = data_folder / "Jiratemplate.xlsx"
df = pandas.read_excel(file_to_open)

#Fetch the list value from summary and description
SummaryList = list(df['Summary'])
DescriptionList = list(df['Description'])

#POST call to JIRA to logged defect
value1 = 0
value2 = 0
while value1 in range(0,len(SummaryList)) and value2 in range(0,len(DescriptionList)):
w1 = SummaryList[value1]
w2 = DescriptionList[value2]
json_data['fields']['summary'] = w1
json_data['fields']['description'] = w2
payload = json.dumps(json_data)
r = requests.post(url, data=payload, headers=headers, auth=(username, password))

 

  

2 answers

0 votes
Hana Kučerová Community Leader Nov 26, 2020

Hi @Hitesh Sharma ,

I think what you need to do is remove newline characters from w1. I don't have much experience with Python, but I believe you will be able to find some appropriate way, how to do it, probably something like 

w1.strip('\n')

Thanks @Hana

But looks to me problem in below line of code.

SummaryList = list(df['Summary'])

 In excel, Summary column contains below data as in

abcde

fghij

however SummaryList return only abcde not fghij

I tried strip but not working though.

Thanks @Hana

But looks to me problem in below line of code.

SummaryList = list(df['Summary'])

 In excel, Summary column contains below data as in

abcde

fghij

however SummaryList return only abcde not fghij

I tried strip but not working though.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you