I have been trying to programmatically create version for a Jira project using Spring Cloud Feign.
I am following https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-project-versions/#api-rest-api-2-version-post
I am able to successfully execute the POST call via Postman, with request payload like :
{
"name": "ABC 2022.01.000",
"archived": false,
"released": true,
"projectId": 30500
}
However, when I try to create it through the feign client I get below exception :
Caused by: feign.FeignException$UnsupportedMediaType: [415] during [POST] to [https://jira.abc.com/rest/api/2/version] [JiraFeignClient#createVersion(VersionDTO)]: []
My feign client method:
@PostMapping(value = "/rest/api/2/version")
ResponseEntity<Object> createVersion(@RequestBody VersionDTO versionDTO);
VersionDTO.java :
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ToString
@Getter
@Setter
public class VersionDTO {
private String name;
private Boolean archived;
private Boolean released;
private Long projectId;
}
Not sure what's wrong with my DTO. Any guidance is appreciated.
try to add an 'accept' header with the expected content type.