Error 415 in Extraction endpoint

75 views
Skip to first unread message

Luca Di Natale

unread,
Jun 13, 2016, 12:11:33 PM6/13/16
to Europass Interoperability
Hi all,

i'm trying to retrieve the xml embed metadata from an Europass CV file.
If i upload the, let's say, "cv.pdf" on "Update your CV" from the Europass main site it correctly upload it and allows me to edit all the prepopulated fields; but when I try to pass the same pdf file ("cv.pdf") using RESTful XML Extraction endpoint i always get error 415: Unsupported Media Type. Is there something i'm missing?

I've also tried to send an XML to pdf-cv endpoint (expecting a pdf byte stream or something equivalent) but still get the same error as above

Any help would be really appreciate
Thanks
Luca

Europass Interoperability

unread,
Jun 14, 2016, 5:20:39 AM6/14/16
to Europass Interoperability
Dear Luca,

Thank you for your interest in Europass. The problems you're facing might have to do with the Content-Type header of your requests. 

In the case of the /extraction endpoint, the Content-Type header needs to be application/pdf. Here's a curl example:

curl https://europass.cedefop.europa.eu/rest/v1/document/extraction -H "Content-Type:application/pdf" --data-binary @cv.pdf -o cv.xml

While in the case of the /to/pdf-cv endpoint it needs to be application/xml:

curl https://europass.cedefop.europa.eu/rest/v1/document/to/pdf-cv -H "Content-Type:application/xml" -d @cv.xml -o cv.pdf

Please let us know whether this fixes your problem.

Best regards,

Dimitris Zavaliadis
Team Europass

Luca Di Natale

unread,
Jun 14, 2016, 8:35:59 AM6/14/16
to Europass Interoperability
Hi Dimitris,
Thanks for your reply. I didn't mentioned that i've followed, step by step, online documentation. So i actually used application/pdf for Extraction and application/xml for The other one. I've tested your service using a REST Client, maybe i should test with another One (if u say that your tests went all OK).

Any further suggestion?
Thanks a lot in advance
Luca

Europass Interoperability

unread,
Jun 14, 2016, 10:31:43 AM6/14/16
to Europass Interoperability
Hi Luca,

I'm not sure which exactly is the "REST Client" you're referring to. Check for example in the attached screenshot how to make a successful request with Firefox's Poster add-on.

I might be able to help you more if you provide me with further details on the client you're using and how exactly you're using it (e.g. how do you upload the pdf file).


Best regards,
Dimitris
poster.png

Luca Di Natale

unread,
Jun 15, 2016, 4:33:21 AM6/15/16
to Europass Interoperability
Hi Dimitris,
i'm currently using POSTMAN as a Google Chrome extension. As you can see in the attached screenshot, I still get Unsupported Media Type. My first attempts where made by a REST Client I wrote in Java. I've also tried either POSTing the cv.pdf from a form than passing it as a File, neither of them worked. 

Where I'm mistaking?

Thanks
Luca

Luca Di Natale

unread,
Jun 15, 2016, 4:39:20 AM6/15/16
to Europass Interoperability


Europass Interoperability

unread,
Jun 15, 2016, 4:50:57 AM6/15/16
to Europass Interoperability
Hi Luca,

How do you upload the pdf in postman? You'll need to select the "binary" option and upload it from your file system. Check the attached screenshot for a successful request to /extraction using postman.

Let me know if this works for you. I'll also try to send you a Java example later on.

Regards,
Dimitris

On Wednesday, 15 June 2016 11:39:20 UTC+3, Luca Di Natale wrote:


postman.png

Europass Interoperability

unread,
Jun 15, 2016, 8:36:29 AM6/15/16
to Europass Interoperability
Hi again Luca,

As promised, please also find attached a Java-based example.

It's a standard Maven project which demonstrates how to consume the Europass REST API's /extraction and /to/pdf-cv endpoints (using the Unirest library as an HTTP client). You can run it via the command line as shown below:

$ mvn clean test

(It's assumed that Maven is already installed on your system)

Hope this helps.

Regards,
Dimitris
europass-rest-example-java.zip

Luca Di Natale

unread,
Jun 15, 2016, 9:38:48 AM6/15/16
to Europass Interoperability
Hi Dimitris,

thanks a lot for your help, really appreciate your effort :)

POSTMAN worked. The problem was in multiform-data instead binary.
I've build your little project with maven but i'm facing connection timeout exception even if i completely remove timeout (Unirest.setTimeouts(0,0);).

I'll atteach my code (that's basically your code) and the exception thrown. 
Could you take a look in your spare time? 
Thanks man, really appreciate
Luca


Europass Interoperability

unread,
Jun 15, 2016, 10:21:51 AM6/15/16
to Europass Interoperability
Perhaps you're behind a proxy? (postman could still work if you've configured your browser accordingly)

Can you telnet europass.cedefop.europa.eu on 443?

Everything looks fine here and I can run the Java tests without any problems.

Dimitris
Reply all
Reply to author
Forward
0 new messages