Closed Jason-Gush closed 4 years ago
Seems to be the problem.
Only passes when both URL and relationship are present, despite both being optional.
@rpaw053 any recall what you were intending here? Seems like lines 4304-4308 should just be deleted.
@Jason-Gush I don't actually remember why i did that https://github.com/Royal-Society-of-New-Zealand/NZ-ORCID-Hub/blob/a2e5af4273aa3924e187504e7c093ee999f3208a/orcid_hub/models.py#L4304
Most likely my copy paste error in commit https://github.com/Royal-Society-of-New-Zealand/NZ-ORCID-Hub/commit/15236ea635e26af45e15d862f3a774dc7b7138f1
Since in our reference model both url and relationship are optional, we can safely delete the lines(4304-4308) as you suggested https://github.com/Royal-Society-of-New-Zealand/NZ-ORCID-Hub/blob/a2e5af4273aa3924e187504e7c093ee999f3208a/orcid_hub/models.py#L4092
load from json doesn't have that condition https://github.com/Royal-Society-of-New-Zealand/NZ-ORCID-Hub/blob/a2e5af4273aa3924e187504e7c093ee999f3208a/orcid_hub/models.py#L4369
So just if condition
in load from csv method needs to be deleted https://github.com/Royal-Society-of-New-Zealand/NZ-ORCID-Hub/blob/a2e5af4273aa3924e187504e7c093ee999f3208a/orcid_hub/models.py#L4304
Relationship
field is needed and should be self
for personal identifier. otherwise ORCID will give 400 error.url
i still get error from ORCID if i dont set url
into request payload for external identifiers, it says Reference field must not be empty
url
and relationship
the record is updated.
I was about to make changes but this still doesnt work from ORCID side
You can test this here: https://api.sandbox.orcid.org/v2.0/#!/Development_Member_API_v3.0/createExternalIdentifierv3
So if you set everything in request, the record is created 201
, i have removed my Bearer
code in the below samples
curl -X POST --header 'Content-Type: application/vnd.orcid+json; qs=4' --header 'Accept: application/json' --header 'Authorization: Bearer <your code>' -d '{
"external-id-type": "eid",
"external-id-value": "5553asas5213800sa",
"external-id-url": {
"value": "https://www.scopus.com/authid/detail.uri?authorId=5aa55352ss31800"
},
"external-id-relationship": "self",
"display-index": 0
}' 'https://api.sandbox.orcid.org/v3.0/0000-0001-8228-7153/external-identifiers'
If you remove relationship, we get 400
exception, which i guess is expected.
curl -X POST --header 'Content-Type: application/vnd.orcid+json; qs=4' --header 'Accept: application/json' --header 'Authorization: Bearer <your code>' -d '{
"external-id-type": "eid",
"external-id-value": "5553asas5213800sa",
"external-id-url": {
"value": "https://www.scopus.com/authid/detail.uri?authorId=5aa55352ss31800"
}
"display-index": 0
}' 'https://api.sandbox.orcid.org/v3.0/0000-0001-8228-7153/external-identifiers'
{
"response-code": 400,
"developer-message": "400 Bad Request: There is an issue with your data or the API endpoint. 405 Method Not Allowed: Endpoint and method mismatch. 415 Unsupported Media Type: data must be in XML or JSON format. Full validation error: Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n at [Source: (org.apache.catalina.connector.CoyoteInputStream); line: 7, column: 4]",
"user-message": "ORCID could not process the data, because they were invalid.",
"error-code": 9001,
"more-info": "https://members.orcid.org/api/resources/troubleshooting"
}
If you remove url
we still getting 400
exception:
curl -X POST --header 'Content-Type: application/vnd.orcid+json; qs=4' --header 'Accept: application/json' --header 'Authorization: Bearer <your code>' -d '{
"external-id-type": "eid",
"external-id-value": "5553asas5213800sa",
"external-id-relationship": "self",
"display-index": 0
}' 'https://api.sandbox.orcid.org/v3.0/0000-0001-8228-7153/external-identifiers'
{
"response-code": 400,
"developer-message": "400 Bad Request: Invalid incoming message. Full validation error: Reference field must not be empty",
"user-message": "Invalid incoming message.",
"error-code": 9020,
"more-info": "https://members.orcid.org/api/resources/troubleshooting"
}
Turns out url is the canonical required field (tho not specified in either xsd or swagger :() https://github.com/ORCID/ORCID-Source/blob/master/orcid-api-web/tutorial/personal_identifiers.md As a consequence, shouldn't be merged unless there's a surprise and ORCID changes the model.
Whether by batch upload or via form, the Hub requires a external-id-url in Other IDs despite the model being: