Asmx file can also be used for rest api creation (Which is not the recommended approach).
This can be achieved by the below code snippet.
[ScriptService]
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Randezvous : WebService
{
    [WebMethod]
    [ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
    public void getUnitPersonels(string user, string pass, decimal unitNo)
    {
        JavaScriptSerializer serializer = new JavaScriptSerializer();
        Context.Response.Clear();
        Context.Response.ContentType = "application/json";
        #region ..:: Kullanıcı şİfre Kontrol ::..
        if (!(unit == "xxx" && pass == "yyy"))
        {
            string msg = "User or pass is wrong.";
            Context.Response.Write(serializer.Serialize(msg));
            return;
        }
        #endregion
        List<Personels> personels = _units.getUnitPersonels(unitNo);
        string jsonString = serializer.Serialize(personels);
        Context.Response.Write(jsonString);
    }
}
You can test this code in c# with the code that is shown below:
using (var client = new HttpClient())
{
    client.DefaultRequestHeaders.Accept.Clear();
    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
    var builder = new UriBuilder("http://localhost:18511/Randezvous.asmx/getUnitPersonels");
    var query = HttpUtility.ParseQueryString(builder.Query);
    query["unitNo"] = "0";
    builder.Query = query.ToString();
    string url = builder.ToString();
    var result = Task.FromResult(client.GetAsync(url).Result).Result.Content;
    var resultJson = result.ReadAsStringAsync().Result;
}