Introduction
In Ignite, we need your data to utilize our product's capacities. Importing and exporting data are tedious tasks – not to speak of error-prone. It is possible to automate these jobs using our APIs.
We are currently supporting 1) sending data to our data sources (repositories) and 2) exporting data from our data tables.
Our open APIs are RESTful. To send data to Ignite, you need a token. See this article to understand how you create a token in Ignite.
API Documentation
Sending/pushing: https://data.igniteprocurement.com/docs
Exporting/pulling: https://datatable.igniteprocurement.com/docs/
Sending Data to Ignite
Plan out how you want to send data to Ignite
We support JSON, nd-JSON, excel (.xlsx), and all standard CSV-formats
One can also choose to compress (gzip) the file you submit as part of the request
Generate the token (see link above, or click here)
Create a data source under Data --> Data sources (click here to learn more)
Write a script or function for pushing data to Ignite
Could be files or JSON-data
Many of our customers write functions that are deployed on their cloud platform (Cloud Functions, Azure Functions etc.)
If you are sending data, ensure that you are sending flattened JSON records
Here is an example method in Python for data:
import requests
import pandas as pd
data_source_id = "f3c47953-07bc-45d2-a91e-8f4dbbf7d2b1"
token = "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
IMPORT_API_URL = "https://data.igniteprocurement.com"
### Method to send a dataframe or data to Ignite
def upload_data_ignite(
data,
data_source_id,
token,
import_name,
deleteQueryId
):
if isinstance(data, pd.DataFrame):
json_data = json.loads(
data.to_json(orient="records", force_ascii=False)
)
else:
json_data = data
headers = {
"Authorization" : token,
"Content-Type": "application/json"
}
body = {
"dataRepositoryId": data_source_id, # data repo = data source
"data": json_data,
"importName": import_name
}
if delete_query_id:
body["deleteQueryId"]= delete_query_id
payload = json.dumps(body)
response = requests.post(
url=f"{IMPORT_API_URL}/import/",
headers=headers,
data=payload
)
print(response.text)
return response
### invoking the method using the parameters defined at the top
response = upload_data_ignite(
data,
data_source_id,
token,
import_name = "demo_import_42_2023-12-24.json",
deleteQueryId=""
)
### We advise that you properly understand how to use this code before using or copying
Exporting data from Ignite
To export data from Ignite, you need a data table. The data table is where we store your structured, enriched, and normalized data. Any table can be exported.
The following steps are required:
Configure your URL
https://datatable.igniteprocurement.com/export/?dataTableId={dataTableId}
Determine if there is any need to filter your query – i.e. scope down the amount of data you will receive
We currently support selecting specific columns in your data (by datatype and global type) and filter data based on lastModified in Ignite
Perform a GET request with the URL from Step 1
The same means of authentication as for sending data to Ignite
The same Bearer token can be used for this purpose
Add your filters to the request body
Should your table contain more than 10,000 rows, a new URL, the nextUrl, will be part of the response
To proceed, make a query towards the nextUrl with the same request body and authentication. Loop through until nextUrl is empty
Here is an example in Python:
import requests
dataTypes = ["MONETARY_AMOUNT", "GROUP_STRUCTURE"]
columns = ["Transaction date", "Department", "Region"]
importDate = "2022-11-01T00:00:00.000Z"
columnFilter = { "dataTypes" : dataTypes, "columnLabels": columns }
importDateFilter = {"gte": importDate}
token = "JWT eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...."
headers = {"Authorization" : token}
body = {"columnFilter": columnFilter, "importDateFilter": importDateFilter}
dataTableId = "7dddc49f-bdeb-46b6-b5fd-ad9ea9b5ce66"
url = f"https://datatable.igniteprocurement.com/export/?dataTableId={dataTableId}"
response = requests.get(url, headers=headers, json=body)
print(response.text)
Check out the article below for a primer on what to consider and think about when integrating with Ignite: