kibana/docs/api/url_shortening/shorten_url.asciidoc
2019-09-18 10:54:28 -05:00

55 lines
1.5 KiB
Text

[[shorten-url-api]]
=== Shorten URL API
++++
<titleabbrev>Shorten URL</titleabbrev>
++++
experimental[] Convert a {kib} URL into a token.
[[url-shortening-api-request]]
==== Request
`POST /api/shorten_url`
[[url-shortening-api-request-body]]
==== Request body
`url`::
(Required, string) The {kib} URL that you want to shorten, Relative to `/app/kibana`.
[[url-shortening-api-response-body]]
==== Response body
urlId:: A top level property that contains the shortened URL token for the provided request body.
[[url-shortening-api-codes]]
==== Response code
`200`::
Indicates a successful call.
[[url-shortening-api-example]]
==== Example
[source,js]
--------------------------------------------------
POST api/shorten_url
{
"url": "/app/kibana#/dashboard?_g=()&_a=(description:'',filters:!(),fullScreenMode:!f,options:(hidePanelTitles:!f,useMargins:!t),panels:!((embeddableConfig:(),gridData:(h:15,i:'1',w:24,x:0,y:0),id:'8f4d0c00-4c86-11e8-b3d7-01146121b73d',panelIndex:'1',type:visualization,version:'7.0.0-alpha1')),query:(language:lucene,query:''),timeRestore:!f,title:'New%20Dashboard',viewMode:edit)"
}
--------------------------------------------------
// KIBANA
The API returns the following result:
[source,js]
--------------------------------------------------
{
"urlId": "f73b295ff92718b26bc94edac766d8e3"
}
--------------------------------------------------
For easy sharing, construct the shortened {kib} URL:
`http://localhost:5601/goto/f73b295ff92718b26bc94edac766d8e3`