V10 ResourcesWeb API
ResourcesWeb API
Web API
Back | List of Articles

How to execute lists in the WebAPI?

Last changed in 02/12/2020

The best way to retrieve data from the database is using the lists created in the ERP, that can be executed using WebAPI requests.

This process has several advantages, for example, safety and information confidentiality, ensured by the ERP and by the fact that it avoids the SQL injection into the database.

There are two types of lists and both of them can be executed with or without parameters:

  • Structured lists (associated to the ERP categories);
  • Adhoc lists (sql);

Structured lists

These lists are directly associated to the ERP categories (Items, Clients, etc.). To execute them, the request route must specify the category, followed by the list identifier and whose parameters you consider necessary.

Route:

{{apiUrl}}Plataforma/Listas/CarregaLista/[Categoria]?listId=[Id]

Example:

{{apiUrl}}Plataforma/Listas/CarregaLista/Artigo?listId=FE2E9AA6-5851-4F41-BF9B-1169AFEB7BE8

Adhoc lists

These lists are based on SQL queries and are not connected to ERP categories. Using adhoc lists, you can use SQL instructions to retrieve any information from the database. You can also use entry parameters in adhoc lists requests.

Route:

{{apiUrl}}Plataforma/Listas/CarregaLista/adhoc/?listId=[Id]

Example:

{{apiUrl}}Plataforma/Listas/CarregaLista/adhoc/?listId=E74715FC-6CFB-4CFC-B810-5A50E120550D

Parameters

The entry parameters for lists (structured or adhoc) must be specified in the request route, inside the variable listParameters and separated by a comma. The parameter order should be exactly the same used in the ERP parameter collection screen, when the list is executed.

Route:

{{apiUrl}}Plataforma/Listas/CarregaLista/adhoc/?listId=[Id]&listParameters=[Param1],[Param2]

Example:

{{apiUrl}}Plataforma/Listas/CarregaLista/adhoc/?listId=0AEA772A-FAA1-11E2-8941-000C29012C68&listParameters=2019,SOFRIO

Default lists

You can also use the default lists in each ERP category to retrieve that request parameterized information when invoking the category.

Route:

{{apiUrl}}Plataforma/Listas/CarregaLista/[Categoria]

Example:

{{apiUrl}}Plataforma/Listas/CarregaLista/Artigo
Bookmark or share this article
Esta página foi útil?
Obrigado pelo seu voto.

login para deixar a sua opinião.

Obrigado pelo seu feedback. Iremos analisá-lo para continuarmos a melhorar!
Artigos Relacionados
Utilizar o Postman para testar a WebAPI Formato dos pedidos Web API ERP10 Características da Web API Como executar listas na WebAPI? Web API - Conceitos e Arquitetura