🔓 Required permissions
Super Admin
Reading time | 5 minutes |
Set up time | 5 minutes |
Nombre d'étapes | 5 |
I/ Connect a new data source
II/ Select an empty query
III/ Go to the advanced editor
IV/ Write the request in the editor (copy the code)
This sample request allows authentication with the API and retrieval of invoices.
Code example
let
// Define your credentials
username = "",
password = "",
org_id = "",
// Define the API endpoints
tokenUrl = "https://api.ooti.co/api/v1/token-auth/",
invoicesUrl = "https://api.ooti.co/api/v1/invoices/list/" + org_id + "/",
// Function to get access token
GetAccessToken = () =>
let
body = "{""username"":""" & username & """,""password"":""" & password & """}",
Source = Json.Document(Web.Contents(tokenUrl, [Headers=[#"Content-type"="application/json"], Content=Text.ToBinary(body)])),
token = Source[token]
in
token,
// Get the access token
accessToken = GetAccessToken(),
// Function to fetch invoices
GetInvoices = (token as text) as table =>
let
Source = Json.Document(Web.Contents(invoicesUrl, [Headers=[Authorization="JWT " & token]])),
results = Source[results],
invoices = Table.FromRecords(results)
in
invoices,
// Fetch the invoices
InvoiceData = GetInvoices(accessToken)
in
InvoiceData
You can find all the available APIs on api.ooti.co/api/v1/docs/
V/ Authenticate URL






