Packages

c

nl.knaw.dans.lib.dataverse

DatasetApi

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.

Linear Supertypes
TargetedHttpSupport, HttpSupport, DebugEnhancedLogging, LazyLogging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DatasetApi
  2. TargetedHttpSupport
  3. HttpSupport
  4. DebugEnhancedLogging
  5. LazyLogging
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. 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

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#add-a-file-to-a-dataset

  5. 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

  6. def addPrestagedFile(prestagedFile: PrestagedFile): Try[DataverseResponse[FileList]]

    Adds a pre-staged file

    Adds a pre-staged file

    prestagedFile

    metadata about the prestaged file

    See also

    https://guides.dataverse.org/en/latest/developers/s3-direct-upload-api.html#adding-the-uploaded-file-to-the-dataset

  7. val apiPrefix: String
    Attributes
    protected
    Definition Classes
    DatasetApi → HttpSupport
  8. val apiToken: Option[String]
    Attributes
    protected
    Definition Classes
    DatasetApi → HttpSupport
  9. val apiVersion: Option[String]
    Attributes
    protected
    Definition Classes
    DatasetApi → HttpSupport
  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. def assignRole(roleAssignment: RoleAssignment): Try[DataverseResponse[RoleAssignmentReadOnly]]

  12. def assignRole(s: String): Try[DataverseResponse[RoleAssignmentReadOnly]]

  13. 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

  14. val awaitLockStateMaxNumberOfRetries: Int
    Attributes
    protected
  15. val awaitLockStateMillisecondsBetweenRetries: Int
    Attributes
    protected
  16. 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

  17. val baseUrl: URI
    Attributes
    protected
    Definition Classes
    DatasetApi → HttpSupport
  18. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  19. val connectionTimeout: Int
    Attributes
    protected
    Definition Classes
    DatasetApi → HttpSupport
  20. def createPrivateUrl(): Try[DataverseResponse[PrivateUrlData]]

  21. def debug(msg: String)(implicit enclosing: Name): Unit
    Definition Classes
    DebugEnhancedLogging
  22. 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.

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#delete-unpublished-dataset

  23. def deleteAtTarget[D](endPoint: String)(implicit arg0: Manifest[D]): Try[DataverseResponse[D]]
    Attributes
    protected
    Definition Classes
    TargetedHttpSupport
  24. 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.

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#delete-dataset-draft

  25. 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

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#delete-dataset-metadata

  26. 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

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#delete-dataset-metadata

  27. 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
  28. def deletePrivateUrl(): Try[DataverseResponse[Nothing]]

  29. def deleteRoleAssignment(assignmentId: Int): Try[DataverseResponse[Nothing]]

    Use DatasetApi#listRoleAssignments to get the ID.

  30. def destroy(): Try[DataverseResponse[DataMessage]]

  31. 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 to false, all specified fields must be either currently empty or allow multiple values.

    fields

    list of fields to edit

    replace

    whether to replace existing values

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#edit-dataset-metadata

  32. 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 to false, 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

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#edit-dataset-metadata

  33. 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 to false, all specified fields must be either currently empty or allow multiple values. Replaces existing data.

    s

    JSON document containing the edits to perform

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#edit-dataset-metadata

  34. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  35. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  36. 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

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#export-metadata-of-a-dataset-in-various-formats

  37. val extraHeaders: Map[String, String]
    Attributes
    protected
    Definition Classes
    DatasetApi → TargetedHttpSupport
  38. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  39. 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
  40. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  41. def getDownloadSize(version: Version = Version.LATEST): Try[DataverseResponse[DataMessage]]

  42. def getLocks: Try[DataverseResponse[List[Lock]]]

  43. def getMetadataBlock(name: String, version: Version = Version.LATEST): Try[DataverseResponse[MetadataBlock]]

    name

    the metadata block identifier

    version

    the version of the dataset

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#list-single-metadata-block-for-a-dataset

  44. def getPrivateUrl: Try[DataverseResponse[PrivateUrlData]]

  45. def getStorageDriver: Try[DataverseResponse[DataMessage]]

  46. def getStorageSize(includeCached: Boolean = false): Try[DataverseResponse[DataMessage]]

  47. 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
  48. 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
  49. def getUnwrappedFromTarget(endPoint: String, queryParams: Map[String, String] = Map.empty): Try[HttpResponse[Array[Byte]]]
    Attributes
    protected
    Definition Classes
    TargetedHttpSupport
  50. 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
  51. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  52. val id: String
    Attributes
    protected
    Definition Classes
    DatasetApi → TargetedHttpSupport
  53. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  54. val isPersistentId: Boolean
    Attributes
    protected
    Definition Classes
    DatasetApi → TargetedHttpSupport
  55. def link(targetDataverse: String): Try[DataverseResponse[DataMessage]]

    targetDataverse

    alias of the dataverse in which the link to the dataset should appear

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#link-a-dataset

  56. def listFiles(version: Version = Version.LATEST): Try[DataverseResponse[List[FileMeta]]]

  57. 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

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#list-all-metadata-blocks-for-a-dataset

  58. def listRoleAssignments(): Try[DataverseResponse[List[RoleAssignmentReadOnly]]]

  59. lazy val logger: Logger
    Attributes
    protected
    Definition Classes
    LazyLogging
    Annotations
    @transient()
  60. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  61. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  62. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  63. 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
  64. 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
  65. 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
  66. 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
  67. 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
  68. 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 to true. 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

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#publish-a-dataset

  69. 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
  70. 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
  71. 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
  72. 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
  73. val readTimeout: Int
    Attributes
    protected
    Definition Classes
    DatasetApi → HttpSupport
  74. 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 to true. 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

  75. def resetStorageDriver(): Try[DataverseResponse[DataMessage]]

  76. def returnToAuthor(s: String): Try[DataverseResponse[DataMessage]]

    s

    JSON document containing the reason for returning the dataset

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#return-a-dataset-to-author

  77. def revertCitationDateField(): Try[DataverseResponse[Nothing]]

    Restores the default citation date field type.

  78. val sendApiTokenViaBasicAuth: Boolean
    Attributes
    protected
    Definition Classes
    DatasetApi → HttpSupport
  79. 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

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#set-citation-date-field-type-for-a-dataset

  80. def setEmbargo(embargo: Embargo): Try[DataverseResponse[Any]]

    No link yet, feature yet to be released in Dataverse

  81. def setEmbargo(embargo: String): Try[DataverseResponse[Any]]

    No link yet, feature yet to be released in Dataverse

  82. def setStorageDriver(driver: String): Try[DataverseResponse[DataMessage]]

  83. def submitForReview(): Try[DataverseResponse[DataMessage]]

  84. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  85. val targetBase: String
    Attributes
    protected
    Definition Classes
    DatasetApi → TargetedHttpSupport
  86. def toString(): String
    Definition Classes
    AnyRef → Any
  87. def trace[V](value: Text[V])(implicit enclosing: Name): Unit
    Definition Classes
    DebugEnhancedLogging
  88. val unblockKey: Option[String]
    Attributes
    protected
    Definition Classes
    DatasetApi → HttpSupport
  89. 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

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#update-metadata-for-a-dataset

  90. 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

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#update-metadata-for-a-dataset

  91. def updateMetadataFromJsonLd(s: String, replace: Boolean): Try[DataverseResponse[Any]]

    s

    the JSONLD document

    replace

    replace existing values if true only add values otherwise

    See also

    https://guides.dataverse.org/en/latest/developers/dataset-semantic-metadata-api.html

  92. def view(version: Version = Version.LATEST): Try[DataverseResponse[DatasetVersion]]

  93. def viewAllVersions(): Try[DataverseResponse[List[DatasetVersion]]]

  94. 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.

    See also

    https://guides.dataverse.org/en/latest/api/native-api.html#get-json-representation-of-a-dataset

  95. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  96. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  97. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from TargetedHttpSupport

Inherited from HttpSupport

Inherited from DebugEnhancedLogging

Inherited from LazyLogging

Inherited from AnyRef

Inherited from Any

Ungrouped