Note: You can use our api.aintium.com/platform/ api for upload data, update data, and delete data. for more information please visit the api documention : https://api.aintium.com/platform/docs
JSON File
The JSON file the file should be in the following format:
{
"id1": {
"field1": "value1",
"field2": "value2",
"field3": "value3",
...
},
"id2": {
"field1": "value1",
"field2": "value2",
"field3": "value3",
...
},
...
}
for example:
{
"a1234fa": {
"title": "Text",
"description": "Text",
"price": "$10",
"category": "Clothing"
},
"b5678fb": {
"title": "Text",
"description": "Text",
"price": "$20",
"category": "Electronics"
}
}
CSV File
The first column should be the item ID, the second column should be the item title, and the third column should be the item description. Note that you can add more columns if necessary, but they should be relevant to the item, such as price, category, and other relevant information.
Item ID | Column 1 | Column N |
---|---|---|
a1234fa | Text | Text |
for example this data is from Ikea:
Wait until the platform finishes processing the data. This may take a few minutes, depending on the size of your CSV file and the number of items you're uploading.
Once the processing is complete, you can use our search API by accessing the following endpoint: https://api.aintium.com/api/search.
for more information please read the search API documention:
https://api.aintium.com/api/docs
Aintium Platform API is a REST API that allows you to interact with the Aintium Platform to upload data, update data, and delete data.
We provide the following endpoints to interact with the Aintium Platform. to read more please visit our API Docs Page: https://api.aintium.com/platform/docs#/
To use the endpoint https://api.aintium.com/platform/insert_data to insert data into the Aintium Platform, you need to follow these steps:
{
"data": {
"id1": {
"field1": "value1",
"field2": "value2",
...
},
"id2": {
"field1": "value1",
"field2": "value2",
...
},
...
}
}
import requests
# Define the data to be inserted
data = {
"data": {
"id1": {
"field1": "value1",
"field2": "value2"
},
"id2": {
"field1": "value3",
"field2": "value4"
}
}
}
The outermost layer of the JSON object should have a key named "data" which contains a nested object. The nested object should contain key-value pairs where the keys are unique IDs and the values are objects with the fields and values that you want to insert.
# Define the authentication headers
headers = {'access_token': 'API_KEY'}
# Send a POST request to the endpoint with the data and headers
response = requests.post('https://api.aintium.com/platform/insert_data', json=data, headers=headers)
In the body of the request, you should include the JSON object that you created in the previous step. You may also need to include authentication credentials access_token
.
# Check if the request was successful
if response.status_code == 200:
# Handle the successful response
print("Data was inserted successfully!")
else:
# Handle the error response
print(f"Error: {response.status_code} - {response.text}")
If the insertion was successful, the response will contain a "status" field with the value "success". If there was an error during the insertion, the response will contain a "status" field with the value "error" and a "message" field with a description of the error.
In either case, you should handle the response appropriately in your code.
To use the endpoint https://api.aintium.com/platform/update_data to update data in the Aintium Platform, you need to follow these steps:
{
"data": {
"id1": {
"field1": "value1",
"field2": "value2",
...
},
"id2": {
"field1": "value1",
"field2": "value2",
...
},
...
}
}
import requests
# Define the data to be updated
data = {
"data": {
"id1": {
"field1": "updated_value1",
"field2": "updated_value2"
},
"id2": {
"field1": "updated_value3",
"field2": "updated_value4"
}
}
}
The outermost layer of the JSON object should have a key named "data" which contains a nested object. The nested object should contain key-value pairs where the keys are unique IDs and the values are objects with the fields and updated values that you want to insert.
# Define the authentication headers
headers = {'access_token': 'API_KEY'}
# Send a PUT request to the endpoint with the data and headers
response = requests.put('https://api.aintium.com/platform/insert_data', json=data, headers=headers)
In the body of the request, you should include the JSON object that you created in the previous step. You may also need to include authentication credentials access_token.
# Check if the request was successful
if response.status_code == 200:
# Handle the successful response
print("Data was updated successfully!")
else:
# Handle the error response
print(f"Error: {response.status_code} - {response.text}")
If the update was successful, the response will contain a "status" field with the value "success". If there was an error during the update, the response will contain a "status" field with the value "error" and a "message" field with a description of the error.
In either case, you should handle the response appropriately in your code.
Use the endpoint https://api.aintium.com/platform/delete_data to delete data from the Aintium Platform, you need to follow these steps:
{
"ids": [
"id1",
"id2",
"id3",
...
]
}
import requests
# Define the data to be deleted
data = {
"ids": [
"id1",
"id2"
]
}
The JSON object should contain a key named "ids" which is an array of unique IDs that you want to delete.
# Define the authentication headers
headers = {'access_token': 'API_KEY'}
# Send a DELETE request to the endpoint with the data and headers
response = requests.delete('https://api.aintium.com/platform/delete_data', json=data, headers=headers)
In the body of the request, you should include the JSON object that you created in the previous step. You may also need to include authentication credentials access_token .
# Check if the request was successful
if response.status_code == 200:
# Handle the successful response
print("Data was deleted successfully!")
else:
# Handle the error response
print(f"Error: {response.status_code} - {response.text}")
If the deletion was successful, the response will contain a "status" field with the value "success". If there was an error during the deletion, the response will contain a "status" field with the value "error" and a "message" field with a description of the error.
In either case, you should handle the response appropriately in your code.
The endpoint https://api.aintium.com/api/search handles search requests and returns search results in JSON format. To use this endpoint, you need to follow these steps:
{
"query": "your query",
"top_k": 10,
"user_id": "your user id"
}
import requests
# Define the input data for the search
input_data = {
"query": "your query",
"top_k": 10,
"user_id": "your user id"
}
The JSON object should contain three keys: "query", "top_k", and "user_id". The "query" key should contain the string that you want to search for. The "top_k" key should contain an integer that represents the number of search results that you want to retrieve. The "user_id" key is optional and can contain a unique identifier for the user who is performing the search we using it to create user profile to make our search personalize for the user.
# Define the authentication headers
headers = {'access_token': 'API_KEY'}
# Send a POST request to the endpoint with the input data
response = requests.post('https://api.aintium.com/api/search', json=input_data, headers=headers)
In the body of the request, you should include the JSON object and the headers that you created in the previous steps.
# Handle the response
if response.status_code == 200:
# Convert the response to a JSON object
search_results = response.json()
# Handle the search results
print(search_results)
else:
# Handle the error response
print(f"Error: {response.status_code} - {response.text}")
If the search was successful, the response will contain a list of dictionaries. Each dictionary will contain the search result for a specific ID in the Aintium Platform. The key of the dictionary will be the ID and the value will be another dictionary with the fields and values that match the search query.
In either case, you should handle the response appropriately in your code.