Tạo endpoint api khách hàng
Bổ sung cấu hình API
I. Cấu hình DB
Vào DB VTTECHDOC
Ở Table VTT_API_Endpoints tạo 1 dòng dữ liệu API Column Code không được trùng.
Truy cập
Dùng Code vừa tạo ở bước 2:
// Paste vào hàm Main
Console.WriteLine(EncryptString(, SemiSecret)); // Lấy mã vừa sinh là Code'
II. Vào source API_SMSNoti
Vào models Models/APIPerCode
Bổ sung Code vừa tạo biến APIPerCodeKey Theo cấu trúc
//
// Trong đó:
// Location là group Endpoint
// GetCommune là tên định danh của endpoint
// Code' là code đã được encrypt ở bước I.4
private static Dictionary<string, Dictionary<string, string>> APIPerCodeKey = new Dictionary<string, Dictionary<string, string>>
{
{ "Location", new Dictionary<string, string>
{
{ "", "Code'" },// KEY
}
},
};
III. Ở API_SMSNoti tạo API
Tạo 1 controller ( Nếu chưa có )
Tại Route add Middleware để kiểm tra client có được sử dụng API không.
// Example
[Route("GetSip")]
[ClientAttribute("Location", "GetCommune")]
Last updated