Hi community! I am trying to update some version fields but it gives me the following error about this code
def result = put("/rest/api/3/version/${releaseID}")
.header('Content-Type', 'application/json')
.body([
fields: [
description: Descripcion,
name: Nombre,
startDate: FechaInicio,
releaseDate: FechaRelease
]
])
.asString()
2023-09-22 12:41:19.243 INFO - PUT /rest/api/3/version/10675 asString Request Duration: 391ms 2023-09-22 12:41:19.244 WARN - PUT request to /rest/api/3/version/10675 returned an error code: status: 400 - Bad Request body: {"errorMessages":["Invalid request payload. Refer to the REST API documentation and try again."]} 2023-09-22 12:41:19.244 INFO - Serializing object into 'interface java.util.Map'
I could be an issue with the type of variable you have in description, name, startDate or releaseDate.
Regards
Hi @Florian Bonniec These are the variables and how I am capturing them:
Map Issue = get("/rest/api/3/issue/${issue.key}")
.header('Content-Type', 'application/json')
.asObject(Map)
.body
String Descripcion = issue.fields.description
String Nombre = Issue?.fields["summary"]
String FechaRelease = Issue?.fields["customfield_10090"]
String FechaInicio = Issue?.fields["customfield_10171"]
String releaseID = issue.fields["versions"]?.find()["id"]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have validate that each variable has the expected value in the expected format using logging ?
You could try to log the body and send it using postman for instance to validate the payload is right.
Reagrds
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was able to solve it by leaving the code like this, removing fields:
def result = put("/rest/api/3/version/${releaseID}")
.header('Content-Type', 'application/json')
.body([
description: Descripcion,
name: Nombre,
startDate: FechaInicio,
releaseDate: FechaRelease
])
.asString()
Thank you all for the help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, url and method seems fine.
Could you please double check request body (parameters) you send? Doc says ID is required.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tansu Akdeniz I see that the ID is not required in the request body, is required in
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.