Graffiti Client API – Category List

Graffiti CMS includes a library in the Graffiti download called Client API, which can be found in the Utility directory.  The Client API can be used to send or retrieve data from a Graffiti installation.  This tip provides the code to download a list of categories from a Graffiti CMS site.  Note that the username/password and url will need to be modified.

GraffitiService gs = new GraffitiService(“admin”, “password”, “http://localhost/api”);

try
{

PagedList<Category> plc = gs.Categories.Get(new NameValueCollection());

foreach(Category c in plc)
Console.WriteLine(c.Name);

}

catch (GraffitiServiceException gse)
{
Console.Write(gse.Message);

}

Leave a Reply

Your email address will not be published. Required fields are marked *