{"id":1242,"date":"2020-02-13T12:11:12","date_gmt":"2020-02-13T12:11:12","guid":{"rendered":"http:\/\/help.bwtech.com\/?page_id=1242"},"modified":"2020-02-13T12:13:45","modified_gmt":"2020-02-13T12:13:45","slug":"api-application-program-interface","status":"publish","type":"page","link":"https:\/\/help.bwtech.com\/?page_id=1242","title":{"rendered":"API (Application Program Interface)"},"content":{"rendered":"<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#API_Application_Program_Interface\"><span class=\"toc_number toc_depth_1\">1<\/span> API (Application Program Interface)<\/a><ul><li><a href=\"#WHAT_IS_AN_API\"><span class=\"toc_number toc_depth_2\">1.1<\/span> WHAT IS AN API?<\/a><\/li><li><a href=\"#WHAT_THE_API_SOLVE_AND_WHY_IS_IT_IMPORTANT\"><span class=\"toc_number toc_depth_2\">1.2<\/span> WHAT THE API SOLVE AND WHY IS IT IMPORTANT?<\/a><ul><li><a href=\"#TM_Forum_standard\"><span class=\"toc_number toc_depth_3\">1.2.1<\/span> TM Forum standard<\/a><\/li><\/ul><\/li><li><a href=\"#THE_REST_CONCEPT\"><span class=\"toc_number toc_depth_2\">1.3<\/span> THE REST CONCEPT<\/a><ul><li><a href=\"#Stateless_Communication_what_is_that\"><span class=\"toc_number toc_depth_3\">1.3.1<\/span> Stateless Communication: what is that?<\/a><\/li><\/ul><\/li><li><a href=\"#HOW_TO_USE_THE_APIs\"><span class=\"toc_number toc_depth_2\">1.4<\/span> HOW TO USE THE APIs<\/a><ul><li><a href=\"#Examples\"><span class=\"toc_number toc_depth_3\">1.4.1<\/span> Examples<\/a><\/li><\/ul><\/li><li><a href=\"#USING_THE_HTTP_CODES\"><span class=\"toc_number toc_depth_2\">1.5<\/span> USING THE HTTP CODES<\/a><\/li><li><a href=\"#BWTECHS_EXTERNALAPI\"><span class=\"toc_number toc_depth_2\">1.6<\/span> BWTECH\u2019S EXTERNAL\u00a0API<\/a><\/li><li><a href=\"#ROUTES\"><span class=\"toc_number toc_depth_2\">1.7<\/span> ROUTES<\/a><\/li><li><a href=\"#SWAGGER\"><span class=\"toc_number toc_depth_2\">1.8<\/span> SWAGGER<\/a><ul><li><a href=\"#How_to_use\"><span class=\"toc_number toc_depth_3\">1.8.1<\/span> How to use<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/div>\n<h1 style=\"text-align: center;\"><span id=\"API_Application_Program_Interface\"><b>API (Application Program Interface)<\/b><\/span><\/h1>\n<p>&nbsp;<\/p>\n<h2><span id=\"WHAT_IS_AN_API\"><b>WHAT IS AN API?<\/b><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">An Application Program Interface (API) is a set of routines and patterns established and documented about an application or system. Companies release this information so that other applications can use its functionality without needing to install the software.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In other words, an API is a set of information (programmable codes) that allows applications to communicate with each other more transparently. It is the interoperability &#8211; the possibility for applications and users to communicate.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For that to happen, the development of the APIs happen through two different elements:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">A specification that describes how the information &#8211; or data &#8211; can be exchanged between programs.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">An interface software that is written specifically for this purpose and published so the users and clients can access it.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Thus, the software that wants to access the features and capacities of an API is named \u201ccall\u201d. The software that creates and gives access to its APIs is called \u201cpublish\u201d.\u00a0<\/span><\/p>\n<h2><\/h2>\n<h2><span id=\"WHAT_THE_API_SOLVE_AND_WHY_IS_IT_IMPORTANT\"><b>WHAT THE API SOLVE AND WHY IS IT IMPORTANT?<\/b><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Basically, there are three main types of API:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Local<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Web-based<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Program based<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">But, what do they solve and why are they so important nowadays? It is easy to find software and applications that previously were developed to do specific things and that, today, already have APIs that allow them to have different functions. This reduces the developing time and decreases the possibilities of errors.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Besides that, the APIs also helped to enhance the quality of the software in the last decade. That happened mainly because of the growing number of cloud-based applications. This development encouraged companies to use more APIs and different systems began to communicate more, exchanging more information. All that made the user experience better not only for final-users but also for managers and decision-makers.<\/span><\/p>\n<h3><span id=\"TM_Forum_standard\"><span style=\"color: #808080;\"><b>TM Forum standard<\/b><\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">One important thing that all companies must know and follow is the TM Forum standard. It is an international guidebook of rules and best practices to organize APIs and other frameworks.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The TM Forum is a global industry association for service providers and suppliers in the telecommunications segment created in 1998 to solve system and operational management issues. Through an open and collaborative environment, the Forum has over 850 member companies.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The organizations that follow the TM Forum standards have some important benefits, such as:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Market recognition<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Reduced cost of applications integration<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Reduced risk in transformation projects<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">IT architecture simplification and agility<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">And much more!<\/span><\/li>\n<\/ul>\n<h2><\/h2>\n<h2><span id=\"THE_REST_CONCEPT\"><b>THE REST CONCEPT<\/b><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">REST is an acronym for Representational State Transfer and it consists of some principles, rules, and constraints that, when followed correctly, can allow the development of a project with well-defined interfaces.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Described by Roy Fielding &#8211; one of the main creators of the HTTP protocol &#8211; in his doctoral thesis, REST is a model to be used in the architecture projection of distributed software based on network communication.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">But, what does that mean? By following the rest principles, applications and software are built in a manner that makes it easier for them to communicate. And, therefore, build well-defined APIs.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So, we can say that REST is one kind of architecture and communication model that is mostly used in the development of web services. Thus, with the growth of cloud services, REST has been the main and most logical choice to create and build APIs that allow users to connect and interact with other applications and software.\u00a0<\/span><\/p>\n<h3><span id=\"Stateless_Communication_what_is_that\"><span style=\"color: #808080;\"><b>Stateless Communication: what is that?<\/b><\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">As seen before, the main system that uses the REST model is the web. We all know that today the internet has billions of clients connected to it, exchanging information and data all the time. But, what makes it possible for the web to manage this huge amount of users and information without crashing and with such a good performance and scalability?<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The answer to this question is stateless communication. This principle means that all requisitions made by a client through a REST service must contain all the necessary information for the server to understand and execute them correctly.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Therefore, any state data must be maintained by the client and not the server. The client must not depend on any information previously stored in the server to process a requisition. That is what makes it possible to enhance the REST service scalability and reduce the need for a whole amount of physical resources to store data.<\/span><\/p>\n<h2><\/h2>\n<h2><span id=\"HOW_TO_USE_THE_APIs\"><b>HOW TO USE THE APIs<\/b><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">It is known that all applications manage information and data. For example, a telecommunications application handles its users, technologies, pieces of equipment and so on. All those things are called resources in the REST model.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">So, a resource can be defined as the type of information that this application manages and, following the REST model, each one must have a unique identification. This ID is used so that the application can differentiate which of the resources must be manipulated in a request.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To do that, the resource identification follows the Uniform Resource Identifier (URI) concept. This notion is one of the standards used on the web and they are the interface for using your application services. They act as a contract for your users to access your system.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">But how does that work?<\/span><\/p>\n<p><span style=\"font-weight: 400;\">All the resources can be manipulated in many ways: you can create, update, delete and make many other operations with them. To do that, one of the most used models is the HTTP protocol.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">When a client sends an HTTP request for a service, besides the URI, it is important that they also assign which resources he wants to change and the type of manipulation he wishes to make. All this information comes with the HTTP protocol and each one of the manipulation methods, or verbs, has its own meaning:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><b>Get: <\/b><span style=\"font-weight: 400;\">obtain data from a resource.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Post: <\/b><span style=\"font-weight: 400;\">create a new resource.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Put: <\/b><span style=\"font-weight: 400;\">replace data from a resource.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Patch: <\/b><span style=\"font-weight: 400;\">partially update a resource.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>Delete:<\/b><span style=\"font-weight: 400;\"> delete a resource.<\/span><\/li>\n<\/ul>\n<h3><\/h3>\n<h3><span id=\"Examples\"><span style=\"color: #808080;\"><b>Examples<\/b><\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Let\u2019s imagine a resource named <\/span><b>Client <\/b><span style=\"font-weight: 400;\">to see how the HTTP methods in a REST service can be used:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><b>Method<\/b><\/td>\n<td style=\"text-align: center;\"><b>URI<\/b><\/td>\n<td style=\"text-align: center;\"><b>Use<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">GET<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\/clients<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Recover all clients data<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">GET<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\/clients\/id<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Recover a specific client data<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">POST<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\/clients<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Create a new client<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">PUT<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\/clients\/id<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Update a specific client data<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">DELETE<\/span><\/td>\n<td><span style=\"font-weight: 400;\">\/clients\/id<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Delete a specific client<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><\/h2>\n<h2><span id=\"USING_THE_HTTP_CODES\"><b>USING THE HTTP CODES<\/b><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">In the HTTP protocol, all clients\u2019 requisitions must result in an answer with an HTTP code. This code is used to inform the client if his request was successful or not.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">There are several HTTP codes, each one with its specific semantic. So, they must be used wisely and in the right manner to let the user know exactly what happened to their request.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The HTTP codes are grouped in classes:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><b>2xx class:<\/b><span style=\"font-weight: 400;\"> indicates the request was successfully processed.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>3xx class:<\/b><span style=\"font-weight: 400;\"> indicates that an action must be taken to complete the request.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>4xx class:<\/b><span style=\"font-weight: 400;\"> indicates the client caused an error in the request.<\/span><\/li>\n<li style=\"font-weight: 400;\"><b>5xx class: <\/b><span style=\"font-weight: 400;\">indicates the request was not completed because of an error in the server.<\/span><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">Also, there are the main HTTP codes. It is important to know when and how to use them. Take a look:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><b>Code\u00a0<\/b><\/td>\n<td style=\"text-align: center;\"><b>Description<\/b><\/td>\n<td style=\"text-align: center;\"><b>When to use<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">200<\/span><\/td>\n<td><span style=\"font-weight: 400;\">OK<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GET, PUT and DELETE requests executed successfully.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">201<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Created<\/span><\/td>\n<td><span style=\"font-weight: 400;\">POST requests when a new resource is created successfully.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">206<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Partial Content<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GET requests that return only a part of a resource\u2019s content.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">302<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Found<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Requests made to old URIs that have been altered.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">400<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Bad Request<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Requests that have invalid information sent by the client.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">401<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Unauthorized<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Requests that need authentication, but the user data was not provided.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">403<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Forbidden<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Requests that the client does not have permission to access the resource.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">404<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Not Found<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Requests where the resource URI is invalid.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">405<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Method Not Allowed<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Requests that have the HTTP method indicated by the client not supported.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">406<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Not Acceptable<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Requests that have unsupported format solicited by the client.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">415<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Unsupported Media Type<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Requests that have unsupported format sent by the client.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">429<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Too Many Requests<\/span><\/td>\n<td><span style=\"font-weight: 400;\">When the service has a limit of requests for each client and this number has already been reached.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">500<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Internal Server Error<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Requests where there was a server error.<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">503<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Service Unavailable<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Request made to a service that is down for service or overload.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><\/h2>\n<h2><span id=\"BWTECHS_EXTERNALAPI\"><b>BWTECH\u2019S EXTERNAL<\/b><b>\u00a0API<\/b><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Knowing the importance of having a service that is not only portable but that can interoperate with other applications, Bwtech developed its own External APIs. Following TM Forum standards and the REST concept model, the feature was created to allow clients to integrate NetChart\u2019s data with other programs they use in their daily routines.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">With that, we are able to expand not only the knowledge gathered throughout the time but also the reach of all the intelligence that is inside NetChart and its modules.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To do that, the NetChart\u2019s APIs created have the goal to let users search and use the following data to communicate with other programs:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">All KPIs registered in the NetChart database.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">All objects inserted in the database by element or technology.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">All PM charts that are available in the database by technology.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">All CM charts that are available in the database by technology.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">All PM and CM chart columns inserted in NetChart\u2019s database.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">All KPI values that are available in the system.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Raw PM and CM data by element or time frame.<\/span><\/li>\n<\/ul>\n<h2><\/h2>\n<h2><span id=\"ROUTES\"><b>ROUTES<\/b><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">As mentioned before, Bwtech\u2019s API feature was developed following the TM Forum\u2019s recommendations and best practices. Therefore, all of its route names keep an international standard. The implemented ones are listed below:<\/span><\/p>\n<table>\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><b>URL<\/b><\/td>\n<td style=\"text-align: center;\"><b>Description<\/b><\/td>\n<td style=\"text-align: center;\"><b>Request Method<\/b><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/api\/object\/{tech}\/Elements<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Return all objects which can be used as arguments (filter by TECH).<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GET<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/api\/object\/{tech}\/Elements\/{elementType}<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Return all objects which can be used as arguments (filter by TECH and ELEMENT_TYPE).<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GET<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/api\/kpi\/{tech}\/Kpis<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Return all KPIs which can be used as arguments. The KPI_ID accepts wildcards like % (filter by TECH).<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GET<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/api\/kpi\/{tech}\/Kpis\/{id}<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Return all information of a selected KPI (filter by TECH and KPI).<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GET<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/api\/tables\/Pm\/{tech}<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Return all PM table names which can be used as arguments (filter by TECH).<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GET<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/api\/tables\/Cm\/{tech}<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Return all CM table names which can be used as arguments (filter by TECH).<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GET<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/api\/tables\/Pm\/{tech}\/{name}<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Return the required fields from the desired PM table (filter by TECH and TABLE).<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GET<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/api\/tables\/Pm\/{tech}\/{name}<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Return the required fields from the desired CM table (filter by TECH and TABLE).<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GET<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/api\/kpi\/{tech}\/Kpis\/{id}<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Return KPI values for the desired elements and time frame (filter by TECH and KPI).<\/span><\/td>\n<td><span style=\"font-weight: 400;\">POST<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/api\/tables\/Cm\/{tech}\/data\/{table}<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Return raw CM data for the desired elements and time frame (filter by TECH and TABLE).\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GET<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/api\/tables\/Pm\/{tech}\/data\/{table}<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Return raw PM data for the desired elements and time frame (filter by TECH and TABLE).\u00a0<\/span><\/td>\n<td><span style=\"font-weight: 400;\">GET<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"font-weight: 400;\">\/account\/login<\/span><\/td>\n<td><span style=\"font-weight: 400;\">Return authentication token.<\/span><\/td>\n<td><span style=\"font-weight: 400;\">POST<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><\/h2>\n<h2><span id=\"SWAGGER\"><b>SWAGGER<\/b><\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Swagger is a documentation website. It allows users to visualize and interact with your application API\u2019s resources without having any of the implementation logic in place. With automatic updates, Swagger has tools that ensure that the API documentation available there is always up-to-date. Therefore, it is called live documentation.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Through the site, the user can find all the available API routes (with details of what they are and what they will receive) and a description of all the data that can be interoperated between the systems, allowing them to communicate.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span id=\"How_to_use\"><span style=\"color: #808080;\"><b>How to use<\/b><\/span><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">In the <\/span><span style=\"color: #0000ff;\"><b>Select a spec<\/b><\/span><span style=\"font-weight: 400;\"> option, you can choose the context you desire to see.<br \/>\n<\/span><br \/>\n<a href=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-spec-selection.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1245\" src=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-spec-selection.png\" alt=\"\" width=\"1545\" height=\"195\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\"><br \/>\nThe first spec to use must be the <\/span><span style=\"color: #0000ff;\"><b>Auth API &#8211; v1<\/b><\/span><span style=\"font-weight: 400;\"> because through it the user can request his access to retrieve the APIs. This is the only route that is open, all the other ones need an authorization token.<br \/>\n<\/span><br \/>\n<a href=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1246\" src=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger.png\" alt=\"\" width=\"1454\" height=\"682\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">Through the <\/span><i><span style=\"font-weight: 400;\">\/account\/login<\/span><\/i><span style=\"font-weight: 400;\"> route, you can request the Bearer Token to access the other routes. To do that, you must give two main pieces of information: username and password.<br \/>\n<\/span><br \/>\n<a href=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-token.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1247\" src=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-token.png\" alt=\"\" width=\"1446\" height=\"684\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">After sending the information, the system validates it and, if you have authorized access, you receive the Bearer Token.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">With the token, go to the desired spec to request the APIs you need. Let\u2019s imagine you want a KPI API.<\/span><\/p>\n<p><b>1 &#8211;<\/b><span style=\"font-weight: 400;\"> Select the KPI API &#8211; v1 spec.<br \/>\n<\/span><br \/>\n<a href=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-spec-selection-kpi.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1248\" src=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-spec-selection-kpi.png\" alt=\"\" width=\"1545\" height=\"195\" \/><\/a><\/p>\n<p><b><br \/>\n2 &#8211;<\/b><span style=\"font-weight: 400;\"> In the KPI page, you will find the routes available and models.<br \/>\n<\/span><br \/>\n<a href=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-kpi-api.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1250\" src=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-kpi-api.png\" alt=\"\" width=\"1494\" height=\"857\" \/><\/a><\/p>\n<p><b><br \/>\n3 &#8211;<\/b><span style=\"font-weight: 400;\"> In the model option, you can see all the information and data you\u2019ll receive when requesting the API.<br \/>\n<\/span><br \/>\n<a href=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-models.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1251\" src=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-models.png\" alt=\"\" width=\"1475\" height=\"690\" \/><\/a><\/p>\n<p><b><br \/>\n4 &#8211;<\/b><span style=\"font-weight: 400;\"> When clicking on the routes, you\u2019ll find their details: the HTTP protocol verb, what are the required fields and a model of response.<br \/>\n<\/span><br \/>\n<a href=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-layout-api.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1249\" src=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-layout-api.png\" alt=\"\" width=\"1449\" height=\"919\" \/><\/a><\/p>\n<p><b><br \/>\n5 &#8211;<\/b><span style=\"font-weight: 400;\"> Select the route you want and click on the <\/span><span style=\"color: #0000ff;\"><b>Try it out <\/b><\/span><span style=\"font-weight: 400;\">button.<br \/>\n<\/span><br \/>\n<a href=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-try-it-out.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1252\" src=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-try-it-out.png\" alt=\"\" width=\"1449\" height=\"442\" \/><\/a><\/p>\n<p><b><br \/>\n6 &#8211;<\/b><span style=\"font-weight: 400;\"> Fill the required fields.<\/span><\/p>\n<p><a href=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-try-it-out-fields.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1253\" src=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-try-it-out-fields.png\" alt=\"\" width=\"1442\" height=\"580\" \/><\/a><\/p>\n<p><b><br \/>\n7 &#8211;<\/b><span style=\"font-weight: 400;\"> Click on <\/span><span style=\"color: #0000ff;\"><b>Execute<\/b><\/span><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><a href=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-try-it-out-execute.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1254\" src=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-try-it-out-execute.png\" alt=\"\" width=\"1447\" height=\"479\" \/><\/a><\/p>\n<p><b><br \/>\n8 &#8211;<\/b><span style=\"font-weight: 400;\"> And the system will give you the Curl and the Request URL.<\/span><\/p>\n<p><a href=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-try-it-out-response.png\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-1255\" src=\"https:\/\/help.bwtech.com\/wp-content\/uploads\/2020\/02\/Swagger-try-it-out-response.png\" alt=\"\" width=\"1442\" height=\"283\" \/><\/a><\/p>\n<p><b><br \/>\n9 &#8211;<\/b><span style=\"font-weight: 400;\"> Now you can copy the route with all the required fields already completed!<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Contents1 API (Application Program Interface)1.1 WHAT IS AN API?1.2 WHAT THE API SOLVE AND WHY IS IT IMPORTANT?1.2.1 TM Forum standard1.3 THE REST CONCEPT1.3.1 Stateless Communication: what is that?1.4 HOW TO USE THE APIs1.4.1 Examples1.5 USING THE HTTP CODES1.6 BWTECH\u2019S EXTERNAL\u00a0API1.7 ROUTES1.8 SWAGGER1.8.1 How to use API (Application Program Interface) &nbsp; WHAT IS AN API? [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"parent":9,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/help.bwtech.com\/index.php?rest_route=\/wp\/v2\/pages\/1242"}],"collection":[{"href":"https:\/\/help.bwtech.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/help.bwtech.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/help.bwtech.com\/index.php?rest_route=\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/help.bwtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1242"}],"version-history":[{"count":4,"href":"https:\/\/help.bwtech.com\/index.php?rest_route=\/wp\/v2\/pages\/1242\/revisions"}],"predecessor-version":[{"id":3988,"href":"https:\/\/help.bwtech.com\/index.php?rest_route=\/wp\/v2\/pages\/1242\/revisions\/3988"}],"up":[{"embeddable":true,"href":"https:\/\/help.bwtech.com\/index.php?rest_route=\/wp\/v2\/pages\/9"}],"wp:attachment":[{"href":"https:\/\/help.bwtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}