freme-project / e-Publishing

Apache License 2.0
0 stars 0 forks source link

HTTP Status 500 when using the service from Postman #17

Closed andish closed 9 years ago

andish commented 9 years ago

Request following:

curl -X POST -H "Cache-Control: no-cache" -H "Postman-Token: 28ec266d-5c18-2ce2-2e72-2d55c54de18e" -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" -F "htmlZip=alice.zip" -F "metadata={     "titles": [         "Alice in Utopia",         "Alice in Europe"     ],     "creators": [         {             "firstName": "Joske",             "lastName": "Vermeulen",             "roles": [                 "author"             ]         },         {             "firstName": "Nick",             "lastName": "Borth",             "roles": [                 "author"             ]         }     ],     "contributors": [         {             "firstName": "Frans",             "lastName": "Vervaacke",             "roles": [                 "illustrator"             ]         },         {             "firstName": "John",             "lastName": "Riplosh",             "roles": [                 "illustrator"             ]         }     ],     "subjects": [         "alice",         "rabbit"     ],     "coverImage": "cover.jpeg",     "language": "en",     "descriptions": "This is the story about Alice in wonderland, involving a rabbit etc.",     "identifier": {         "value": "urn:1235-568-2235"     },     "tableOfContents": [         {             "title": "Chapter 1",             "resource": "01.xhtml"         },         {             "title": "Chapter 2",             "resource": "02.xhtml"         }     ] }" 'http://api-dev.freme-project.eu/current/e-publishing/html'

alice.zip file was downloaded from the documentation page. http://api-dev.freme-project.eu/doc/#!/e-Publishing/htmlToEPub without success to use the service

{
  "timestamp": 1440508179776,
  "status": 500,
  "error": "Internal Server Error",
  "exception": "com.google.gson.JsonSyntaxException",
  "message": "java.lang.IllegalStateException: Expected BEGIN_ARRAY but was STRING at line 1 column 883 path $.descriptions",
  "path": "/e-publishing/html"
}
pheyvaer commented 9 years ago

The documentation has an error. The example JSON string has descriptions as a String, but should be an array of Strings as explained in the documentation above.

So documentation needs to be updated.

jnehring commented 9 years ago

@josauder please update the e-Publishing documentation. Change the JSON metadata example. I tested it and it works. @andish can you please check if this solves your problem?

{
 "titles":[
    "Alice in Utopia",
    "Alice in Europe"
 ],
 "creators":[
    {
        "firstName": "Joske",
        "lastName": "Vermeulen",
        "roles":["author"]
    },
    {
        "firstName": "Nick",
        "lastName": "Borth",
        "roles":["author"]
    }
 ],
 "contributors":[
    {
        "firstName": "Frans",
        "lastName": "Vervaacke",
        "roles":["illustrator"]
    },
    {
        "firstName": "John",
        "lastName": "Riplosh",
        "roles":["illustrator"]
    }
 ],
 "subjects":[
    "alice",
    "rabbit"
 ],
 "coverImage":"cover.jpeg",
 "language":"en",
 "descriptions":["This is the story about Alice in wonderland, involving a rabbit etc."],
 "identifier":{
    "value":"urn:1235-568-2235"
 },
 "tableOfContents":[
    {
       "title":"Chapter 1",
       "resource":"01.xhtml"
    },
    {
       "title":"Chapter 2",
       "resource":"02.xhtml"
    }
 ]
}
andish commented 9 years ago

Yes, now it is returning the result.