API Connector Documentation
Import Omie Data to Google Sheets
In this guide, we’ll walk through how to pull data from the Omie API directly into Google Sheets, using the API Connector add-on for Sheets.
We'll first get an API key from Omie, and then set up a request to pull in Brazilian electronic service invoice (NFS-es) data to your spreadsheet.
Contents
- Before You Begin
- Part 1: Get Omie API Key and Secret
- Part 2: Pull Omie API Data into Sheets
- Part 3: Handle Pagination
- Part 4: API Documentation
Before You Begin
Click here to install the API Connector add-on from the Google Marketplace.
Part 1: Get Your Omie API Key and Secret
- Sign in to Omie and click the Gear icon
- Scroll down the page until you see your API key and API secret
- Keep these handy as we'll use these shortly. You're all set! You can now connect to Omie's API.
Part 2: Pull Omie API Data into Sheets
For this example, we'll make a request to the /servicos/nfse/
endpoint (see all endpoints in the documentation)
- Open up Google Sheets and click Extensions > API Connector > Open > Create request.
- In the request form enter the following:
- Application:
Custom
- Method:
POST
- Request URL:
https://app.omie.com.br/api/v1/servicos/nfse/
- Headers:
Content-Type
:application/json
- Request body:
{"call":"ListarNFSEs","app_key":"your_api_key","app_secret":"your_api_secret","param": [{"nPagina": 1,"nRegPorPagina": 500}]}
- Application:
- Create a new tab and click Set current to use that tab as your data destination.
- Name your request and click Run. A moment later you’ll see Omie data populate your sheet.
Part 3: Handle Pagination
By default, Omie returns just 50 records unless you set the "records per page" parameter in the request body to 500. The name of the pagination parameter depends on the endpoint; for example, the ListarClientes endpoint uses pagina
and registros_por_pagina
(for "page number" and "records per page"), while the ListarNFSEs endpoint uses nPagina
and nRegPorPagina
.
Please check the documentation to ensure you've configured your request with the correct pagination parameters.
ListarClientes Example
- Pagination type:
page parameter body
- Page parameter body:
param[].pagina
- Run until: choose when the request should stop running
ListarNFSEs Example
- Pagination type:
page parameter body
- Page parameter body:
param[].nPagina
- Run until: choose when the request should stop running
Part 4: API Documentation
Official API documentation: https://developer.omie.com.br/service-list/
Estou tentando usar o recurso de multiconsultas para extrair dados de contas apagar do OMIE.
Porém, os dados a partir da pagina 2 estão vindo zerados e nao deveria. Gostaria de saber se meu código esta errado ou se tem algum outro passo antes, se preciso pagar alguma coisa.
segue o código (coloquei a key e o secret em * apenas para representar):
{"call":"ListarContasPagar","app_key":"*********","app_secret":"*****","param":[{"pagina":1,"registros_por_pagina":500,"apenas_importado_api":"N"}]}
:::BREAK:::
{"call":"ListarContasPagar","app_key":"*********","app_secret":"*****","param":[{"pagina":2,"registros_por_pagina":500,"apenas_importado_api":"N"}]}
Can you please link me to the documentation for that endpoint so I can check the correct pagination parameters?
Fiz a alteração e apresentou um erro "Completed with errors
- We received an error from omie.com.br (500) "
Do jeito que eu escrevi funciona, mas só me traz os resultados da primeira página
I see, is it possible for you to message support with a screenshot of your setup so I can help you there?