Shorten_url api does not return urlId

Hello,

I have followed the shorten_url api documentation to create a new shortened URL, however in response I am only getting a confirmation and not the urlID as per the documentation.

I am doing this via Kibana's dev-tools:

Request:

POST /api/shorten_url
{
  "url": "/app/dashboards#/view/1d73b1f0-fe7d-11ea-9dd2-93882e373ff0?_a=(description...."
}

Response:

#! Deprecation: [types removal] Specifying types in document index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, or /{index}/_create/{id}).
{
  "_index" : "api",
  "_type" : "shorten_url",
  "_id" : "3JqrZXUByUcARzs8PpFk",
  "_version" : 1,
  "result" : "created",
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "_seq_no" : 7,
  "_primary_term" : 1
}

Also no new URL object gets created under saved objects. Could anyone help?

Using ELK 7.9.2

Update:
If I do this using curl from command line it works and returns the urlId.... But still curious why is isn't the same response from dev-tools.

I am assuming this is because dev-tools sends the command towards elasticsearch while with curl we send the command towards kibana (curl localhost:5601/api/shared_url) which basically tells me thath this is a kibana API and not an ES API. Is that correct?

Hey, you nailed it! Dev tools can only be used for Elasticsearch APIs, to test Kibana APIs you need to use an external tool like curl.

/api/shorten_url is a Kibana API (check the first breadcrumb of the navigation in the docs, if it says 'Kibana Guide', it's a Kibana API).

The confusing part here is POST /api/shorten_url is also a valid Elasticsearch query - it adds a document of type "shorten_url" to the "api" index.

1 Like

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