# How to use Aintium Platform To Create Search Engine 1. Go to the website http://platform.aintium.com/admin using your preferred web browser. ![](https://i.imgur.com/ywjeGma.png) 2. Enter your email and password, to access the platform. ![](https://i.imgur.com/IJTtArq.png) 3. From the left-side menu, select "Services." ![](https://i.imgur.com/XNcTSO6.png) 4. Click on the "Add Service" button located on the top right-hand corner of the screen. ![](https://i.imgur.com/CoV5vVD.png) 5. In the new window that appears, select the services you want from the drop-down menu. If you want to upload your data in CSV or JSON file by clicking the "green +" button and selecting the appropriate file from your computer's local drive. ![](https://i.imgur.com/iMP2CMD.png) 6. Upload file from Uaer Data Tap from Data New Data File in the top right corner Ensure that your json or CSV file is properly formatted. ![](https://i.imgur.com/UqWzXBg.png) 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: ![](https://i.imgur.com/z8RWwL8.png) 7. 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. 8. 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 Plaform API Aintium Platform API is a REST API that allows you to interact with the Aintium Platform to upload data, update data, and delete data. ## How to use the API 1. Create an account on the Aintium Platform. 2. Create a project on the Aintium Platform. 3. Get your API key from the Aintium Platform. 4. Use the API key in the header of your request. 5. Use the endpoints below to interact with the Aintium Platform. ## How to get your API key 1. Create an account on the Aintium Platform. 2. Create a project on the Aintium Platform. 3. Get your API key from the Aintium Platform. ## Endpoints 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#/ * /upload_file: Upload a file to the Aintium Platform. * /insert_data: Insert data to the Aintium Platform. * /update_data: Update data in the Aintium Platform. * /delete_data: Delete data from the Aintium Platform. ### How to Upload File Using Aintium Platform API ### How to Insert Data Using Aintium Platform API To use the endpoint https://api.aintium.com/platform/insert_data to insert data into the Aintium Platform, you need to follow these steps: 1. Create a JSON object that follows the required format: The data that you want to insert should be structured in a JSON object with the following format: ``` { "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. 2. Define the authentication headers you can find the API key in your services tab ``` # Define the authentication headers headers = {'access_token': 'API_KEY'} ``` 3. Send a POST request to the endpoint: After creating the JSON object, you need to send a POST request to the endpoint https://api.aintium.com/platform/insert_data. You can do this using a tool like Postman or by using a programming language with HTTP capabilities such as Python. ``` # 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` . 4. Handle the response: After sending the POST request, you should receive a response from the Aintium Platform. The response will be in JSON format and will contain information about whether the insertion was successful or not. ``` # 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. 5. Update data: If you try to insert data with an ID that already exists in the Aintium Platform, the existing data will be updated with the new values. Therefore, you can use the same endpoint to update existing data by sending the updated values with the same ID. ### How to Update Data Using Aintium Platform API To use the endpoint https://api.aintium.com/platform/update_data to update data in the Aintium Platform, you need to follow these steps: 1. Create a JSON object that follows the required format: The data that you want to update should be structured in a JSON object with the following format: ``` { "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. 2. Define the authentication headers you can find the API key in your services tab ``` # Define the authentication headers headers = {'access_token': 'API_KEY'} ``` 3. Send a PUT request to the endpoint: After creating the JSON object, you need to send a PUT request to the endpoint https://api.aintium.com/platform/update_data. You can do this using a tool like Postman or by using a programming language with HTTP capabilities such as Python. ``` # 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. 4. Handle the response: After sending the POST request, you should receive a response from the Aintium Platform. The response will be in JSON format and will contain information about whether the update was successful or not. ``` # 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. 5. Insert new data: If you try to update data with an ID that does not exist in the Aintium Platform, the new data will be inserted. Therefore, you can use the same endpoint to insert new data by sending the new values with a new ID. ### How to Delete Items Using Aintium Platform API Use the endpoint https://api.aintium.com/platform/delete_data to delete data from the Aintium Platform, you need to follow these steps: 1. Create a JSON object that follows the required format: The data that you want to delete should be structured in a JSON object with the following format: ``` { "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. 2. Define the authentication headers: ``` # Define the authentication headers headers = {'access_token': 'API_KEY'} ``` 3. Send a DELETE request to the endpoint: After creating the JSON object, you need to send a DELETE request to the endpoint https://api.aintium.com/platform/delete_data. You can do this using a tool like Postman or by using a programming language with HTTP capabilities such as Python. ``` # 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 . 4. Handle the response: After sending the DELETE request, you should receive a response from the Aintium Platform. The response will be in JSON format and will contain information about whether the deletion was successful or not. ``` # 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. ### How to Perform Search Uesing Aintium Search API 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: 1. Create a JSON object that follows the required format: The input data that you want to search for should be structured in a JSON object with the following format: ``` { "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. 2. Define the authentication headers you can find the API key in your services tab ``` # Define the authentication headers headers = {'access_token': 'API_KEY'} ``` 3. Send a POST request to the endpoint: After creating the JSON object, you need to send a POST request to the endpoint https://api.aintium.com/api/search. You can do this using a tool like Postman or by using a programming language with HTTP capabilities such as Python. ``` # 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. 4. Handle the response: After sending the POST request, you should receive a response from the Aintium Platform. The response will be in JSON format and will contain the search results. ``` # 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.