Skip to content

Commit

Permalink
remove deprectated /shorten API (elastic#21861)
Browse files Browse the repository at this point in the history
* remove deprectated /shorten API

* breaking change log
  • Loading branch information
nreese authored and cjcenizal committed Aug 21, 2018
1 parent 3f7bdcf commit 14ba04e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 33 deletions.
8 changes: 7 additions & 1 deletion docs/migration/migrate_7_0.asciidoc
Expand Up @@ -49,4 +49,10 @@ to Kibana's advanced setting.

*Impact:* This setting is no longer necessary. If you enable {monitoring} across the Elastic Stack, a monitoring agent runs
on each Elasticsearch node, Logstash node, Kibana instance, and Beat to collect and index metrics. Each node and instance is
considered unique based on its persistent UUID, which is written to the path.data directory when the node or instance starts.
considered unique based on its persistent UUID, which is written to the path.data directory when the node or instance starts.

[float]
=== Deprecated API `/shorten` has been removed
*Details:* The `/shorten` API has been deprecated since 6.5, when it was replaced by the `/api/shorten_url` API.

*Impact:* The '/shorten' API has been removed. Use the '/api/shorten_url' API instead.
20 changes: 0 additions & 20 deletions src/server/url_shortening/routes/create_routes.js
Expand Up @@ -17,8 +17,6 @@
* under the License.
*/

import { handleShortUrlError } from './lib/short_url_error';
import { shortUrlAssertValid } from './lib/short_url_assert_valid';
import { shortUrlLookupProvider } from './lib/short_url_lookup';
import { createGotoRoute } from './goto';
import { createShortenUrlRoute } from './shorten_url';
Expand All @@ -29,22 +27,4 @@ export function createRoutes(server, config) {

server.route(createGotoRoute({ server, config, shortUrlLookup }));
server.route(createShortenUrlRoute({ shortUrlLookup }));

// TODO remove deprecated '/shorten' API in master (7.0)
server.route({
method: 'POST',
path: '/shorten',
handler: async function (request, reply) {
server.log(
['warning', 'deprecation'],
`'/shorten' API has been deprecated and will be removed in 7.0, use the '/api/shorten_url' API instead`);
try {
shortUrlAssertValid(request.payload.url);
const urlId = await shortUrlLookup.generateUrlId(request.payload.url, request);
reply(urlId);
} catch (err) {
reply(handleShortUrlError(err));
}
}
});
}
12 changes: 0 additions & 12 deletions test/api_integration/apis/shorten/index.js
Expand Up @@ -27,18 +27,6 @@ export default function ({ getService }) {
before(() => esArchiver.load('saved_objects/basic'));
after(() => esArchiver.unload('saved_objects/basic'));

// TODO remove deprecated '/shorten' API in master (7.0)
it('generates shortened urls with deprecated URL', async () => {
const resp = await supertest
.post('/shorten')
.set('content-type', 'application/json')
.send({ url: '/app/kibana#/visualize/create' })
.expect(200);

expect(typeof resp.text).to.be('string');
expect(resp.text.length > 0).to.be(true);
});

it('generates shortened urls', async () => {
const resp = await supertest
.post('/api/shorten_url')
Expand Down

0 comments on commit 14ba04e

Please sign in to comment.