class DatasetApi extends TargetedHttpSupport with DebugEnhancedLogging
Functions that operate on a single dataset. See https://guides.dataverse.org/en/latest/api/native-api.html#datasets.
- Alphabetic
- By Inheritance
- DatasetApi
- TargetedHttpSupport
- HttpSupport
- DebugEnhancedLogging
- LazyLogging
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addFile(optDataFile: Option[File] = Option.empty, optFileMetadata: Option[FileMeta] = Option.empty): Try[DataverseResponse[FileList]]
- optDataFile
optional file data to upload
- optFileMetadata
optional metadata for the file
-
def
addFileItem(optDataFile: Option[File] = Option.empty, optFileMetadata: Option[String] = Option.empty): Try[DataverseResponse[FileList]]
This function is called addFileItem instead of simply addFile to avoid naming conflicts with the other addFile function.
This function is called addFileItem instead of simply addFile to avoid naming conflicts with the other addFile function. The only difference is that this function takes the metadata as a string, whereas addFile takes it as a model object.
- optDataFile
optional file data to upload
- optFileMetadata
optional metadata as a JSON string
- See also
https://guides.dataverse.org/en/latest/api/native-api.html#add-a-file-to-a-dataset
-
def
addPrestagedFile(prestagedFile: PrestagedFile): Try[DataverseResponse[FileList]]
Adds a pre-staged file
Adds a pre-staged file
- prestagedFile
metadata about the prestaged file
-
val
apiPrefix: String
- Attributes
- protected
- Definition Classes
- DatasetApi → HttpSupport
-
val
apiToken: Option[String]
- Attributes
- protected
- Definition Classes
- DatasetApi → HttpSupport
-
val
apiVersion: Option[String]
- Attributes
- protected
- Definition Classes
- DatasetApi → HttpSupport
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
assignRole(roleAssignment: RoleAssignment): Try[DataverseResponse[RoleAssignmentReadOnly]]
- roleAssignment
object describing the assignment
-
def
assignRole(s: String): Try[DataverseResponse[RoleAssignmentReadOnly]]
- s
JSON document describing the assignment
-
def
awaitLock(lockType: String, maxNumberOfRetries: Int = awaitLockStateMaxNumberOfRetries, waitTimeInMilliseconds: Int = ...): Try[Unit]
Utility function that lets you wait until a specified lock type is set.
Utility function that lets you wait until a specified lock type is set. Unlike most other functions in this library, this does not correspond directly with an API call. Rather the getLocks call is done repeatedly to check if the locks has been set. A use case is when an http/sr workflow wants to make sure that a dataset has been locked on its behalf, so that it can be sure to have exclusive access via its invocation ID.
- lockType
the lock type to wait for
- maxNumberOfRetries
the maximum number the check for unlock is made, defaults to awaitLockStateMaxNumberOfRetries
- waitTimeInMilliseconds
the time between tries, defaults to awaitLockStateMillisecondsBetweenRetries
-
val
awaitLockStateMaxNumberOfRetries: Int
- Attributes
- protected
-
val
awaitLockStateMillisecondsBetweenRetries: Int
- Attributes
- protected
-
def
awaitUnlock(maxNumberOfRetries: Int = awaitLockStateMaxNumberOfRetries, waitTimeInMilliseconds: Int = ...): Try[Unit]
Utility function that lets you wait until all locks are cleared before proceeding.
Utility function that lets you wait until all locks are cleared before proceeding. Unlike most other functions in this library, this does not correspond directly with an API call. Rather the getLocks call is done repeatedly to check if the locks have been cleared. Note that in scenarios where concurrent processes might access the same dataset it is not guaranteed that the locks, once cleared, stay that way.
- maxNumberOfRetries
the maximum number the check for unlock is made, defaults to awaitLockStateMaxNumberOfRetries
- waitTimeInMilliseconds
the time between tries, defaults to awaitLockStateMillisecondsBetweenRetries
-
val
baseUrl: URI
- Attributes
- protected
- Definition Classes
- DatasetApi → HttpSupport
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
val
connectionTimeout: Int
- Attributes
- protected
- Definition Classes
- DatasetApi → HttpSupport
- def createPrivateUrl(): Try[DataverseResponse[PrivateUrlData]]
-
def
debug(msg: String)(implicit enclosing: Name): Unit
- Definition Classes
- DebugEnhancedLogging
-
def
delete(): Try[DataverseResponse[DataMessage]]
Note: delete on a published dataset with one version also works, if you are a superuser.
Note: delete on a published dataset with one version also works, if you are a superuser.
-
def
deleteAtTarget[D](endPoint: String)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
- Attributes
- protected
- Definition Classes
- TargetedHttpSupport
-
def
deleteDraft(): Try[DataverseResponse[DataMessage]]
Deletes the current draft of a dataset.
Deletes the current draft of a dataset.
Note: as of writing this there is a bug in Dataverse (v5.1.1) which causes it to use the literal string
:persistendId
in the response message instead of the actual identifier when using a PID. -
def
deleteMetadata(fields: FieldList): Try[DataverseResponse[DatasetVersion]]
Deletes one or more values from the current draft's metadata.
Deletes one or more values from the current draft's metadata. Note that the delete will fail if the result would leave required fields empty.
- fields
the fields to delete
-
def
deleteMetadata(s: String): Try[DataverseResponse[DatasetVersion]]
Deletes one or more values from the current draft's metadata.
Deletes one or more values from the current draft's metadata. Note that the delete will fail if the result would leave required fields empty.
- s
JSON document describing what to delete
-
def
deletePath[D](subPath: String = null, headers: Map[String, String] = Map.empty, params: Map[String, String] = Map.empty)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
- Attributes
- protected
- Definition Classes
- HttpSupport
- def deletePrivateUrl(): Try[DataverseResponse[Nothing]]
-
def
deleteRoleAssignment(assignmentId: Int): Try[DataverseResponse[Nothing]]
Use DatasetApi#listRoleAssignments to get the ID.
Use DatasetApi#listRoleAssignments to get the ID.
- assignmentId
the ID of the assignment to delete
- def destroy(): Try[DataverseResponse[DataMessage]]
-
def
editMetadata(fields: FieldList, replace: Boolean = true): Try[DataverseResponse[DatasetVersion]]
Edits the current draft's metadata, adding the fields that do not exist yet.
Edits the current draft's metadata, adding the fields that do not exist yet. If
replace
is set tofalse
, all specified fields must be either currently empty or allow multiple values.- fields
list of fields to edit
- replace
whether to replace existing values
-
def
editMetadata(s: String, replace: Boolean): Try[DataverseResponse[DatasetVersion]]
Edits the current draft's metadata, adding the fields that do not exist yet.
Edits the current draft's metadata, adding the fields that do not exist yet. If
replace
is set tofalse
, all specified fields must be either currently empty or allow multiple values.- s
JSON document containing the edits to perform
- replace
whether to replace existing values
-
def
editMetadata(s: String): Try[DataverseResponse[DatasetVersion]]
Edits the current draft's metadata, adding the fields that do not exist yet.
Edits the current draft's metadata, adding the fields that do not exist yet. If
replace
is set tofalse
, all specified fields must be either currently empty or allow multiple values. Replaces existing data.- s
JSON document containing the edits to perform
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exportMetadata(format: String): Try[DataverseResponse[Any]]
Since the export format is generally not JSON you cannot use the DataverseResponse#json and DataverseResponse#data on the result.
Since the export format is generally not JSON you cannot use the DataverseResponse#json and DataverseResponse#data on the result. You should instead use DataverseResponse#string.
Note that this API does not support specifying a version.
- format
the export format
-
val
extraHeaders: Map[String, String]
- Attributes
- protected
- Definition Classes
- DatasetApi → TargetedHttpSupport
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
get[D](subPath: String = null, headers: Map[String, String] = Map.empty, params: Map[String, String] = Map.empty)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
- Attributes
- protected
- Definition Classes
- HttpSupport
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getDownloadSize(version: Version = Version.LATEST): Try[DataverseResponse[DataMessage]]
- def getLocks: Try[DataverseResponse[List[Lock]]]
-
def
getMetadataBlock(name: String, version: Version = Version.LATEST): Try[DataverseResponse[MetadataBlock]]
- name
the metadata block identifier
- version
the version of the dataset
- def getPrivateUrl: Try[DataverseResponse[PrivateUrlData]]
- def getStorageDriver: Try[DataverseResponse[DataMessage]]
- def getStorageSize(includeCached: Boolean = false): Try[DataverseResponse[DataMessage]]
-
def
getUnversionedFromTarget[D](endPoint: String, queryParams: Map[String, String] = Map.empty)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
Get something for which versions do not apply
Get something for which versions do not apply
- D
the type of model object to expect in the response message
- endPoint
the API endpoint
- Attributes
- protected
- Definition Classes
- TargetedHttpSupport
-
def
getUnwrapped(subPath: String = null, headers: Map[String, String] = Map.empty, params: Map[String, String] = Map.empty): Try[HttpResponse[Array[Byte]]]
- Attributes
- protected
- Definition Classes
- HttpSupport
-
def
getUnwrappedFromTarget(endPoint: String, queryParams: Map[String, String] = Map.empty): Try[HttpResponse[Array[Byte]]]
- Attributes
- protected
- Definition Classes
- TargetedHttpSupport
-
def
getVersionedFromTarget[D](endPoint: String, version: Version = Version.LATEST)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
Get a specific version of something.
Get a specific version of something.
- D
the type of model object to expect in the response message
- endPoint
the API endpoint
- version
the version or version label
- Attributes
- protected
- Definition Classes
- TargetedHttpSupport
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
val
id: String
- Attributes
- protected
- Definition Classes
- DatasetApi → TargetedHttpSupport
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
val
isPersistentId: Boolean
- Attributes
- protected
- Definition Classes
- DatasetApi → TargetedHttpSupport
-
def
link(targetDataverse: String): Try[DataverseResponse[DataMessage]]
- targetDataverse
alias of the dataverse in which the link to the dataset should appear
-
def
listFiles(version: Version = Version.LATEST): Try[DataverseResponse[List[FileMeta]]]
- version
the version of the dataset
-
def
listMetadataBlocks(version: Version = Version.LATEST): Try[DataverseResponse[MetadataBlocks]]
- version
the version of the dataset
- returns
a map of metadata block identifier to metadata block
- def listRoleAssignments(): Try[DataverseResponse[List[RoleAssignmentReadOnly]]]
-
lazy val
logger: Logger
- Attributes
- protected
- Definition Classes
- LazyLogging
- Annotations
- @transient()
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
postFile[D](subPath: String, optFile: Option[File], optJsonMetadata: Option[String] = Option.empty, headers: Map[String, String] = Map.empty, params: Map[String, String] = Map.empty)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
Posts a multi-part message with an optional file and optional JSON metadata part.
Posts a multi-part message with an optional file and optional JSON metadata part. Probably at least one is required, but since this is an internal function, this is not validated.
- D
the payload type for the DataverseResponse
- subPath
subpath to post to
- optFile
the optional file
- optJsonMetadata
the optional metadata
- headers
extra headers
- params
extra query parameters
- returns
a DataverseResponse
- Attributes
- protected
- Definition Classes
- HttpSupport
-
def
postFileToTarget[D](endPoint: String, optFile: Option[File], optMetadata: Option[String], queryParams: Map[String, String] = Map.empty)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
- Attributes
- protected
- Definition Classes
- TargetedHttpSupport
-
def
postJson[D](subPath: String = null, body: String = null, headers: Map[String, String] = Map.empty, params: Map[String, String] = Map.empty, isJsonLd: Boolean = false)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
- Attributes
- protected
- Definition Classes
- HttpSupport
-
def
postJsonToTarget[D](endPoint: String, body: String, queryParams: Map[String, String] = Map.empty, headers: Map[String, String] = Map.empty, isJsonLd: Boolean = false)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
- Attributes
- protected
- Definition Classes
- TargetedHttpSupport
-
def
postText[D](subPath: String = null, body: String = null, headers: Map[String, String] = Map.empty, params: Map[String, String] = Map.empty)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
- Attributes
- protected
- Definition Classes
- HttpSupport
-
def
publish(updateType: UpdateType, assureIsIndexed: Boolean = true): Try[DataverseResponse[DatasetPublicationResult]]
Publishes the current draft of a dataset as a new version.
Publishes the current draft of a dataset as a new version.
If publish is called shortly after a modification and there is a pre-publication workflow installed, there is a risk of the workflow failing to start because of an OptimisticLockException. This is caused by Dataverse indexing the dataset on a separate thread. This will appear to the client as Dataverse silently failing (i.e. returning success but not publishing the dataset). To make sure that indexing has already happened the
assureIsIndexed
parameter is set totrue
. It will cause Dataverse to fail fast if indexing is still pending.- updateType
major or minor version update
- assureIsIndexed
make Dataverse return 409 Conflict if an index action is pending
-
def
put[D](subPath: String = null, body: String = null, headers: Map[String, String] = Map.empty, params: Map[String, String] = Map.empty)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
- Attributes
- protected
- Definition Classes
- HttpSupport
-
def
putJson[D](subPath: String = null, body: String = null, headers: Map[String, String] = Map.empty, params: Map[String, String] = Map.empty, isJsonLd: Boolean = false)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
- Attributes
- protected
- Definition Classes
- HttpSupport
-
def
putJsonToTarget[D](endPoint: String, body: String, queryParams: Map[String, String] = Map.empty, isJsonLd: Boolean = false)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
- Attributes
- protected
- Definition Classes
- TargetedHttpSupport
-
def
putToTarget[D](endPoint: String, body: String, queryParams: Map[String, String] = Map.empty)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
- Attributes
- protected
- Definition Classes
- TargetedHttpSupport
-
val
readTimeout: Int
- Attributes
- protected
- Definition Classes
- DatasetApi → HttpSupport
-
def
releaseMigrated(publicationDateJsonLd: String, assureIsIndexed: Boolean = true): Try[DataverseResponse[DatasetPublicationResult]]
Publishes the current draft of an imported dataset as a new version with the original publication date.
Publishes the current draft of an imported dataset as a new version with the original publication date.
If publish is called shortly after a modification and there is a pre-publication workflow installed, there is a risk of the workflow failing to start because of an OptimisticLockException. This is caused by Dataverse indexing the dataset on a separate thread. This will appear to the client as Dataverse silently failing (i.e. returning success but not publishing the dataset). To make sure that indexing has already happened the
assureIsIndexed
parameter is set totrue
. It will cause Dataverse to fail fast if indexing is still pending.- publicationDateJsonLd
original publication date
- assureIsIndexed
make Dataverse return 409 Conflict if an index action is pending
- def resetStorageDriver(): Try[DataverseResponse[DataMessage]]
-
def
returnToAuthor(s: String): Try[DataverseResponse[DataMessage]]
- s
JSON document containing the reason for returning the dataset
-
def
revertCitationDateField(): Try[DataverseResponse[Nothing]]
Restores the default citation date field type.
Restores the default citation date field type.
-
val
sendApiTokenViaBasicAuth: Boolean
- Attributes
- protected
- Definition Classes
- DatasetApi → HttpSupport
-
def
setCitationDateField(fieldName: String): Try[DataverseResponse[Nothing]]
Sets the dataset citation date field type for a given dataset.
Sets the dataset citation date field type for a given dataset.
- fieldName
the field name of a date field
-
def
setEmbargo(embargo: Embargo): Try[DataverseResponse[Any]]
No link yet, feature yet to be released in Dataverse
-
def
setEmbargo(embargo: String): Try[DataverseResponse[Any]]
No link yet, feature yet to be released in Dataverse
-
def
setStorageDriver(driver: String): Try[DataverseResponse[DataMessage]]
- See also
driver the label of the storage driver to use
- def submitForReview(): Try[DataverseResponse[DataMessage]]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
val
targetBase: String
- Attributes
- protected
- Definition Classes
- DatasetApi → TargetedHttpSupport
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
trace[V](value: Text[V])(implicit enclosing: Name): Unit
- Definition Classes
- DebugEnhancedLogging
-
val
unblockKey: Option[String]
- Attributes
- protected
- Definition Classes
- DatasetApi → HttpSupport
-
def
updateMetadata(metadataBlocks: MetadataBlocks): Try[DataverseResponse[DatasetVersion]]
Creates or overwrites the current draft's metadata completely.
Creates or overwrites the current draft's metadata completely.
- metadataBlocks
map from metadata block id to
MetadataBlock
-
def
updateMetadata(s: String): Try[DataverseResponse[DatasetVersion]]
Creates or overwrites the current draft's metadata completely.
Creates or overwrites the current draft's metadata completely.
- s
JSON document containing the updated metadata blocks
-
def
updateMetadataFromJsonLd(s: String, replace: Boolean): Try[DataverseResponse[Any]]
- s
the JSONLD document
- replace
replace existing values if
true
only add values otherwise
- def view(version: Version = Version.LATEST): Try[DataverseResponse[DatasetVersion]]
- def viewAllVersions(): Try[DataverseResponse[List[DatasetVersion]]]
-
def
viewLatestVersion(): Try[DataverseResponse[DatasetLatestVersion]]
Almost the same as DatasetApi#view except that
viewLatestVersion
returns a JSON object that starts at the dataset level instead of the dataset version level.Almost the same as DatasetApi#view except that
viewLatestVersion
returns a JSON object that starts at the dataset level instead of the dataset version level. The dataset level contains some fields, most of which are replicated at the dataset version level, however. -
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()