HTTP/1.1 400 Bad Request

111 views
Skip to first unread message

Pravin G

unread,
Oct 25, 2018, 5:55:43 AM10/25/18
to ORCID API Users
Hi,

I am facing issue while updating record using put-code method  the xml code as i provided below.

Put-code_xml_file.xml
Put-code_output_file.txt

Simpson, Will

unread,
Oct 25, 2018, 9:48:03 AM10/25/18
to prav...@gmail.com, orcid-a...@googlegroups.com
Hi Pravin,

Have you tried doing the PUT using curl?

I get a different error when I do that.

wsimpson:Downloads willsimpson$ curl -X PUT -d'@Put-code_xml_file.xml' -i -H 'Content-Type: application/vnd.orcid+xml' -H 'Authorization: Bearer a6be69ea-d446-4e0c-b308-166b0199b738' https://api.sandbox.orcid.org/v2.0/0000-0002-5995-4058/education/32041

HTTP/1.1 100 Continue


HTTP/1.1 400 Bad Request

Server: nginx/1.10.0

Date: Thu, 25 Oct 2018 13:42:23 GMT

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

Transfer-Encoding: chunked

Connection: keep-alive

Access-Control-Allow-Origin: *

Cache-Control: no-cache, no-store, max-age=0, must-revalidate

Pragma: no-cache

Expires: 0

X-XSS-Protection: 1; mode=block

X-Frame-Options: DENY

X-Content-Type-Options: nosniff


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<error xmlns="http://www.orcid.org/ns/error">

    <response-code>400</response-code>

    <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: javax.xml.bind.UnmarshalException

 - with linked exception:

[org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 919; cvc-enumeration-valid: Value 'India' is not facet-valid with respect to enumeration '[AF, AX, AL, DZ, AS, AD, AO, AI, AQ, AG, AR, AM, AW, AU, AT, AZ, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, BO, BQ, BA, BW, BV, BR, IO, BN, BG, BF, BI, KH, CM, CA, CV, KY, CF, TD, CL, CN, CX, CC, CO, KM, CG, CD, CK, CR, CI, HR, CU, CW, CY, CZ, DK, DJ, DM, DO, EC, EG, SV, GQ, ER, EE, ET, FK, FO, FJ, FI, FR, GF, PF, TF, GA, GM, GE, DE, GH, GI, GR, GL, GD, GP, GU, GT, GG, GN, GW, GY, HT, HM, VA, HN, HK, HU, IS, IN, ID, IR, IQ, IE, IM, IL, IT, JM, JP, JE, JO, KZ, KE, KI, KP, KR, KW, KG, LA, LV, LB, LS, LR, LY, LI, LT, LU, MO, MK, MG, MW, MY, MV, ML, MT, MH, MQ, MR, MU, YT, MX, FM, MD, MC, MN, ME, MS, MA, MZ, MM, NA, NR, NP, NL, NC, NZ, NI, NE, NG, NU, NF, MP, NO, OM, PK, PW, PS, PA, PG, PY, PE, PH, PN, PL, PT, PR, QA, RE, RO, RU, RW, BL, SH, KN, LC, MF, PM, VC, WS, SM, ST, SA, SN, RS, SC, SL, SG, SX, SK, SI, SB, SO, ZA, GS, SS, ES, LK, SD, SR, SJ, SZ, SE, CH, SY, TJ, TZ, TH, TL, TG, TK, TO, TT, TN, TR, TM, TC, TV, UG, UA, AE, GB, US, UM, UY, UZ, VU, VE, VN, VG, VI, WF, EH, YE, ZM, ZW, TW, XK]'. It must be a value from the enumeration.] (cvc-enumeration-valid: Value 'India' is not facet-valid with respect to enumeration '[AF, AX, AL, DZ, AS, AD, AO, AI, AQ, AG, AR, AM, AW, AU, AT, AZ, BS, BH, BD, BB, BY, BE, BZ, BJ, BM, BT, BO, BQ, BA, BW, BV, BR, IO, BN, BG, BF, BI, KH, CM, CA, CV, KY, CF, TD, CL, CN, CX, CC, CO, KM, CG, CD, CK, CR, CI, HR, CU, CW, CY, CZ, DK, DJ, DM, DO, EC, EG, SV, GQ, ER, EE, ET, FK, FO, FJ, FI, FR, GF, PF, TF, GA, GM, GE, DE, GH, GI, GR, GL, GD, GP, GU, GT, GG, GN, GW, GY, HT, HM, VA, HN, HK, HU, IS, IN, ID, IR, IQ, IE, IM, IL, IT, JM, JP, JE, JO, KZ, KE, KI, KP, KR, KW, KG, LA, LV, LB, LS, LR, LY, LI, LT, LU, MO, MK, MG, MW, MY, MV, ML, MT, MH, MQ, MR, MU, YT, MX, FM, MD, MC, MN, ME, MS, MA, MZ, MM, NA, NR, NP, NL, NC, NZ, NI, NE, NG, NU, NF, MP, NO, OM, PK, PW, PS, PA, PG, PY, PE, PH, PN, PL, PT, PR, QA, RE, RO, RU, RW, BL, SH, KN, LC, MF, PM, VC, WS, SM, ST, SA, SN, RS, SC, SL, SG, SX, SK, SI, SB, SO, ZA, GS, SS, ES, LK, SD, SR, SJ, SZ, SE, CH, SY, TJ, TZ, TH, TL, TG, TK, TO, TT, TN, TR, TM, TC, TV, UG, UA, AE, GB, US, UM, UY, UZ, VU, VE, VN, VG, VI, WF, EH, YE, ZM, ZW, TW, XK]'. It must be a value from the enumeration.)</developer-message>

    <user-message>ORCID could not process the data, because they were invalid.</user-message>

    <error-code>9001</error-code>

    <more-info>https://members.orcid.org/api/resources/troubleshooting</more-info>

</error>


Changing 'India' to 'IN' should fix that.

The error you were getting was very strange.

[org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 20; XML version "2.0" is not supported, only XML 1.0 is supported.] (XML version "2.0" is not supported, only XML 1.0 is supported.)

I am not able to reproduce that error with your XML.

Can you experiment with curl, and see if you can get your code to do the same?

Best regards,

Will

On Thu, Oct 25, 2018 at 10:55 AM Pravin G <prav...@gmail.com> wrote:
Hi,

I am facing issue while updating record using put-code method  the xml code as i provided below.

--
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.
Visit this group at https://groups.google.com/group/orcid-api-users.
For more options, visit https://groups.google.com/d/optout.


--

Montenegro, Angel

unread,
Oct 25, 2018, 9:48:26 AM10/25/18
to prav...@gmail.com, orcid-a...@googlegroups.com
Hi Pravin,

The organization country code is wrong, we use the ISO 3166 two characters country code, so, instead of India, you should use IN: 

<common:country>India</common:country>

Thanks

On Thu, Oct 25, 2018 at 3:55 AM Pravin G <prav...@gmail.com> wrote:
Hi,

I am facing issue while updating record using put-code method  the xml code as i provided below.

--
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.
Visit this group at https://groups.google.com/group/orcid-api-users.
For more options, visit https://groups.google.com/d/optout.


--
Reply all
Reply to author
Forward
0 new messages