InfoCommons / cic

Apache License 2.0
0 stars 0 forks source link

Adding websites to PI via API #263

Closed ryscher closed 1 year ago

ryscher commented 1 year ago

When I run a PATCH request to update keywords and websites, the JSON in the request looks like this:

{'data': 
  {'type': 'Person', 
    'attributes': {
       'private_emails': '', 
       'orcid': 'https://orcid.org/0000-0003-0896-2127', 
       'websites': ['https://fdhint.com/about/', 'https://covidinfocommons.net/', 'https://nebigdatahub.org/about/'], 
       'keywords': ['Data science', ' analytics', ' health', ' COVID', ' coronavirus', ' cybersecurity', ' connected healthcare', ' Medical Internet of Things', ' IoT', ' TIPPSS', ' Trust', ' Identity', ' Privacy', ' Protection', ' Safety', ' Security']
}}}

The keywords are updated correctly, but the websites are not. The resultant record looks like this:

{
    "data": {
        "type": "Person",
        "id": "20641",
        "attributes": {
            "affiliations": [],
            "first_name": "Florence D",
            "last_name": "Hudson",
            "orcid": "https://orcid.org/0000-0003-0896-2127",
            "emails": "[fh2417@columbia.edu](mailto:fh2417@columbia.edu)",
            "private_emails": "",
            "keywords": [
                "Data science",
                "analytics",
                "health",
                "COVID",
                "coronavirus",
                "cybersecurity",
                "connected healthcare",
                "Medical Internet of Things",
                "IoT",
                "TIPPSS",
                "Trust",
                "Identity",
                "Privacy",
                "Protection",
                "Safety",
                "Security"
            ],
            "approved": true,
            "desired_collaboration": "",
            "comments": "",
            "websites": "[]"
        }
    }
}
ryscher commented 1 year ago

When I add websites through Django admin, they end up not as an array, but a string that contains an array, like this:

"websites": "['https://fdhint.com/about/', 'https://covidinfocommons.net/', 'https://nebigdatahub.org/about/']"

Is there a reason they should be handled differently than the keywords?

sg3847 commented 1 year ago

PR https://github.com/columbia-it/covid-infocommons/pull/104