400 Bad Request Help

82 views
Skip to first unread message

Andrew Devenish-Meares

unread,
Jan 7, 2018, 7:11:15 PM1/7/18
to orcid-a...@googlegroups.com

Hi All,

 

I am currently trying to get works to post to ORCID Records in the Sandbox in v2.1.

 

An example of our generated XML is attached, and this validates against the XML Schema’s locally.

 

Posting to:

                https://api.sandbox.orcid.org/v2.1/0000-0001-5035-2168/work

Headers:

                Content-Type: application/vnd.orcid+xml; qs=5;charset=UTF-8

                Authorization: Bearer <access_token>

 

This gives a 400 Response with the message ‘Bad Request’.  The API Errors Codes document (https://members.orcid.org/api/resources/error-codes) says “Check XML headers”.

 

I’m unclear what this means, given I’ve got XML that validates.

 

Any help would be appreciated.

 

Thanks


ADM

 

 

UNE Logo with Good Universities Guide 2018 five stars for Overall Experience and Teaching Quality   Voice Project IT Service Quality Benchmarks - Winner 2017 for Student IT Service Quality


Andrew Devenish-Meares
ORCID iD orcid.org/0000-0003-1436-895X

 

Solutions Analyst/Programmer
Administrative Applications, Information Services

Information Technology Directorate


University of New England
Armidale NSW 2351 Australia

Phone  61 2 6773 4098

Skype For Business adev...@une.edu.au
Email  adev...@une.edu.au

 

www.une.edu.au

University of New England CRICOS Provider Number 00003G

 

sample-work.xml

Peters, Robert

unread,
Jan 7, 2018, 10:00:57 PM1/7/18
to Andrew Devenish-Meares, orcid-a...@googlegroups.com
We'll check closer tomorrow. However until then try switching `http://www.orcid.org/ns/work work-2.0.xsd` to `http://www.orcid.org/ns/work work-2.1.xsd`.
-Rob

Robert Peters
Technology Director at ORCID.org

Cellphone: +1.805.440.9056
Skype: rcpeters
Timezone: PST
Key for OpenPGP email communication:  
https://keys.mailvelope.com/pks/lookup?op=get&search=0x1519F37D99E18378

--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-users+unsubscribe@googlegroups.com.
To post to this group, send email to orcid-api-users@googlegroups.com.
Visit this group at https://groups.google.com/group/orcid-api-users.
For more options, visit https://groups.google.com/d/optout.

Andrew Devenish-Meares

unread,
Jan 7, 2018, 10:12:46 PM1/7/18
to Peters, Robert, orcid-a...@googlegroups.com

Hi Rob,

 

I’d need to change all the relivent schema files and reload, so it validates, which is rather a lot of work.

 

Changing the endpoint version to v2.0 gives the same result, however.

 

ADM

--

To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-use...@googlegroups.com.
To post to this group, send email to orcid-a...@googlegroups.com.

Simpson, Will

unread,
Jan 8, 2018, 8:03:00 AM1/8/18
to Andrew Devenish-Meares, Peters, Robert, orcid-a...@googlegroups.com
Hi Andrew,

I tried posting the XML to my sandbox record, and the full headers and body of the repsonse were as follows.


HTTP/1.1 400 Bad Request
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Transfer-encoding: chunked
Expires: 0
Server: nginx/1.10.0
Connection: keep-alive
Pragma: no-cache
Cache-control: no-cache, no-store, max-age=0, must-revalidate
Date: Mon, 08 Jan 2018 13:00:02 GMT
Access-control-allow-origin: *
Content-type: application/vnd.orcid+xml; qs=5;charset=UTF-8
X-frame-options: DENY
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <response-code>400</response-code>
    <developer-message>400 Bad Request: Invalid activity, an external identifier is required. Full validation error: Invalid external-id ScopusEID relationship</developer-message>
    <user-message>Invalid activity: an external identifier is required.</user-message>
    <error-code>9023</error-code>
</error>

I changed

<common:external-id>
  <common:external-id-type>ScopusEID</common:external-id-type>
  <common:external-id-value>2-s2.0-84951568046</common:external-id-value>
</common:external-id>

to

<common:external-id>
  <common:external-id-type>eid</common:external-id-type>
  <common:external-id-value>2-s2.0-84951568046</common:external-id-value>
  <common:external-id-relationship>self</common:external-id-relationship>
</common:external-id>

and was then able to post the work to my record, with a 201 response.

See here for more info about supported work identifier types.


Best regards,

Will

--

To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-users+unsubscribe@googlegroups.com.
To post to this group, send email to orcid-api-users@googlegroups.com.

 

--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-users+unsubscribe@googlegroups.com.
To post to this group, send email to orcid-api-users@googlegroups.com.

Simpson, Will

unread,
Jan 8, 2018, 9:32:38 AM1/8/18
to Peters, Robert, Andrew Devenish-Meares, orcid-a...@googlegroups.com
Oh, I copied and pasted the XML from GMail, which filtered out the bad characters. Looks like Andrew will hit the errors I got once he has fixed the bad characters in the file.

Best,

Will

On Mon, Jan 8, 2018 at 1:42 PM, Peters, Robert <r.pe...@orcid.org> wrote:
More details
---------- Forwarded message ----------
From: "Peters, Robert" <r.pe...@orcid.org>
Date: Jan 7, 2018 7:33 PM
Subject: Re: [ORCID API] 400 Bad Request Help
To: "Andrew Devenish-Meares" <adev...@une.edu.au>
Cc:

Hi Andrew,
Looks like you have a UTF-8 encoding issue. That would match our servers complaining about the xml header  which is `<?xml version="1.0" encoding="UTF-8"?>`. Image of my text editor complaining when I open the file:

Inline image 1

After saving as UTF-8 and doing a diff:

58c58

<           <work:credit-name>Andrew F?Zull</work:credit-name>

---

>           <work:credit-name>Andrew FZull</work:credit-name>

66c66

<           <work:credit-name>R A?Lawes</work:credit-name>

---

>           <work:credit-name>R ALawes</work:credit-name>

73c73

<         <work:credit-name>Oscar J?Cacho</work:credit-name>

---

>         <work:credit-name>Oscar JCacho</work:credit-name>


Look for bad hidden characters at those locations. See https://stackoverflow.com/questions/115210/how-to-check-whether-a-file-is-valid-utf-8 about checking validity.


Cheers,
Rob

Robert Peters
Technology Director at ORCID.org

Cellphone: +1.805.440.9056
Skype: rcpeters
Timezone: PST
Key for OpenPGP email communication:  
https://keys.mailvelope.com/pks/lookup?op=get&search=0x1519F37D99E18378

--

To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-users+unsubscribe@googlegroups.com.
To post to this group, send email to orcid-api-users@googlegroups.com.

Andrew Devenish-Meares

unread,
Jan 8, 2018, 4:21:46 PM1/8/18
to Simpson, Will, Peters, Robert, orcid-a...@googlegroups.com

Hi Will and Rob,

 

Bad characters are sorted, it seems.  I wasn’t expecting a message body with more detail… didn’t see it in the documentation.  That helps.

 

All good, will check out the Scopus EID bit… Needs some more work in the XSL there.

 

Thanks

 

ADM

More details

--

To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-use...@googlegroups.com.
To post to this group, send email to orcid-a...@googlegroups.com.

--

You received this message because you are subscribed to the Google Groups "ORCID API Users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-use...@googlegroups.com.
To post to this group, send email to orcid-a...@googlegroups.com.

Andrew Devenish-Meares

unread,
Jan 8, 2018, 7:35:19 PM1/8/18
to Andrew Devenish-Meares, Simpson, Will, Peters, Robert, orcid-a...@googlegroups.com

Thanks for the help, this now appears to be working.  Turns out this is test data in the development system, and doesn’t exist in production. Should it make it that far, at least it will be handled.

Simpson, Will

unread,
Jan 9, 2018, 6:40:02 AM1/9/18
to Andrew Devenish-Meares, Peters, Robert, orcid-a...@googlegroups.com
Thanks for letting us know, Andrew. 

Cheers,

Will

More details

--

To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-users+unsubscribe@googlegroups.com.
To post to this group, send email to orcid-api-users@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-users+unsubscribe@googlegroups.com.
To post to this group, send email to orcid-api-users@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "ORCID API Users" group.

To unsubscribe from this group and stop receiving emails from it, send an email to orcid-api-users+unsubscribe@googlegroups.com.
To post to this group, send email to orcid-api-users@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages