Quantcast
Channel: Optimizely Search & Navigation
Viewing all articles
Browse latest Browse all 6894

How to index data from a api in Find

$
0
0

Hi guys, 

In a project, I have built a news archive page type and a news page type in CMS for showing the press releases. 

The data that shows on a news page get from a api (with querystring parmeter in url Http://locallsot:17000/news/?item_id=123456&type_of_media=news)

http://www.mynewsdesk.com/services/pressroom/view/unique key/?[item_id=id]&[type_of_media=pressrelease]

My question is how can I index the data in Find? The data gets directly from api and send to frontend in a reach compoent. 

string xmlStr;
using (var wc = new WebClient())
{
wc.Encoding = Encoding.UTF8;
xmlStr = wc.DownloadString(Api);
}
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlStr);
var item = new News();

foreach (XmlNode node in doc.SelectNodes("item"))
{
item.Header = node.SelectSingleNode("header").InnerText;
item.PublishDate = node.SelectSingleNode("published_at").InnerText;
item.Body = node.SelectSingleNode("body").InnerText;
if (node.SelectSingleNode("image") != null)
item.Image = node.SelectSingleNode("image").InnerText;

News = item;
}


public News news { get; set; }



Thanks!


                       

Viewing all articles
Browse latest Browse all 6894

Trending Articles