Which IIQ version are you inquiring about?
8.4
Problem Description
We have a simple plugin that exposes several APIs, the problem is to build the POST method correctly.
We have:
@POST
@Path("/search/paginatedResults")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response getPaginatedJobRuns(PaginatedJobRequestDto requestBody) {
try {
// Ottieni i parametri dal DTO che rappresenta il body JSON
int page = requestBody.getPagination().getPage();
int itemsxPage = requestBody.getPagination().getItemsxPage();
String startDate = requestBody.getFilters() != null ? requestBody.getFilters().getStartDate() : null;
String endDate = requestBody.getFilters() != null ? requestBody.getFilters().getEndDate() : null;
String jobName = requestBody.getFilters() != null ? requestBody.getFilters().getId() : null;
String column = requestBody.getOrders() != null ? requestBody.getOrders().getColumn() : null;
String sort = requestBody.getOrders() != null ? requestBody.getOrders().getSort() : null;
// Chiamata al service per elaborare la richiesta
PaginatedJobRunsDto jsonResponse = getSearchService().getPaginatedJobRuns(jobName, page,
itemsxPage, startDate, endDate, column, sort);
// Recupero i dati dal servizio
// PaginatedJobRunsDto response = getSearchService().getPaginatedJobRuns(
// searchRequest.getJobName(),X->5
// searchRequest.getPagination().getPage(),X
// searchRequest.getPagination().getItemsPerPage(),X
// searchRequest.getFilters().getStartDate(),X
// searchRequest.getFilters().getEndDate(),X
// searchRequest.getOrders().getColumn(),X
// searchRequest.getOrders().getSort()X
// );
// Ritorna una risposta con status OK e il risultato JSON
return Response.status(Response.Status.OK).entity(jsonResponse).build();
} catch (Exception e) {
e.printStackTrace();
// Gestione dell'errore e risposta con status 500
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
.entity("{\"error\":\"Errore durante la gestione della richiesta.\"}").build();
}
}
This method is in my class with the com.acme.training.rest.SearchResource package and extends BasePluginResource
`import sailpoint.rest.plugin.BasePluginResource;
@Path(“DashboardPlugin”)
@Produces(“application/json”)
@Consumes(“application/json”)
@AllowAll
public class SearchResource extends BasePluginResource{
…
}`
The API returns “405 Method Not Allowed” when testing in Postman as follows:
URL:
POST: http://localhost:8080/iiq/plugin/rest/DashboardPlugin/search/paginatedResults
HEADERS:
Content-Type: application/json
SCREEN BODY JSON:
Unlike all the other APIs (GET) that work fine when installed on IdentityIQ.
The path indicated is correct, I don’t know what else to do to make my HTTP POST method work.
Could you help me?