API's for the diamond industry

Onsite Full Feed

Overview: In this natural diamond feed API you will send an HTTP request with the requested identifiers in JSON, and you will get the full details of matching pre-filtered diamonds back in the requested format. This service is available as an add-on to all subscribers of the IDEX trading platform, however, results may vary based on your subscription type and permissions. Filters and markups can be set on IDEX.

Input Parameters

Note: you must use a valid Api Key that provides access to this service and have an active subscription to this service.
Note: You may download a new file every 2 hours. Before that time is up you will get the previous file again, unless changes to inventory customizations have been saved.
Parameter Example Format Mandatory
api_key HNNSSA1223311 String Yes
api_secret DDccdaaedf123 String Yes
file_format This can be "csv"." String Yes
data_format This is the data template. This can be "format_20220525_basis" or "format_20220530_extended".
String Yes
create_zip_file true if you want to received compressed (zipped) file. Default is true. Boolean No

Data Formats

You should specify a data format for future compatibility. Note that the [EMPTY FIELD] is just blank.

format_20220525_basis
Headers: Item ID # , Cut , Carat , Color , Natural Fancy Color , Natural Fancy Color Intensity , Natural Fancy Color Overtone , Treated Color , Clarity , Make (Cut Grade) , Grading Lab , Certificate Number , Certificate Path , Image Path , Online Report , Price Per Carat , Total Price , % Off IDEX List , Polish , Symmetry , Measurements (LengthxWidthxHeight) , Depth , Table , Crown Height , Pavilion Depth , Girdle (From / To) , Culet Size , Culet Condition , Graining , Fluorescence Intensity , Fluorescence Color , Enhancement , Country , State / Region , Pair Stock Ref. , [EMPTY FIELD]

format_20220530_extended
Headers: Item ID # , Cut , Carat , Color , Natural Fancy Color , Natural Fancy Color Intensity , Natural Fancy Color Overtone , Treated Color , Clarity , Cut Grade , Grading Lab , Certificate Number , Certificate Path , Image Path , Online Report , Price Per Carat , Total Price , % Off IDEX List , Polish , Symmetry , Measurements Length , Measurements Width , Measurements Height , Depth , Table , Crown Height , Crown Angle , Pavilion Depth , Pavilion Angle , Girdle From , Girdle To , Culet Size , Culet Condition , Graining , Fluorescence Intensity , Fluorescence Color , Enhancement , Country , State / Region , Pair Stock Ref. , Shade , Milky , Black Inclusion , Eye Clean , Provenance Report , Provenance Number , Brand , Guaranteed Availability , [EMPTY FIELD]

format_20221026_extended
Headers: Item ID # , Supplier Stock Ref. , Cut , Carat , Color , Natural Fancy Color , Natural Fancy Color Intensity , Natural Fancy Color Overtone , Treated Color , Clarity , Cut Grade , Grading Lab , Certificate Number , Certificate Path , Image Path , Online Report , Price Per Carat , Total Price , % Off IDEX List , Polish , Symmetry , Measurements Length , Measurements Width , Measurements Height , Depth , Table , Crown Height , Crown Angle , Pavilion Depth , Pavilion Angle , Girdle From , Girdle To , Culet Size , Culet Condition , Graining , Fluorescence Intensity , Fluorescence Color , Enhancement , Country , State / Region , Pair Stock Ref. , Asking Price For Pair , Shade , Milky , Black Inclusion , Eye Clean , Provenance Report , Provenance Number , Brand , Guaranteed Availability , [EMPTY FIELD]

format_20230628_extended
Headers: Item ID # , Supplier Stock Ref. , Cut , Carat , Color , Natural Fancy Color , Natural Fancy Color Intensity , Natural Fancy Color Overtone , Treated Color , Clarity , Cut Grade , Grading Lab , Certificate Number , Certificate Path , Image Path , Online Report , Video URL , 3DViewer URL , Price Per Carat , Total Price , % Off IDEX List , Polish , Symmetry , Measurements Length , Measurements Width , Measurements Height , Depth , Table , Crown Height , Crown Angle , Pavilion Depth , Pavilion Angle , Girdle From , Girdle To , Culet Size , Culet Condition , Graining , Fluorescence Intensity , Fluorescence Color , Enhancement , Country , State / Region , Pair Stock Ref. , Asking Price For Pair , Shade , Milky , Black Inclusion , Eye Clean , Provenance Report , Provenance Number , Brand , Guaranteed Availability , [EMPTY FIELD]

Note: You may download a new file every 2 hours. Before that time is up you will get the previous file again, unless changes to inventory customizations have been saved.

Sample Request Extended

HTTP JSON
Endpoint: https://api.idexonline.com/onsite/api/fullfeed
{
	"authentication_details":{
		"api_key":"HNNSSA1223311",
		"api_secret":"DDccdaaedf123"
	},
	"parameters":{
		"file_format": "csv",
		"data_format": "format_20220530_extended",
		"create_zip_file": true
	}
}

Sample Request Basis

HTTP JSON
Endpoint: https://api.idexonline.com/onsite/api/fullfeed
{
	"authentication_details":{
		"api_key":"HNNSSA1223311",
		"api_secret":"DDccdaaedf123"
	},
	"parameters":{
		"file_format": "csv",
		"data_format": "format_20220525_basis",
		"create_zip_file": true
	}
}

Sample Response

File or JSON Data
If all goes well, the HTTP code will be 200. You will get the file


In case of an exception, the error message will be displayed in this format, and the HTTP code will be 500.
{
    "result_info": {
        "response_code": 32110,
        "response_description": "A description of the exception."
    }
}
		

Postman Sample

Postman setup example

Sample Code

C#
string endpoint = "https://api.idexonline.com/onsite/api/fullfeed";
string reqJson = "";
string result = "";
bool error = false;
string downloadPath = @"C:\IDEX\Temp\Onsite\file.zip";
string errorPath = @"C:\IDEX\Temp\Onsite\file_error.txt";

reqJson = "{\"authentication_details\":{\"api_key\":\"yourapikey\",\"api_secret\": \"yourapisecret\"},";
reqJson += "\"parameters\":{\"file_format\": \"csv\",\"data_format\": \"format_20220530_extended\",\"create_zip_file\": true}}";

System.Net.WebRequest wr = System.Net.WebRequest.Create(endpoint);
wr.Method = "POST";
wr.ContentType = "application/json; charset=UTF-8";
wr.Timeout = 900000;
System.IO.Stream reqStream = wr.GetRequestStream();
byte[] postArray = System.Text.Encoding.UTF8.GetBytes(reqJson);
reqStream.Write(postArray, 0, postArray.Length);
reqStream.Close();

try
{
	System.Net.WebResponse webResponse = wr.GetResponse();

	if (webResponse.Headers["content-disposition"] != null)
	{
		//got a file
		System.IO.Stream s = webResponse.GetResponseStream();
		if (System.IO.File.Exists(downloadPath))
		{
			System.IO.File.Delete(downloadPath);
		}

		//save file:
		using (System.IO.FileStream os = new System.IO.FileStream(downloadPath, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite))
		{
			byte[] buff = new byte[102400];
			int c = 0;
			while ((c = s.Read(buff, 0, 10400)) > 0)
			{
				os.Write(buff, 0, c);
				os.Flush();
			}
			os.Close();
			s.Close();
		}
			
	}
	else
	{
		//didn't get a file, will be json with error message.
		System.IO.StreamReader sr = new System.IO.StreamReader(webResponse.GetResponseStream());
		result += sr.ReadToEnd();
		error = true;
	}

}
catch (System.Net.WebException ex)
{
	//unexpected error (500):
	System.IO.StreamReader sr = new System.IO.StreamReader(ex.Response.GetResponseStream());
	result = ex.Status.ToString();
	result += sr.ReadToEnd();
	error = true;
}

if (error == true)
{
	using (System.IO.StreamWriter writer = new System.IO.StreamWriter(errorPath))
	{
		writer.Write(result);
	}
}

© IDEX 2024, www.idexonline.com