How to use 'POST url' to share visualisation in my website?

I want to share a visualisation in my website. By using Xpack->Share->Generate PDF/PNG, it is nice to find 'Share PDF/PNG' function is available. However, how to use 'copy POST url' ?
I can get the following JSON from the POST url, but how can I use the JSON file to download/generate pdf file in my RoR website?

From 'Automating Report Generation'(, It says ' The response from this request with be JSON, and will contain a path property with a URL to use to download the generated report.' Does it mean to use 'relativeurl' in the following JSON file in my webiste? but the 'relativeurl' looks like same as what I get in 'iframe'.thanks.

attached JSON file from POST url:
{'path': '/api/reporting/jobs/download/jvds4zs10qv79d0062b9cel6', 'job': {'id': 'jvds4zs10qv79d0062b9cel6', 'index': '.reporting-2019.05.05', 'type': 'esqueue', 'jobtype': 'PNG', 'created_by': False, 'payload': {'type': 'visualization', 'title': '[eCommerce] Sales by Gender', 'relativeUrl': "/app/kibana#/visualize/edit/ed8436b0-b88b-11e8-a6d9-e546fe2bba5f?_g=(refreshInterval:(pause:!t,value:0),time:(from:now-60d,mode:quick,to:now))&_a=(filters:!(),linked:!f,query:(language:lucene,query:''),uiState:(),vis:(aggs:!((enabled:!t,id:'1',params:(),schema:metric,type:count),(enabled:!t,id:'2',params:(field:customer_gender,json:'',missingBucket:!f,missingBucketLabel:Missing,order:desc,orderBy:'1',otherBucket:!f,otherBucketLabel:Other,size:5),schema:segment,type:terms)),params:(addLegend:!t,addTooltip:!t,isDonut:!t,labels:(last_level:!t,show:!t,truncate:100,values:!t),legendPosition:right,type:pie),title:'%5BeCommerce%5D+Sales+by+Gender',type:pie))", 'headers': 'uxY4w6gCRwwLZyFkDX0ujVlANYq7ae5UuNJAN0GpbTOX7vw5aPuCuyr37nNcpz3vtA8kNVaL6Gacs24mPjZfwl4mB9xRKGA62CkCLo8Xz1amuIEthI+BtKPGo5QAk2k2+7zLvLgX3KouVvYdd61U5rLAvfjv4TydcpH9qJ4qrL5OELkzAJGrNdujtDLWaoy2Qj9YXbLnh7gSdI+lrNml6usZIh4pMzz8qdRo597iO/4AeSJRa2JfAruyGB3zYInZRtMuCbA4f3ANvT2WeAn6lpiwThB993uEjwu4LBVUZuo2XL0TcB29YNNa9oMCUEhWjdJ1ase5VQdz8V2IOgecQ1W52V5JuVTvl9SkVvFWSBhXJg==', 'browserTimezone': 'Europe/Zurich', 'layout': {'dimensions': {'height': 589.234375, 'width': 866}}, 'basePath': '', 'forceNow': '2019-05-07T12:38:12.768Z'}, 'timeout': 120000, 'max_attempts': 3, 'priority': 10, 'browser_type': 'chromium'}}

To embedded a visualization in another web site, use embed code option under the share menu and click Copy iframe code button. Paste the copied iframe code into your web site.

The PDF/PNG report POST URL creates a report generation job. It does not return a PDF/PNG. The report generation job sites in a queue until a worker in the Kibana server takes the job from queue, starts a headless version of chromium, opens Kibana and the visualization, waits for the visualization to stabilize, and then finally creates the PDF or PNG. This can take a while so instead of making the original POST request wait for all of this, a queing system is in place where the POST request just starts a job but does not get the finished product.

Thanks for your reply! I have two questions remained:

  1. Do you mean it is not possible to automatically download PDF/PNG file by using POST url? Is it possible to use any other way in Kibana?
  2. I can get the JSON file by send the POST url. But I don't know what is the next step with the JSON file. How can I start the headless version of chromium and open Kibana visualisation?

You can use the job id created by job generation POST to check the status of the reporting job and download the job when finished. Please note, that this API is not intended for public consumption so there is no documentation and the API can have breaking changes between minor kibana release.

To view the API in action, generate a report and go to the Kibana management->reporting. Open up your browser's network tab and view the XHR requests between the page and Kibana server.

Thanks again! I find the generated report in Management->Reporting and I can see the XHR requests in developer tool. But I have to click download icon in kibana to download it. Is there any way to get this generated report download in my website public folder automatically? which means make kibana invisible to users.

I wrote some codes to download 'http://localhost:5601/api/reporting/jobs/download/jvhq4luc06559d0062d29e9d', then saved as '.png'/'.html' in my local folder. But I cannot open it with chrome or sublime. Could you tell what type of this download file is and how can I open it?

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