Hello everyone,
The below is the code i am trying to make the API work.
I went throught the below community link also.
I tried above, but then I was still getting 403 error as well as “XSRF check failed” . Then I tried doing below one by importing @XsrfProtectionExcluded.
I have written below line
import com.atlassian.annotations.security.XsrfProtectionExcluded;
//and main code is like this
@Api(value = "TestCase File Import Resource API(s)", description = "Following section describes the rest resources pertaining to IssueImporterResouece")
@Path("importer")
//@AnonymousAllowed
//@ResourceFilters(ZFJApiFilter.class)
@UnrestrictedAccess
@ZSFilterNameBinding
@UnlicensedSiteAccess
@XsrfProtectionExcluded
public class IssueImporterResource {
and below is the pom, still it is not able to detect the library i guess.
Am i doing it correctly or is someother way to do the above step?
I am using Java 17
<dependency>
<groupId>com.atlassian.annotations</groupId>
<artifactId>atlassian-annotations</artifactId>
<version>5.0.1</version>
<scope>provided</scope>
</dependency>
Below is the maven dependency that i used
https://mvnrepository.com/artifact/com.atlassian.annotations/atlassian-annotations/5.0.1
Is the solution that i am trying correct or is there any other way to make it work?
Please guide me through the correct solution please. I have been stuck from last 5 days.
Java -17
Jira 10
Below is the function that I am trying to call.
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Path("/fieldMapping")
@POST
public Response extractIssueMapping(@Context HttpServletRequest request) {
Response authRes = handleAuthRes();
if (authRes != null) return authRes;
if (ZephyrUtil.CheckMemoryUsage(authContext)) return JiraUtil.buildErrorResponse(Status.SERVICE_UNAVAILABLE, null,
authContext.getI18nHelper().getText("zephyr-je.service.temporary.unavailable.message")
, null);
Map<String, String> mapping = null;
try {
mapping = issueImportResourceDelegate.extractIssueMapping(request);
} catch (Exception e) {
return JiraUtil.buildErrorResponse(Response.Status.BAD_REQUEST, null, e.getMessage(), null);
}
return Response.status(Status.OK).entity(mapping).build();
}
Below is the error I am getting