Skip to content

Instantly share code, notes, and snippets.

@sshibani
Last active October 9, 2015 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sshibani/7c4f410edc4107db97ca to your computer and use it in GitHub Desktop.
Save sshibani/7c4f410edc4107db97ca to your computer and use it in GitHub Desktop.
DD4T RestService WebApi
using DD4T.ContentModel.Contracts.Logging;
using System;
using System.Collections.Generic;
using System.Web.Http;
namespace MyDD4T.RestService
{
[RoutePrefix("mycustom")]
public class MyCustomController : ApiController
{
private readonly ILogger _logger;
public MyCustomController(ILogger logger)
{
if (logger == null) throw new ArgumentNullException("logger");
_logger = logger;
}
[HttpGet]
[Route("NewsItems/{publicationId:int}/{taxonomyId:int}/{key}")]
public IHttpActionResult NewsItems(int publicationId, int taxonomyId, string key)
{
var content = new List<string>();
//Write logic to query the Tridion Content Delivery server
return Ok<List<string>>(content);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment