Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

Feature request for custom content delivery api endpoints?

$
0
0

Where do one put in a feature request for custom content delivery api endpoints for CMS 12+?

namespace EPiServer.ContentApi.ApiConventions.Internal
{
  [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
  internal class ContentApiControllerAttribute : Attribute
  {
  }
}

This attribute - can you make it public so you can create custom content delivery api endpoints easy?

As far as I understand this activates filters and convetions so the json is formatted correctly.

Then you use the ObjectResultWithHeaders action result to with [Produces] attribute to format the end result.

[ApiController]
[Route("api/[controller]/[action]")]
[ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]
[Produces("application/json")]
public abstract class BaseJsonApiController : ControllerBase
{
	protected IActionResult ToObjectResult<T>(T? value, int statusCode = 200, Dictionary<string, string>? headers = null)
		where T : class =>
		new ObjectResultWithHeaders<T>(value!, statusCode, headers ?? new Dictionary<string, string>());
}

---------------------------------------

And a final question:

What is the point of [JsonFormatter] attriubte and JsonFormattedResult if EPi it self doesn't use it for this type of conversions?


Viewing all articles
Browse latest Browse all 9076