Skip to main content
Question

Custom API handler

  • December 30, 2025
  • 0 replies
  • 10 views

I am trying to create a simple api handler as part of a customization

 

using System.Collections.Generic;
using System.IO;
using System.Web;
using Newtonsoft.Json;

namespace SampleAPI
{


public class SampleApiHandler : IHttpHandler
{
public bool IsReusable => false;

public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "application/json";
context.Response.Write("{\"status\":\"ok\"}");
}
}
}

I published the customization and changed web.config

 

 <add name="SampleAPI"
path="api/sampleApi"
verb="POST"
type="SampleAPI.SampleAPIHandler"
resourceType="Unspecified"
preCondition="integratedMode" />

 

But I am not able to call it, it times out, am I doing anything wrong?