Web API

API is a software implementation interface that allows other applications to interact with it. It enables us to implement HTTP protocol-based services more easily than ever. Many service receivers, such as web browsers, mobile devices, and desktop applications, can take advantage of the capabilities of this platform (Web Api). In the last layer of the AUA framework, we can use different technologies such as the MVC - Rest WebApi - Grpc - Graphql - JWT (Json web Token) technology can be implemented and used for WebApi access levels in the AUA framework. Swagger is used for ease of use and WebApi testing. All the requirements for login and access levels using Token for the AUA framework are written in WebApi version and are ready for your business development. Note that the AUA framework can also be used for Windows form application, WPF, etc., because the last layer changes. The AUA framework is beyond the scope of this document. This document is just aimed at familiarizing you with how to work with the AUA framework. Using this document and tutorial videos, the programmer, regardless of his/her level, can work with this framework within just a week. The AUA framework has tutorial videos for all stages and can be easily worked with. You can download the tutorial video on how to work with the AUA framework from the Hilton website at here or youtube

Web Api Result

In the AUA, the output structure of all APIs is the same and this result including three fields of IsSuccess, Errors and Result. This is the class of the ResultModel. In case of any errors for any requests, IsSuccess will return false and if there are no errors it will return true. The TResult can be any kind of data type.


            
public class ResultModel<TResult>
{

    public ResultModel()
    {
        Errors = new List<ErrorVm>();
    }

    public bool IsSuccess => !Errors.Any();

    public IEnumerable<ErrorVm> Errors { get; set; }

    public TResult Result { get; set; }

}


In the code below, you can see the class of ErrorVm. ErrorMessage shows the message of the error. ErrorIssuer shows the reason for this error. ELogType shows the type of the errors.
While the exception happens. IsSuccess is false, it means an error has happened and the Errors shows the line of code in which the error has happened, and the rest of the details of that error will be placed in the Result, here you can read the full description of that error.


            
public class ErrorVm
{

    public string ErrorMessage { get; set; }

    public string ErrorIssuer { get; set; }

    public ELogType ErrorType { get; set; }

}


            
public enum ELogType
{

    Information = 1,
    Warning = 2,
    Error = 3,
    Danger = 4,
    Exception = 5

}