Skip to content

Article URL to URI mappings

Anže Sršen edited this page Dec 12, 2017 · 1 revision

Event Registry keeps for each stored article an internal URI (unique resource identifier). These URIs can be used in queries and are provided as one of the article's details that are returned as a result of the query.

Article's URL, on the other hand, is not something that can be used directly to access additional information about the article. There is however a utility class that is able to provide a mapping from the article's URL to the URI that can then be used to access the article.

Here is an example of usage:

import { EventRegistry, ArticleMapper, QueryArticle, RequestArticleInfo}
const er = new EventRegistry({apiKey: "YOUR_API_KEY"});

// create the URL->URI mapper
const artMapper = new ArticleMapper(er);
// get the URI for article given the URL
const artUri = artMapper.getArticleUri("http://www.mynet.com/haber/guncel/share-2058597-1")

// make the query using the article URI
const q = new QueryArticle(artUri);
// get all info about the specified article
q.addRequestedResult(new RequestArticleInfo());
res = er.execQuery(q);