Importjson > malformed

How do I have to write my json-data so I can import it into a dataset?
Through postman (POST {{url}}/api//dataset/importjson/1) I try to post json-data into a dataset, but as a response I get:

  "error": {
    "message": "Malformed JSON body, rows and uniqueKeys are required",
    "code": 422,
    "data": []

I read the description at swagger.ui (!/dataset/dataSetImportJson) but still I couldn’t figure it out.

This is the data I’m trying with:

I’m testing on Xibo 1.8.0-rc2

This couldn’t easily be modelled with Swagger (as far as I could see anyway).

The API expects a JSON formatted object, but needs some extra information as per the comment. In particular we need to know the uniqueKeys.

  uniqueKeys: [col1], 
  rows: [{
    col1: value1

I’d imagine your JSON could be changed to:

         "ownerName":"Hassum Harrod",
         "aptDate":"2016-06-20 15:30",
         "aptNotes":"This Chihuahua has not eaten for three days and is lethargic"
         "ownerName":"Constance Smith",
         "aptDate":"2016-06-24 08:30",
         "aptNotes":"This German Shepherd is having some back pain"
         "ownerName":"Barot Bellingham",
         "aptDate":"2016-06-22 15:50",
         "aptNotes":"This Goldfish has some weird spots in the belly"
         "ownerName":"Hillary Goldwyn",
         "aptDate":"2016-06-21 9:15",
         "aptNotes":"Cat has excessive hairballs"

This assumes you have DataSet columns for:

  • petName
  • ownerName
  • aptDate
  • aptNotes
1 Like

I want to use the API to import a JSON object into a dataset by using /dataset/importjson/{dataSetId}.

My dataset (ID=2) exists of one column “Col1”. I want to add “value1” to the dataset with the PHP-code below.

$provider = new \Xibo\OAuth2\Client\Provider\Xibo([
‘clientId’ => ‘’, // The client ID assigned to you by the provider
’clientSecret’ => ‘’, // The client password assigned to you by the provider
’redirectUri’ => ‘’,
‘baseUrl’ => ‘’

$xiboClient = new \Xibo\OAuth2\Client\Provider\XiboEntityProvider($provider);

$result = $xiboClient->post(’/dataset/importjson/2’,’{uniqueKeys: [col1], rows: [{col1: value1}]}’);

But the last rule gives the following error:
PHP Fatal error: Uncaught exception ‘Xibo\OAuth2\Client\Exception\XiboApiException’ with message '{
“error”: {
“message”: “Missing JSON Body”,
“code”: 422,
“data”: []

It’s not clear for me how I need to send the JSON-body with the post-method of the xiboClient. Can you help me? Thans a lot.