API¶
Initialize the client.
Parameters: url – URL of the B2SHARE instance. One of the following hostnames can be used to identify the B2SHARE instance:
- b2share.eudat.eu - the hostname of the production site.
- trng-b2share.eudat.eu - the base url of the training
site. Use this URL for testing.
Parameters: token_file – B2SHARE API ACCESS token
Read the token from a given file named ‘token’
List all the communities, without any filtering.
Parameters: token – Optional: B2SHARE API ACCESS token Returns: list of communities in json
List all records of a specific community.
Parameters: community_id – community id. Can be retrieved from the list of communities
list_communities
:return: the list of records (in JSON format) or an exception message
Retrieves the JSON schema of records approved by a specific community.
Parameters: community_id – community id. Can be found from the list of - communities
list_communities
Returns: community schema in json format.
List all the records, without any filtering TODO add pagination :param size: Optional :return: list of records in json format.
List the metadata of the record specified by RECORD_ID.
Parameters: - record_id – record id.
- draft – True/False to specify which type of record to search for. Default: True.
Returns: list of records.
Get the pid from the record metadata (published).
Parameters: record_id – record id Returns: epicPID, prefix/suffix
Create a new record with minimal metadata, in the draft state.
Parameters: - community_id –
- title – title for the record
Returns: record_id, filebucket_id
Create a draft record and specifying the original pid. Adapted from DataCite schema:
- relatedIdentifierType: Handle
- relationType: isDerivedFrom
Parameters: - title – title for the record.
- original_pid – PID (prefix/suffix) of the input Dataset.
Returns: record_id and filebucket_id
Parameters: record_id – record id Returns: request status (HTTP response)
Parameters: record_id – record id Returns: request status
List all the records, without any filtering
TODO add exception when record not found
Parameters: record_id – identifier for a specific record, which can be in draft or published state Returns: filebucket id.
Search for all drafts (unpublished records) that are accessible by the requestor. Usually this means own records only.
Returns: the list of matching drafts (in JSON format).
Parameters: - file_path – path to the file to be uploaded.
- filebucket_id – identifier for a set of files. Each record has its own file set, usually found in the links -> files section
Returns: request status
List the files uploaded into a record object.
Parameters: filebucket_id – identifier for a set of files. Each record has its own file set, usually found in the links -> files section Returns: information about all the files in the record object