diff --git a/R/ZenodoRecord.R b/R/ZenodoRecord.R index 88ce38f..f8f39a7 100644 --- a/R/ZenodoRecord.R +++ b/R/ZenodoRecord.R @@ -57,8 +57,7 @@ ZenodoRecord <- R6Class("ZenodoRecord", self$metadata = obj$metadata resource_type = self$metadata$resource_type if(!is.null(resource_type)){ - resource_type_id = resource_type$type - if(!is.null(resource_type$subtype)) resource_type_id = paste(resource_type_id, resource_type$subtype,sep="-") + resource_type_id = resource_type$id self$metadata$resource_type = list(id = resource_type_id) } self$modified = obj$modified diff --git a/R/ZenodoRequest.R b/R/ZenodoRequest.R index 1ad5076..a5ca74f 100644 --- a/R/ZenodoRequest.R +++ b/R/ZenodoRequest.R @@ -64,7 +64,8 @@ ZenodoRequest <- R6Class("ZenodoRequest", headers <- c( "User-Agent" = private$agent, "Authorization" = paste("Bearer",private$token), - "Accept" = "application/vnd.inveniordm.v1+json" + "Content-Type" = "application/json", + "Accept" = if(regexpr("draft/files", req)>0) "application/json" else "application/vnd.inveniordm.v1+json" ) responseContent <- NULL @@ -96,9 +97,11 @@ ZenodoRequest <- R6Class("ZenodoRequest", req <- paste(url, request, sep="/") if(!is.null(file)){ contentType <- "multipart/form-data" + accept <- "application/json" data <- list(file = file, filename = data) }else{ contentType <- "application/json" + accept = "application/vnd.inveniordm.v1+json" data <- private$prepareData(data) } @@ -107,7 +110,7 @@ ZenodoRequest <- R6Class("ZenodoRequest", "User-Agent" = private$agent, "Authorization" = paste("Bearer",private$token), "Content-Type" = contentType, - "Accept" = "application/vnd.inveniordm.v1+json" + "Accept" = accept ) #send request