Search code examples
restorientdb

RESTAPI OrientDB Create document Base64 encoding issue


I try to post a simple document to my OrientDB server (v2.2.22) by using the REST API

But I recieve a 500, here's the body that I send,

{
  "@class": "Student",
  "firstName": "Gilles",
  "lastName": "Bodart",
  "dateOfBirth": "1992-04-14",
  "sexe": "M"
}

And here's the response

{
    "errors": [
        {
            "code": 500,
            "reason": 500,
            "content": "com.orientechnologies.orient.core.exception.OSerializationException: Error on unmarshalling JSON content for record: \"@class\":\"Student\",\"firstName\":\"Benjamin\",\"lastName\":\"Leroy\",\"dateOfBirth\":\"1992-10-31\",\"sexe\":\"M\"\r\n\tDB name=\"Memoire\"\r\n--> com.orientechnologies.common.io.OIOException: Bad Base64 input character decimal 45 in array position 4"
        }
    ]
}

It seems to be an issue wirh the date, but I send it like a String.

In my schema, it's typed Custom I don't relly know why but I can't modify it to String

Can anyone help me ?


Solution

  • To try you case I used Postman and it works for me, I only added a couple of lines:

    {"transaction": false , "operations":[
        { "type": "c",
          "record" : {
                "@class" : "Student",
                "firstName": "Gilles",
                "lastName": "Bodart",
                "dateOfBirth": "1992-04-14",
                "sexe": "M"
            }
        }
    ]}
    

    this is the request:

    enter image description here

    and this is what I get:

    enter image description here

    as you can see the dateOfBirth type is STRING

    Hope it helps

    Regards