> For the complete documentation index, see [llms.txt](https://docs.oneweb.tech/oneweb/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.oneweb.tech/oneweb/api-guide/app-runtime-api/list-all-methods-of-rest-api-and-explain-the-api-functionality.md).

# List all methods of REST API and explain the API functionality

#### Login&#x20;

Before calling any other API, client should login to ONEWEB because of security reasons. This App Runtime API is implemented using JWT. The application server is configured to verify that the incoming JWT are created by the authentication server. For example of client request see below&#x20;

```
URL: http://[SERVER]:[PORT]/eaf-rest/login 
HTTP Method: POST 
HTTP Request Header: Content-Type : application/json 
HTTP Request: { 
  "username" : [String: User Name], 
  "password" : [String: Password], 
  "ldapproviderurl" : [String: Empty value], 
  "clientId" : [String: key generate from client Ex. "93370c42-0d98-40ca-9a3d-36917a758b04"] 
} 
HTTP Response: { 
    "timestamp": [String: timestamp value Ex. "1510363014419"], 
    "validity": [Long: validity value Ex. 86400], 
    "id_token": [String: token value Ex. "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJkbXBzeXN0ZW0iLCJjbGllbnRJZCI6ImFiYyIsImV4cCI6MTUxMTIyNzAxNCwiaXNzIjoiY29tLmF2YWxhbnQuand0In0.UXR5LbqWruWy3rJur2Lx2E1nfI73JX3QBQXA4c2u2_CTSSzceRRMyziGevhtRe16AzAgZGKhny3PdfNltIT5Hw"] 
} 
```

#### Search Entity&#x20;

This API is used to search data from database by specific entity id and search parameter. &#x20;

```
URL: http://[SERVER]:[PORT]/eaf-rest/entity/[Entity ID]/search?handleForm=Y&page=1&volumePerPage=10&cbMethod=searchHandler 
HTTP Method: GET 
HTTP Request Header: Content-Type : application/json, Authorization : "Bearer "+[Token], clientId : [Key generate from client] 
HTTP Request: N/A 
HTTP Response:searchHandler({ 
"ALL_VOLUME":"[Number of Record]", 
"DATA":[{ 
"[Column Name 1]":"[Column Value 1]" 
"[Column Name 2]":"[Column Value 2]" 
.. 
"[Column Name n]":"[Column Value n]" 
"KEY":{"ID":"[Key Value]"} 
}] 
}); 
 
```

#### Get Entity&#x20;

After user uses search API, user can select a record to view detail. This API will return all information from database by entity id then user can edit, update or delete data on screen.&#x20;

```
URL: http://[SERVER]:[PORT]/eaf-rest/entity/[Entity ID]/get?ID=[Key ID]&cbMethod=getRecordHandler 
HTTP Method: GET 
HTTP Request Header: Content-Type : application/json, Authorization : "Bearer "+[Token], clientId : [Key generate from client] 
HTTP Request: N/A 
HTTP Response: getRecordHandler({ 
"DATA":{ 
"ENTITY_ID":"[Entity ID]", 
"MODULE_ID":{"[Module ID]":[{ 
"UPDATE":{ 
"[Table Name]":{ 
"[Column Name 1]":"Column Value 1", 
"[Column Name 2]":"Column Value 2", 
.. 
"[Column Name n]":"Column Value n", 
"KEY":{"Key Column Name 1":"[Key Value 1]","Key Column Name":"[Key Value]"} 
} 
} 
}]}, 
"MAIN_KEYTAB":{"MainTab Key Column Name":"[Key Value]"} 
} 
}); 
 
```

#### Save Entity&#x20;

This API is used to insert data to database. After user enter new data on screen and click save button.&#x20;

```
URL: http://[SERVER]:[PORT]/eaf-rest/entity/[Entity ID]/save?handleForm=Y&cbMethod=saveSuccessHandler 
HTTP Method: POST 
HTTP Request Header: Content-Type : application/json, Authorization : "Bearer "+[Token], clientId : [Key generate from client] 
HTTP Request: { 
  "[Module ID]": [{ 
      "INSERT": { 
        "[Table Name]": { 
  "[Column Name 1]": "[Value 1]", 
          "[Column Name 2]": "[Value 2]", 
          .. 
          "[Column Name n]": "[Value n]" 
        } 
      } 
    }] 
} 
HTTP Response: saveSuccessHandler({"MESSAGE":"Ok Save.","STATUS":"Success.","[Key Column Name]":"[Key Value]"}); 
```

#### Update Entity&#x20;

This API send update data to database after user edit data on screen. &#x20;

```
HTTP Method: POST 
HTTP URL: http://[SERVER]:[PORT]/eaf-rest/entity/[Entity ID]/save?handleForm=Y&cbMethod=saveSuccessHandler 
HTTP Header: Content-Type : application/json, Authorization : "Bearer "+[Token], clientId : [Key generate from client] 
HTTP Request: { 
  "[Module ID]": [{ 
      "UPDATE": { 
        "[Table Name]": { 
  "[Column Name 1]": "[Value 1]", 
          "[Column Name 2]": "[Value 2]", 
          .. 
          "[Column Name n]": "[Value n]" 
        } 
      } 
    }] 
} 
HTTP Response: saveSuccessHandler({"MESSAGE":"Ok Save.","STATUS":"Success.","[Key Column Name]":"[Key Value]"}); 
 
```

#### Delete Entity&#x20;

```
HTTP Method: POST 
HTTP URL: http://[SERVER]:[PORT]/eaf-rest/entity/[Entity ID]/get?handleForm=Y&cbMethod=searchHandler&ID=[Primary key] 
HTTP Header: Content-Type : application/json, Authorization : "Bearer "+[Token], clientId : [Key generate from client] 
HTTP Request:N/A 
HTTP Response:N/A 
```

#### Upload File&#x20;

```
HTTP Method: POST 
HTTP URL: http://[SERVER]:[PORT]/eaf-rest/entity/[Entity ID]/get?handleForm=Y&cbMethod=searchHandler&ID=[Primary key] 
HTTP Header: Content-Type : application/json, Authorization : "Bearer "+[Token], clientId : [Key generate from client] 
HTTP Request: [form-data] N/A 
HTTP Response:N/A 
```

#### Download File&#x20;

```
HTTP Method: GET 
HTTP URL: http://[SERVER]:[PORT]/eaf-rest/file/[File ID]/download?mimetype=[Mimetype] 
HTTP Header: Content-Type : application/json, Authorization : "Bearer "+[Token], clientId : [Key generate from client] 
HTTP Request: N/A 
HTTP Response: [Object File] N/A 
```

&#x20;

{% hint style="info" %}
Note: Mimetype has two option "application/octet-stream","application/base64"&#x20;
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.oneweb.tech/oneweb/api-guide/app-runtime-api/list-all-methods-of-rest-api-and-explain-the-api-functionality.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
