Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDI import not work, error: "Subject is required" #9065

Closed
cokeBeer opened this issue Oct 17, 2022 · 2 comments
Closed

DDI import not work, error: "Subject is required" #9065

cokeBeer opened this issue Oct 17, 2022 · 2 comments

Comments

@cokeBeer
Copy link

cokeBeer commented Oct 17, 2022

What steps does it take to reproduce the issue?
post ddi to import dataverse like

POST /api/batch/import?key={your_key}
Host: demo.dataverse.org
Cookie: {your_cookie}
Content-Type: application/xml
Content-Length: 4127

<?xml version='1.0' encoding='UTF-8'?><codeBook xmlns="ddi:codebook:2_5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="ddi:codebook:2_5 https://ddialliance.org/Specification/DDI-Codebook/2.5/XMLSchema/codebook.xsd" version="2.5"><docDscr><citation><titlStmt><titl>OTC Stock Historical Data</titl><IDNo agency="DOI">doi:10.70122/FK2/YE2UKM</IDNo></titlStmt><distStmt><distrbtr source="archive">Demo Dataverse</distrbtr><distDate>2022-10-14</distDate></distStmt><verStmt source="archive"><version date="2022-10-14" type="RELEASED">1</version></verStmt><biblCit>Do, Tuan, 2022, "OTC Stock Historical Data", https://doi.org/10.70122/FK2/YE2UKM, Demo Dataverse, V1</biblCit></citation></docDscr><stdyDscr><citation><titlStmt><titl>OTC Stock Historical Data</titl><IDNo agency="DOI">doi:10.70122/FK2/YE2UKM</IDNo></titlStmt><rspStmt><AuthEnty affiliation="University of South Carolina">Do, Tuan</AuthEnty></rspStmt><prodStmt/><distStmt><distrbtr source="archive">Demo Dataverse</distrbtr><contact affiliation="University of South Carolina" email="[email protected]">Do, Tuan</contact><depositr>Do, Tuan</depositr><depDate>2022-10-14</depDate></distStmt><holdings URI="https://doi.org/10.70122/FK2/YE2UKM"/></citation><stdyInfo><subject><keyword xml:lang="en">Business and Management</keyword><keyword>Business and Management</keyword></subject><abstract>On Tuesday, a new Securities and Exchange </abstract><sumDscr/></stdyInfo><method><dataColl><sources/></dataColl><anlyInfo/></method><dataAccs><setAvail/><useStmt/></dataAccs><othrStdyMat/></stdyDscr></codeBook>
  • When does this issue occur?
    send the request
  • Which page(s) does it occurs on?
    /api/batch/import's http response
  • What happens?
    an error happned
HTTP/1.1 400 Bad Request
Date: Mon, 17 Oct 2022 06:42:16 GMT
Server: Apache/2.4.37 (rocky) OpenSSL/1.1.1k mod_apreq2-20101207/2.8.1
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS
Access-Control-Allow-Headers: Accept, Content-Type, X-Dataverse-Key
Content-Type: application/json;charset=UTF-8
Content-Length: 73
Connection: close

{"status":"ERROR","message":"Error importing data: Subject is required."}

Which version of Dataverse are you using?
v. 5.11.1 build 1069-02e3e92(acutally I tried this function on demo website)

Any related open or closed issues to this bug report?
#8452
#8209
#8210

@cokeBeer cokeBeer changed the title DDI import not work DDI import not work, error: "Subject is required" Oct 17, 2022
@kuhlaid
Copy link
Contributor

kuhlaid commented Jan 4, 2023

Hi @cokeBeer,
You might want to look at the docs at https://guides.dataverse.org/en/latest/api/native-api.html#import-a-dataset-into-a-dataverse-installation-with-a-ddi-file. At the bottom of this section, it talks about the Subject field and steps needed to add subject.
Note that DDI XML does not have a field that corresponds to the “Subject” field in Dataverse. Therefore the “Import DDI” API endpoint populates the “Subject” field with N/A. To update the “Subject” field one will need to call the [Edit Dataset Metadata](https://guides.dataverse.org/en/latest/api/native-api.html#edit-dataset-metadata-api) API with a JSON file that contains an update to “Subject” such as [subject-update-metadata.json](https://guides.dataverse.org/en/latest/_downloads/46f6461ca67af3fa5e33433146c486b4/subject-update-metadata.json). Alternatively, the web interface can be used to add a subject.

@cokeBeer
Copy link
Author

@kuhlaid I've seen this before and tired as it mentioned, but it was still error. Can you give me a http request that can successfully import a DDI ?

@cokeBeer cokeBeer closed this as completed Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants