POST to /api/canvas/workpad with overwrite option

Hi,
Using curl I can post a new workpad to canvas like this:
curl -X POST -H "kbn-xsrf: reporting" -H "Content-Type: application/json" -d @myworkpad.json "/api/canvas/workpad"

In the json I am posting I am setting up a custom id for the workpad. If I want to repost(overwrite) to same id then I get a conflict message back and repost is not allowed.

Question: Is there an option to pass in an overwrite query parameter that would allow repost and hence overwrite of the data associated with the id?

I could use PUT to post to a specific id to overwrite it, but that works if the id already exists. IF it does not exist then PUT will not overwrite the data associated with the id.

Thanks

could you also post the json you are posting (or multiple of them describing all the scenarios).

Below is a sample json I have posted.
If I try to post to same id again I get the following message:
{"message":"[doc][canvas-workpad:wpad-json-to-upload]: version conflict, document already exists (current version [1]): [version_conflict_engine_exception] [doc][canvas-workpad:wpad-json-to-upload]: version conflict, document already exists (current version [1]), with { index_uuid="0AxCM1AlQjWDtTjX1LHTRw" & shard="0" & index=".kibana_1" }","statusCode":409,"error":"Conflict"}

Sample Json:

{
    "name": "wpad-json-to-upload",
    "id": "wpad-json-to-upload",
    "width": 1080,
    "height": 720,
    "css": ".canvasPage {\n\n}",
    "page": 0,
    "pages": [
        {
            "id": "page-6105ff33-1df0-4317-b90a-2f4d1b673da2",
            "style": {
                "background": "#FFF"
            },
            "transition": {},
            "elements": [
                {
                    "id": "element-757ce23a-f664-409f-b4ce-cd9ac9dc1c00",
                    "position": {
                        "left": 20,
                        "top": 20,
                        "width": 500,
                        "height": 300,
                        "angle": 0
                    },
                    "expression": "filters\n| demodata\n| markdown \"Hello World\"\n| render"
                }
            ],
            "groups": []
        }
    ],
    "colors": [
        "#37988d",
        "#c19628",
        "#b83c6f",
        "#3f9939",
        "#1785b0",
        "#ca5f35",
        "#45bdb0",
        "#f2bc33",
        "#e74b8b",
        "#4fbf48",
        "#1ea6dc",
        "#fd7643",
        "#72cec3",
        "#f5cc5d",
        "#ec77a8",
        "#7acf74",
        "#4cbce4",
        "#fd986f",
        "#a1ded7",
        "#f8dd91",
        "#f2a4c5",
        "#a6dfa2",
        "#86d2ed",
        "#fdba9f",
        "#000000",
        "#444444",
        "#777777",
        "#BBBBBB",
        "#FFFFFF",
        "rgba(255,255,255,0)"
    ],
    "isWriteable": true,
    "@timestamp": "2019-02-07T10:56:22.094Z",
    "@created": "2019-02-07T10:54:31.650Z",
    "assets": {}
}

you can't create multiple documents with same id ... the second time you want to modify it you should use PUT

OK Thanks.

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