Skip to content

Missing API v2 endpoint for downloading 'Other Metadata' associated with a file #3520

@eduardojst10

Description

@eduardojst10
  • functionality was available in RODA 5 via an endpoint api/v1/files/{fileUUID}/other_metadata/{type}/{suffix}?acceptFormat=bin similiar in
    /*** OTHER METADATA ****/
    @GET
    @Path("/{" + RodaConstants.API_PATH_PARAM_FILE_UUID + "}/" + RodaConstants.API_OTHER_METADATA + "/{"
    + RodaConstants.API_PATH_PARAM_OTHER_METADATA_TYPE + "}/{" + RodaConstants.API_PATH_PARAM_OTHER_METADATA_FILE_SUFFIX
    + "}")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, ExtraMediaType.APPLICATION_ZIP,
    ExtraMediaType.APPLICATION_JAVASCRIPT})
    @JSONP(callback = RodaConstants.API_QUERY_DEFAULT_JSONP_CALLBACK, queryParam = RodaConstants.API_QUERY_KEY_JSONP_CALLBACK)
    @Operation(summary = "Get other metadata", description = "Gets other metadata (JSON info or ZIP file).\nOptional query params of **start** and **limit** defined the returned query", responses = {
    @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = OtherMetadataList.class))),
    @ApiResponse(responseCode = "404", description = "Not found", content = @Content(schema = @Schema(implementation = ApiResponseMessage.class)))})
    public Response retrieveOtherMetadata(
    @Parameter(description = "The UUID of the existing File", required = true) @PathParam(RodaConstants.API_PATH_PARAM_FILE_UUID) String fileUUID,
    @Parameter(description = "The type of the other metadata", required = true) @PathParam(RodaConstants.API_PATH_PARAM_OTHER_METADATA_TYPE) String type,
    @Parameter(description = "The file suffix of the other metadata", required = true) @PathParam(RodaConstants.API_PATH_PARAM_OTHER_METADATA_FILE_SUFFIX) String suffix,
    @Parameter(description = "Choose format in which to get the metadata", schema = @Schema(implementation = RodaConstants.GetFileMediaTypes.class, defaultValue = RodaConstants.API_QUERY_VALUE_ACCEPT_FORMAT_JSON)) @QueryParam(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT) String acceptFormat,
    @Parameter(description = "JSONP callback name", required = false, schema = @Schema(defaultValue = RodaConstants.API_QUERY_DEFAULT_JSONP_CALLBACK)) @QueryParam(RodaConstants.API_QUERY_KEY_JSONP_CALLBACK) String jsonpCallbackName)
    throws RODAException {
    String mediaType = ApiUtils.getMediaType(acceptFormat, request);
    // get user
    User user = UserUtility.getApiUser(request);
    String fileSuffix = suffix;
    if (!fileSuffix.startsWith(".")) {
    fileSuffix = '.' + fileSuffix;
    }
    // delegate action to controller
    EntityResponse otherMetadata = Browser.retrieveOtherMetadata(user, fileUUID, type, fileSuffix, acceptFormat);
    if (otherMetadata instanceof ObjectResponse) {
    ObjectResponse<OtherMetadata> om = (ObjectResponse<OtherMetadata>) otherMetadata;
    return Response.ok(om.getObject(), mediaType).build();
    } else {
    return ApiUtils.okResponse((StreamResponse) otherMetadata);
    }
    }
  • verify if this functionality was migrated to RODA 6

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions