Hi,
Following the steps described in Redirecting… , I want to create some objects each time my app starts.
I can successfully create an object with the following Request.json:
[
{
"jsonrpc": "2.0",
"method": "ADD_DOCUMENT",
"id": "AddArticle1",
"params": {
"document": {
"Article": {
"ArticleData": {
"ArticleName": "Banane",
"Barcode": "11111",
"Price": "0,99"
}
}
},
"documentModelName": "ArticleDocument",
"locale": "en"
}
}
]
However my article has an aditional property “ArticlePhoto” which I would like to add to its creation on-startup. When I create an article via the app, a POST request such as below is send:
[
{
"jsonrpc": "2.0",
"method": "ADD_DOCUMENT",
"id": "AddArticle1",
"params": {
"document": {
"Article": {
"ArticleData": {
"ArticlePhoto": {
"content": null,
"attachment_id": "b525092d-570e-4517-9b4d-888293613ef2",
"internal_filename": "banana.jpg",
"original_filename": "banana.jpg",
"size": 21417,
"mime_type": "image/jpeg"
},
"ArticleName": "Banane",
"Barcode": "11111",
"Price": "0,99"
}
}
},
"documentModelName": "ArticleDocument",
"locale": "en"
}
}
]
Unfortunately, using above as request.json makes the server fail on re-start
com.mgmtp.a12.dataservices.exception.UnexpectedException: Json-rpc error for path '{}': {}
which leads me to my question:
How can I add a picture to a request.json ?