C# REST Login Issue with Jira Server

I’m encountering authentication issues with Jira Server via C# REST API. Below is an example snippet:

var httpReq = WebRequest.Create(apiEndpoint) as HttpWebRequest;
httpReq.Accept = "application/json";
httpReq.Method = "POST";
var httpRes = httpReq.GetResponse() as HttpWebResponse;

A 404 error is returned. What might be the cause?

try verifiying your endpoint; sometimes its a misconfigured url or missing auth header. also check if posting is allowed instead of directly retrieving json