Quantcast
Channel: Kentico CMS for ASP.NET - DevNet - Forums - Version 7.x - API
Viewing all articles
Browse latest Browse all 660

Using API outside kentico

$
0
0
varinder-kudosweb
Hi

Im trying to build a .net mvc web api (which will work similar to kentico REST)
Followed docs (http://devnet.kentico.com/docs/devguide/index.html?using_api_and_cms_controls_outside_cms_project.htm) everything connects fine.

Id like to generate xml/json data containing all the documents (for the requested documenttype) with custom fields only.

For example,
- created a custom documenttype and called it "cms.foo"
- added two fields to cms.foo "name" and "description"
- created 10 cms.foo in the site tree.

Now-
- requesting "http://localhost/api/documenttype/cms.foo"

- In code - this is where im stuck -
 TreeProvider tp = new TreeProvider();
DataSet ds = tp.SelectNodes("CorporateSite", "/%", "en-us", true, "cms.foo", "", "", -1, true);

Im struggling how to filter that dataset down to its bare bones and generate a json out of it that looks something like this:
[
{
"cmsFooId": 1,
"name": "test",
"description": "test description"
},
{
"cmsFooId": 2,
"name": "test 2",
"description": "test description 2"
}
...
]

- Varinder

Viewing all articles
Browse latest Browse all 660

Latest Images

Trending Articles



Latest Images