Skip to main content
All CollectionsData ManagementAPI
Open APIs for our Customers
Open APIs for our Customers

Used to set up your API

Martin Nordli-Mathisen avatar
Written by Martin Nordli-Mathisen
Updated over a week ago

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 Data to Ignite

  1. Plan out how you want to send data to Ignite

    1. We support JSON, nd-JSON, excel (.xlsx), and all standard CSV-formats

    2. One can also choose to compress (gzip) the file you submit as part of the request

  2. Generate the token (see link above, or click here)

  3. Create a data source under Data --> Data sources (click here to learn more)

  4. Write a script or function for pushing data to Ignite

    1. Could be files or JSON-data

    2. Many of our customers write functions that are deployed on their cloud platform (Cloud Functions, Azure Functions etc.)

  5. 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:

  1. Configure your URL

  2. Determine if there is any need to filter your query – i.e. scope down the amount of data you will receive

    1. We currently support selecting specific columns in your data (by datatype and global type) and filter data based on lastModified in Ignite

  3. Perform a GET request with the URL from Step 1

    1. The same means of authentication as for sending data to Ignite

      1. The same Bearer token can be used for this purpose

    2. Add your filters to the request body

    3. Should your table contain more than 10,000 rows, a new URL, the nextUrl, will be part of the response

      1. 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:

Did this answer your question?