Bad request in creating visualization with restful api

I'm sending a POST request to /api/saved_objects/visualization/ to create a visualization with json data, the response is saying:
{
"statusCode": 400,
"error": "Bad Request",
"message": "child "id" fails because ["id" is not allowed to be empty]",
"validation": {
"source": "params",
"keys": [
"id"
]
}
}

But I'm not sure where the "id" is missing. How can identify where exactly my json data is wrong?

Can you share the JSON you are posting?

This is the json I exported from an existing visualization, and then changed the title and trying to post again back into Kibana:

{
"attributes":{
"title":"Build Types - Test",
"visState":'{"title":"Build Types - Test","type":"pie","params":{"type":"pie","addTooltip":true,"addLegend":true,"legendPosition":"right","isDonut":true,"labels":{"show":true,"values":true,"last_level":false,"truncate":100}},"aggs":[{"id":"1","enabled":true,"type":"count","schema":"metric","params":{}},{"id":"2","enabled":true,"type":"terms","schema":"segment","params":{"field":"buildType.keyword","size":100,"order":"asc","orderBy":"_key","otherBucket":false,"otherBucketLabel":"Other","missingBucket":false,"missingBucketLabel":"Missing","customLabel":""}}]}',
"uiStateJSON":"{}",
"description":"",
"version":1,
"kibanaSavedObjectMeta":{
"searchSourceJSON":'{"index":"84c00a20-5447-11e9-89ec-6f68f2a4d07f","query":{"query":"","language":"lucene"},"filter":[{"meta":{"index":"a6915570-b107-11e8-964d-77ccef18eb1d","negate":true,"type":"phrase","key":"buildType.keyword","value":"","params":{"query":"","type":"phrase"},"disabled":false,"alias":null},"query":{"match":{"buildType.keyword":{"query":"","type":"phrase"}}},"$state":{"store":"appState"}},{"meta":{"index":"a6915570-b107-11e8-964d-77ccef18eb1d","negate":false,"disabled":false,"alias":null,"type":"phrase","key":"project.keyword","value":"ABC","params":{"query":"ABC","type":"phrase"}},"query":{"match":{"project.keyword":{"query":"ABC","type":"phrase"}}},"$state":{"store":"appState"}}]}'
}
}
}

Anyone can help on this please?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.