0% found this document useful (0 votes)
15 views3 pages

API IMPLEMENTATION

Uploaded by

lawrencechikopa1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

API IMPLEMENTATION

Uploaded by

lawrencechikopa1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

IMPLEMENTATION

APPLICATION PROGRAMMING INTERFACE (API)


An Application Programming Interface (API), as defined by the Oxford
Dictionary, is a set of functions and procedures that enable the development
of applications capable of accessing the features or data of an operating
system, application, or other service. Specifically, in the context of this
discussion, we are dealing with a Representational State Transfer (REST) API.
This API is built on the foundational principles of web architecture and has
been developed using the Flask framework, a Python library known for its
simplicity, security, and flexibility (Kumawat, 2023).

The primary purpose of this API is to facilitate communication between


clients and a machine learning model that has been pre-trained for predictive
tasks. In essence, it serves as a bridge, allowing clients to submit requests,
in the form of HTTP and JSON, to the model through a designated API
endpoint. Subsequently, the API processes the incoming data and retrieves
predictions from the machine learning model. These predictions, which could
signify whether a message is 'smishing' (a combination of SMS and phishing)
or 'legit' (legitimate), are then relayed back to the client. Furthermore, the
API ensures that these predictions are also stored in a database, which acts
as a repository for client messages and their associated predictions.

In terms of the underlying protocol, the API accommodates various client


preferences. It is flexible enough to work with the specific protocols chosen
by clients. Consequently, it can communicate effectively using the relevant
HTTP and JSON standards.

This API not only simplifies the process of utilizing the machine learning
model but also enhances data management by recording and storing the
results in a structured and accessible database. Moreover, the adaptability of
this API to different communication protocols makes it a versatile tool for a
wide range of applications and clients.

API ENDPOINTS
API Endpoints serve as the gateways to an application's functionality and
data. These endpoints are essential for interacting with our API, and they are
configured to handle POST requests, making it seamless for various
interfaces and systems to utilize our SMS message classification service. In
our API, we have defined the following endpoints:
1. '/predict' (POST): This endpoint facilitates the connection of web page
forms to our API function using the HTTP POST method. It is linked to
our model, enabling the detection of whether an SMS message is
"smishing" or "legitimate". The figure below shows the code of page
post method and the endpoint of the API:

Figure 1 Shows the URL for the API Endpoint in the web page form

Figure 2 Shows the endpoint of the API

2. '/detect' (POST): This endpoint allows external websites to connect to


our API, granting them access to its capabilities, specifically connecting
to the model for the purpose of detecting whether an SMS message is
"smishing" or "legitimate." This functionality is accessible through JSON
requests.
The figure below shows the endpoint on the API.

Figure 3 Shows API endpoint for connection from other sites


References
Kumawat, A. (2023, 04 03). What is an API (Application Programming Interface)? Retrieved from
geeksforgeeks.org: https://www.geeksforgeeks.org/what-is-an-api/

OXFORD. (n.d.). Oxford languages. Retrieved from languages.com: https://www.bing.com/ck/a?!


&&p=17c1a008b336cc1bJmltdHM9MTY5NzI0MTYwMCZpZ3VpZD0wZjVkZmNkYi01OTc2LTYzMzA
tMGFkNi1lZWJjNTg4YjYyOWQmaW5zaWQ9NTQ1Nw&ptn=3&hsh=3&fclid=0f5dfcdb-5976-6330-
0ad6-
eebc588b629d&psq=what+is+an+api&u=a1aHR0cHM6Ly9sYW5ndWFnZXMub3VwLmNvbS8

You might also like