Before you start
The connector talks to your RM server, so a few things must be in place on the RM side. Ask your RM administrator to check them:- RM REST server published on the internet over HTTPS. RM serves its REST APIs from the RM Host (RM.Host or RM.Host.Service, port 8051 by default). Out of the box it answers plain
http, so it must be published with HTTPS (TOTVS documents this as Habilitar SSL/TLS no Host). It must be reachable from the internet with anhttps://address, and your firewall must allow Nekt’s IP addresses. - An RM user for the integration. Create (or choose) an RM user whose access profile can read the data of the streams you want: customers/suppliers, financial entries, payment slips, movements and products. Profiles are managed in RM under Serviços Globais > Segurança > Perfis. For the Movements stream, the profile also needs the item Integração com WebService do Movimento (MovMovimentoTBCData) under Acesso a Menus.
- Data protection filter (LGPD). For customers/suppliers, financial entries and payment slips, RM only returns the records that belong to the user itself unless the user’s profile has the permission “Desconsiderar Filtro de Produto em WebService”, for each company (coligada). Without it, the extraction runs but brings few or no records.
Configuring TOTVS RM as a Source
In the Sources tab, click on the “Add source” button located on the top right of your screen. Then, select the TOTVS RM option from the list of connectors. Click Next and you’ll be prompted to add your access.1. Add account access
The following configurations are available:- RM server URL: The address of your RM REST server, including the port, for example
https://rm.yourcompany.com.br:8051. It must start withhttps://. - Username and Password: The RM user for the integration (the same login used to open RM).
- Company codes (coligadas): The code of each RM company (coligada) to extract, separated by commas, for example
1or1,2. Customers and suppliers shared by every company (coligada 0) are always included. - Branch codes (filiais): Optional. Codes of the branches to extract, separated by commas. Leave it empty to extract every branch. It applies to receivables, payables, payment slips, movements and warehouses. If you add a branch later, run a full sync so its history is extracted. A company added later is extracted from the start automatically.
- RM server timezone: (Default:
America/Sao_Paulo) RM stores dates in the server’s local time. Change it if your RM server runs in another timezone, such asAmerica/Manaus. - Lookback (minutes): (Default:
120) Incremental extractions re-read the records changed in this many minutes before the last extraction, to catch changes that RM saved late. - Page size: (Default:
500) How many records are read per request. Lower it if your RM server times out. - Verify SSL certificate: (Default: on) Turn it off only if your RM server uses a self-signed or incomplete certificate.
- SQL queries: Optional. SQL sentences registered in RM (Consulta SQL) to extract, one table each. See Extracting SQL queries below.
- Additional DataServers: Optional. Names of other RM DataServers to extract in full, separated by commas, one table each (for example
EstPrdDataBR). The RM user must be allowed to read them.
2. Select streams
Choose which data streams you want to sync. For faster extractions, select only the streams that are relevant to your analysis.Tip: The stream can be found more easily by typing its name.Select the streams and click Next.
3. Configure data streams
Customize how you want your data to appear in your catalog. Select the desired layer where the data will be placed, a folder to organize it inside the layer, a name for each table (which will effectively contain the fetched data) and the type of sync.- Layer: choose between the existing layers on your catalog. This is where you will find your new extracted tables as the extraction runs successfully.
- Folder: a folder can be created inside the selected layer to group all tables being created from this new data source.
- Table name: we suggest a name, but feel free to customize it. You have the option to add a prefix to all tables at once and make this process faster!
- Sync Type: you can choose between INCREMENTAL and FULL_TABLE.
- Incremental: every time the extraction happens, we’ll get only the new and changed data, which is good if, for example, you want to keep every record ever fetched.
- Full table: every time the extraction happens, we’ll get the current state of the data, which is good if, for example, you don’t want to have deleted data in your catalog.
4. Configure data source
Describe your data source for easy identification within your organization, not exceeding 140 characters. To define your Trigger, consider how often you want data to be extracted from this source. This decision usually depends on how frequently you need the new table data updated (every day, once a week, or only at specific times). Optionally, you can define some additional settings:- Configure Delta Log Retention and determine for how long we should store old states of this table as it gets updated. Read more about this resource here.
- Determine when to execute an Additional Full Sync. This will complement the incremental data extractions, ensuring that your data is completely synchronized with your source every once in a while. For TOTVS RM we recommend a weekly full sync: records deleted in RM, and changes RM saves without updating its change dates, only reach your incremental tables on a full sync.
5. Check your new source
You can view your new source on the Sources page. If needed, manually trigger the source extraction by clicking on the arrow button. Once executed, your data will appear in your Catalog.Streams and Fields
Available streams
The table below lists every stream, its slug (the exact identifier to pass when creating the source via API) and a short description.
Every table also has a
record column with the whole record exactly as RM returned it (JSON, with RM’s own column names), so fields not listed below can still be used in your queries, for example json_extract_scalar(record, '$.CAMPOLIVRE').
Fields by stream
Customers and suppliers
Customers and suppliers
Stream name:
customers_vendors. Customers and suppliers registered in RM, with document (CPF/CNPJ), e-mail, phone and address.Source: DataServer FinCFODataBR (table FCFO)Sync Strategy:- Incremental on
modified_at(the record’s last change in RM) - Primary key(s):
id
Receivables
Receivables
Stream name:
receivables. Accounts receivable entries (lançamentos a receber): amounts, due dates and settlement status.Source: DataServer FinLanDataBR (table FLAN, receivable entries)Sync Strategy:- Incremental on
modified_at(the record’s last change in RM). Entries still open are re-read on every run, and an entry settled or cancelled since the last run is read again even when RM did not stamp the change - Primary key(s):
id
Payables
Payables
Stream name:
payables. Accounts payable entries (lançamentos a pagar).Source: DataServer FinLanDataBR (table FLAN, payable entries)Sync Strategy:- Incremental on
modified_at(the record’s last change in RM). Entries still open are re-read on every run, and an entry settled or cancelled since the last run is read again even when RM did not stamp the change - Primary key(s):
id
Payment slips (boletos)
Payment slips (boletos)
Stream name:
payment_slips. Bank payment slips with the data needed for a duplicate copy: nosso número, barcode, typeable line, due date and amount.Source: DataServer FinBoletoData (table FBOLETO)Sync Strategy:- Incremental on
modified_at(the record’s last change in RM) - Primary key(s):
id
Movements
Movements
Stream name:
movements. Sales orders, invoices, purchases and other stock movements (header).Source: DataServer MovMovimentoTBCData (table TMOV)Sync Strategy:- Incremental on
modified_at(the record’s last change in RM) - Primary key(s):
id
Warehouses
Warehouses
Stream name:
warehouses. Stock locations (locais de estoque).Source: DataServer EstLOCData (table TLOC)Sync Strategy:- Full table (the whole list is read on every run)
- Primary key(s):
id
Products
Products
Stream name:
products. Products and services with description, prices 1 to 5, units and costs.Source: API GET /api/est/v2/ProductsSync Strategy:- Full table (the whole list is read on every run)
- Primary key(s):
internal_id
SQL query (sql_name)
SQL query (sql_name)
Stream name:
sql_<name>, one for each item of the SQL queries setting.Source: ConsultaSQL API (/api/framework/v1/consultaSQLServer/RealizaConsulta)Sync Strategy:- Full table (the sentence runs once per extraction and its whole result replaces the table)
- Primary key(s):
row_number
Additional DataServer (dataserver_name)
Additional DataServer (dataserver_name)
Stream name:
dataserver_<name>, one for each name in the Additional DataServers setting.Sync Strategy:- Full table
- Primary key(s):
id
Extracting SQL queries
Some RM data, such as stock balances and price tables, has no standard listing in RM’s REST services. You can still bring it to Nekt with an SQL sentence registered in RM (Consulta SQL, in Serviços Globais):-
In RM, create the sentence, for example with the code
NEKT.001in the stock application (T): -
Allow the integration user to run it.
IDPRDmatchesproduct_idin theproductstable. -
In the source’s SQL queries setting, list it as JSON. Each item has a
name(the table becomessql_<name>), the sentencecode, thecompany_idit belongs to, thesystem(application code, such asTfor stock orFfor finance) and, optionally,parametersandcontext_company_id:
record column; in queries, read its columns with your warehouse’s JSON functions.
Implementation Notes
Data Quality Considerations
- Dates and times are converted from the RM server’s local time (see RM server timezone) to UTC.
- Receivables and payables that are still open or partially settled are re-read on every extraction. An entry that was open in the previous extraction and was settled or cancelled since is read again, even when RM did not update its change date, so the settlement status stays current.
- Records deleted in RM stay in incremental tables until the next full sync (see the weekly full sync recommendation above).
- The follow-up of open entries works for up to 200,000 open receivables (or payables) per company. Above that, the run log says so, and an entry settled or cancelled without RM updating its change dates only shows its new status after a full sync.
- If open entries stop being returned by RM (deleted, or the user lost access to them), the run log tells you how many. When most of them disappear at once, it warns you to check the RM user’s permissions.
- A payment slip’s settlement shows up in its receivable entry (
receivables.statuslan,valorbaixado,databaixa). - RM does not provide the payment slip’s PDF or a link to it through its APIs; slips are printed by RM itself. The data needed for a duplicate copy (typeable line, barcode, nosso número, due date and amount) is in
payment_slips. - The meaning of prices 1 to 5 of a product is configured in each RM installation.
- Customers, receivables and payment slips depend on the data protection permission described in Before you start. On the first extraction (and on every full sync) the run log shows how many records were read per company: if the numbers look low compared with RM, check that permission.
API Limits & Performance
- RM recommends paging every read; the connector reads 500 records per request by default. Large first extractions (years of financial entries) can take a while.
- If records are added or removed in RM while a list is being read, the connector reads the list again (up to three times) so that no record is missed.