# Integrating Multi-Access Edge Computing (MEC) into Open 5G Core
## 4 A New Service Proposed
### Implementation  
The implementation of the proposed API used the Python language associated with the Flask framework [35]. The micro-framework is widely used for developing web applications due to its simplicity, efficiency, and robustness. The Flask associates a function with an endpoint through which information is exchanged.  
The implemented functions are connected to an endpoint that responds to HTTP requests. The primary function only accepts requests via the _POST_ method. As a result, requests that do not use this method are disregarded. Once the request has been received, the API calls the _postData_ method. This procedure will check whether the minimum content is required to transmit the data. This check will look in the message content for the destination IP address and the HTTP method that should be used. The content of the message will perform a simple validation so that, if there is content, it will be used as a parameter in the _makeRequest_ function. If any of this information is absent, an error message with code 404 is sent, with the message \"Service IP and Method Requested\". All messages are checked for the necessary basic data, so, if several messages are missing data, several error codes will be returned. No specific treatment is necessary as it does not interfere with the communication process.  
For the information to be passed on to its recipient, the API will invoke the _makeRequest_ method. The first check will be on the HTTP method to be used. Using _POST_ or _PUT_ indicates an exchange of messages, so the data must be sent to the method. In the case of the others, no information is required other than the mandatory information listed above. After executing the request, the response message goes the other way around, i.e., it arrives at _makeRequest_, is returned to _postData_, and finally arrives at the client, its final destination.  
It is important to recognize that, for this work, other methods from the MTS API have not been incorporated. This is because these methods are not essential for the proposed objective. The methods and their respective endpoints implemented in this API are protected, so, for any application/service to be able to use them, it must have a JWT token.  
We have implemented the minimum necessary for the Service Registry to meet the requirements. A few functions have been implemented. The first is the _handleRegistryData_ function, which receives information from the applications and services that wish to register. Once the minimum content for registration has been validated, the _handlePost_ function is invoked, which stores the information in the database. Finally, a token is generated for this application/service using the JWT library. The device application is required to provide the access token with each request, in order to assert its permission to access the resource using the specific method invoked [36].  
The \(handleSpecificData\) function has also been incorporated into the Service Registry. This function is designed to make changing data in the database and retrieving information easier. The PUT and DELETE methods allow the client to modify records. With the GET method, the client can request data stored in the database. In this scenario, the UE will request information via the GET method. Collecting information will follow the same procedure that already provides the user with a token. This token is required to use the integrated service. The \(handlePut\), \(handleDelete\), and \(handleGet\) functions are identical to the abovementioned functions.