DEVELOPER API

API Overview

Technology Suitable API's
PHP, C#, .NET HTTP POSTS
APIs from Forevermark

Forevermark – provides APIs to automate your trading process on Forevermark. From here you can access all the information related to Forevermark. We do regularly updates the APIs so suggest you to check this portal often. Feel free to give feedback/recommendation to help improve the APIs.

Upload stock to Forevermark

Upload your stock file automatically using our stock upload API. Here is the details for seller to be taken in consideration while uploading their stock direct on Forevermark Platform.

Fields and Values

Stock you upload must be matches the Forevermark accepted field and values. Click here to see accepted stock fields and values.

Upload XLS files

Automate the process of uploading stock through API. You can upload your stock in delimited XLS content or file.

Upload Images & Grading Number

Grading Number and image of diamond can be upload from computer files. You can also upload the same manually. Supported file formats for image are JPG, JPEG or PNG and for grading number it is pdf and image only

Authenticate with Forevermark

Upload using API

The authentication token will be stored in $auth_token. Note this MUST be HTTPS.

$email =  "Your email" ;
$password = "Your password";
$auth_url = "https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/login";
$post_string = "email=" . $email . "&password=" . $password . "";
$request = curl_init($auth_url);
curl_setopt($request, CURLOPT_HEADER , 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
$auth_token = curl_exec ($request);
json_decode($auth_token);
curl_close($request);
echo $auth_token;
using (WebClient client = new WebClient())
{
    byte[] response =
    client.UploadValues("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/login", new NameValueCollection()
    {
        { "email", EMAIL },
        { "password",PASSWORD }
    });
    string result = System.Text.Encoding.UTF8.GetString(response);
    JavaScriptSerializer js = new JavaScriptSerializer();
    dynamic d = js.Deserialize<dynamic>(result);
    try
    {
        token = d["access_token"];
    }
    catch(Exception)
    {
        token = "";
        MessageBox.Show(result.ToString());
    }
}
Using client As WebClient = New WebClient
    Dim response As Byte() = client.UploadValues("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/login", New NameValueCollection() From {
        {"email", EMAIL},
        {"password", PASSWORD}
    })
    Dim result As String = System.Text.Encoding.UTF8.GetString(response)
    Dim js As JavaScriptSerializer = New JavaScriptSerializer()
    Dim d As Object = js.Deserialize(Of Object)(result)
    Try
    token = d("access_token")
    Catch ex As Exception
    token = ""
    MessageBox.Show(result.ToString())
    End Try
End Using

Uploading Diamond To Forevermark

Upload delimited XLS files

Sample File Download

A great format for data exchange is XLS format. You can upload your stock in XLS format in many different ways to Forevermark.

Upload using API

Use HTTP POST to upload diamonds with API, supported by our assistance and explanation.

$fields = array(
    "access_token" => 'Token which generated from Login API ',
    "upload_type" => 'add' // Add, Update, Both
);
// files to upload
$filepath = 'sample.xls';  // STOCK XLS FILE PATH
$url = "https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/diamond_upload";
$files = array( basename($filepath) => file_get_contents($filepath));
$curl = curl_init();
$boundary = uniqid();
$delimiter = '-------------'. $boundary;
$post_data = build_data_files($boundary, $fields, $files);

curl_setopt_array($curl, array (
    CURLOPT_URL => $url,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POST => 1,
    CURLOPT_POSTFIELDS => $post_data,
    CURLOPT_FOLLOWLOCATION => TRUE,
    CURLOPT_SSL_VERIFYPEER => FALSE,
    CURLOPT_HTTPHEADER => array (
        "Content-Type: multipart/form-data; boundary=". $delimiter,
        "Content-Length: ".strlen($post_data)
    ),
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 3000,
));
$response = curl_exec($curl);
curl_close($curl);
var_dump($response);

function build_data_files ( $boundary , $fields, $files){
$data = '';
$eol = "\r\n";
$delimiter = '-------------' . $boundary;
foreach ($fields as $name => $content){
    $data .= "--" . $delimiter . $eol
    . 'Content-Disposition: form-data; name="' . $name . "\"".$eol.$eol
    . $content . $eol;
}
foreach ($files as $name => $content) {
    $data .= "--" . $delimiter . $eol
    . 'Content-Disposition: form-data; name="upload_file"; filename="' . $name . '"' . $eol
    . 'Content-Transfer-Encoding: binary'. $eol;
    $data .= $eol;
    $data .= $content . $eol;
}
$data .= "--" . $delimiter . "--". $eol;
return $data;
}
using (WebClient client = new WebClient())
{
    client.Encoding = Encoding.UTF8;
    NameValueCollection parameters = new NameValueCollection();
    parameters.Add("access_token", token); // PASS TOKEN NO
    parameters.Add("upload_type", "Both"); // UPLOAD TYPE : ADD,UPDATE,BOTH
    parameters.Add("upload_file", FilePath); // STOCK XLS FILE PATH
    client.QueryString = parameters;
    var responseBytes = client.UploadFile("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/diamond_upload", txtFilePath.Text);
    string result = Encoding.ASCII.GetString(responseBytes);
    // response json format
}
Using client As WebClient = New WebClient

    client.Encoding = Encoding.UTF8
    Dim parameters As New NameValueCollection()
    parameters.Add("access_token", token)  ' PASS TOKEN NO
    parameters.Add("upload_type", "Both")  ' UPLOAD TYPE : ADD,UPDATE,BOTH
    parameters.Add("upload_file", File path)  ' XLS STOCK FILE PATH
    client.QueryString = parameters
    Dim responseBytes = client.UploadFile("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/diamond_upload", txtFilePath.Text)
    Dim result As String = Encoding.ASCII.GetString(responseBytes)

End Using

Deleting Diamond To Forevermark

Delete delimited XLS files

A great format for data exchange is XLS format. You can delete your stock in XLS format in many different ways to Forevermark.

Delete using API

Use HTTP POST to delete diamonds with API, supported by our assistance and explanation.

Note : Stock Number have to be pass with separated commas(,).

$stock_no ="Enter Stock No.";
$access_token = "Token which generated from Login API";
$auth_url = "https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/delete_stock";
$post_string = "stock_no=" . $stock_no . "&access_token=" . $access_token . "";
$request = curl_init($auth_url);
curl_setopt($request, CURLOPT_HEADER , 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
$auth_token = curl_exec ($request);
json_decode($auth_token);
curl_close($request);
echo $auth_token;
using (WebClient client = new WebClient())
{
    byte[] response =
    client.UploadValues("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/delete_stock", new NameValueCollection()
    {
        { "access_token", token }, // Pass Token no
        { "stock_no","STONE NO"  } // For Eg. A101,A102,A103,A104
    });
    string result = System.Text.Encoding.UTF8.GetString(response);
    JavaScriptSerializer js = new JavaScriptSerializer();
    dynamic d = js.Deserialize<dynamic>(result);
    try
    {
        MessageBox.Show(d["message"].ToString());
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.ToString());
    }
}
Using client As WebClient = New WebClient
    Dim response As Byte() = client.UploadValues("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/delete_stock", New NameValueCollection() From {
        {"access_token", token}, ' PASS TOKEN NO 
        {"stock_no", Stone No}  ' PASS STONE NO For Eg. A101,A102,A103,A104
    })
    Dim result As String = System.Text.Encoding.UTF8.GetString(response)
    Dim js As JavaScriptSerializer = New JavaScriptSerializer()
    Dim d As Object = js.Deserialize(Of Object)(result)
    Try
    MessageBox.Show(d("message").ToString())
    Catch ex As Exception
    MessageBox.Show(ex.ToString())
    End Try
End Using

Uploading Image & Grading Number To Forevermark

Upload Images & Grading Number

Diamond images and Grading Number can upload from computer files or an spreadsheet, or, they can be uploaded manually on Forevermark.

Note 1 : Please choose a image to upload. Only JPG,JPEG and PNG format will be supported.Please choose your image with any of these format. Image name must contain Stock No. ( For Example: StockNo.jpg )

Note 2 : Please choose a Grading Number to upload. Only PDF,JPG,JPEG and PNG format will be supported.Please choose your file with any of these format. File name must contain grading number. ( For Example: GradingNumber.pdf )

$fields = array(
    "access_token" => 'Token which generated from Login API ',
    "media_type" => 'image' // image, gradingNo
);
// files to upload
$filepath = 'HP296.jpg';
$url = "https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/media_upload";
$files = array( basename($filepath) => file_get_contents($filepath));
$curl = curl_init();
$boundary = uniqid();
$delimiter = '-------------'. $boundary;
$post_data = build_data_files($boundary, $fields, $files);

curl_setopt_array($curl, array (
    CURLOPT_URL => $url,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POST => 1,
    CURLOPT_POSTFIELDS => $post_data,
    CURLOPT_FOLLOWLOCATION => TRUE,
    CURLOPT_SSL_VERIFYPEER => FALSE,
    CURLOPT_HTTPHEADER => array (
        "Content-Type: multipart/form-data; boundary=". $delimiter,
        "Content-Length: ".strlen($post_data)
    ),
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 3000,
));
$response = curl_exec($curl);
curl_close($curl);
var_dump($response);
function build_data_files ( $boundary , $fields, $files){
    $data = '';
    $eol = "\r\n";
    $delimiter = '-------------' . $boundary;
    foreach ($fields as $name => $content){
        $data .= "--" . $delimiter . $eol
        . 'Content-Disposition: form-data; name="' . $name . "\"".$eol.$eol
        . $content . $eol;
    }
    foreach ($files as $name => $content) {
        $data .= "--" . $delimiter . $eol
        . 'Content-Disposition: form-data; name="upload_file"; filename="' . $name . '"' . $eol
        . 'Content-Transfer-Encoding: binary'. $eol;
        $data .= $eol;
        $data .= $content . $eol;
    }
$data .= "--" . $delimiter . "--". $eol;
return $data;
}
using (WebClient client = new WebClient())
{
    client.Encoding = Encoding.UTF8;
    NameValueCollection parameters = new NameValueCollection();
    parameters.Add("access_token", token); // PASS TOKEN NO
    parameters.Add("media_type", "gradingNo");// MEDIA TYPE : gradingNo,image
    client.QueryString = parameters;
    var responseBytes = client.UploadFile("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/media_upload", "DIAMOND IMAGE / GRADING NUMBER FILE PATH");
    string result = Encoding.ASCII.GetString(responseBytes);
    JavaScriptSerializer js = new JavaScriptSerializer();
    dynamic d = js.Deserialize<dynamic>(result);
    try
    {
        if (d["status"] == "1")
        {
            MessageBox.Show("UPLOAD DONE...");
        }
    }
    catch (Exception)
    {
        MessageBox.Show(result.ToString());
    }
}
Using client As WebClient = New WebClient
    client.Encoding = Encoding.UTF8
    Dim parameters As New NameValueCollection()
    parameters.Add("access_token", token)  'PASS TOKEN NO
    parameters.Add("media_type", "gradingNo")  'MEDIA TYPE : gradingNo,image
    client.QueryString = parameters
    Dim responseBytes = client.UploadFile("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/media_upload", "DIAMOND IMAGE / GRADING NUMBER FILE PATH")
    Dim result As String = Encoding.ASCII.GetString(responseBytes)
    Dim js As JavaScriptSerializer = New JavaScriptSerializer()
    Dim d As Object = js.Deserialize(Of Object)(result)
    Try
        If (d("status") = "1") Then
        MessageBox.Show("UPLOAD DONE...");
    End If
        Catch ex As Exception
        MessageBox.Show(result.ToString())
    End Try
End Using

Download Diamond To Forevermark

Download Diamonds

Diamond records will be fetch by pagination wise.

Method & response

By entering your page no. all the record of that particular page will be fetch. Response will be in json.

$access_token = "Token which generated from Login API";
$page_no = "1";
$auth_url = "https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/download_diamond";
$post_string = "access_token=" . $access_token . "&page_no=" . $page_no . "";
$request = curl_init($auth_url);
curl_setopt($request, CURLOPT_HEADER , 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
$auth_token = curl_exec ($request);
json_decode($auth_token);
curl_close($request);
echo $auth_token;
using (WebClient client = new WebClient())
{
    byte[] response =
    client.UploadValues("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/download_diamond", new NameValueCollection()
    {
        { "access_token", token } //PASS TOKEN NO
    });
    string result = System.Text.Encoding.UTF8.GetString(response);
    // RESOPNE JSON FORMAT
}
Using client As WebClient = New WebClient
    Dim response As Byte() = client.UploadValues("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/download_diamond", New NameValueCollection() From {
    {"access_token", token}  ' PASS TOKEN NO
})
Dim result As String = System.Text.Encoding.UTF8.GetString(response)
End Using
' RESOPNE JSON FORMAT

Preparing Your Stock File For Upload

This page is a reference to the fields and values you can use in XLS files containing your stock listings that you want to upload to Forevermark. The first row should contain the field headers.

Recognized Forevermark fields:
Main diamond details StockNo#, Diamond Location ,Shape, Size, Color, Clarity, Polish, Symmetry, Cut, Fluorescence, Measurements
Prices Price Per Carat, Discount, Final Amount
location and availability Country, Availability
Additional diamond details Fancy Color, Fancy Color Intensity, Fancy Color Overtone, Depth %, Table %, Girdle %, Culet, Crown Height, Crown Angle, Pavilion Height, Pavilion Angle, Eye Clean, Report Comment, Supplier Comment, Star Length, Shade, Key To Symbols, Heart and Arrow, Ratio, Certificate, Video Link, Grading Number
Forevermark accepted values:
Field name Acceptable alternate field names Acceptable field values
Stock ID Stock ID * Enter your inventory stock number.
Availability Availability Available,Memo
Diamond Location Diamond Location Specify the physical location of the diamond
Shape Shape Round = Round, BR, ROUND, RBC, Round Brilliant, round, rbc, rd, RD
Princess = PRN, PR, PRIN, PN, MDSQB, SMB, PRINCESS, Princess, smb
Emerald = E, EM, EC, SQE, SQEM, SX, Emerald, EM, EMERALD, em, Em, ec, Square Emerald
Asscher = Asscher, A, CSS, CSSC, AC
Radiant= R, RAD, RA, RC, RDN, CRB, RCRB, Sq Radiant, SQR, CCSMB, RADIANT, Radiant, Square Radiant
Cushion = CB, Cushion Brilliant, C, CUX, CU, CMB, CUSH, CUS, RCRMB, CRC, CSC, CX, RCSB, SCMB, SCX, Cushion, CB, cushion, Cushion Modified Brilliant
Pear = P, PS, PSH, PB, PMB, PEAR, Pear, pb, ps, p, psh, pmb
Oval = O, OV, OMB, OB, OVAL, Oval, omb, Omb, o, ov
Marquise = MQB, M, MQ, MB, MARQUISE, Marquise, mqb, mq, m
Heart = H, HS, HT, MHRC, HB, HEART, Heart, hb, ht, hs, h
Baguette = Baguette, BAG, BG
Rose = Rose, RS, RRC
Other =Other, X, BAT
Weight Weight Enter .01-99.

* For parcels enter total carat weight up to two decimal points.
Color Color D, E, F, G, H, I, J, K, L, M, N, O-P, Q-R, S-T, U-V, W-X, Y-Z

* For fancy colors use the fancy color column.
Clarity Clarity FL, IF, VVS1, VVS2, VS1, VS2, SI1, SI2, SI3, I1, I2, I3

* For fancy colored stones that have no clarity, enter "N" for none.
Cut Cut I= Ideal,ID
EX = Excellent, X, EXC
VG = Very Good, V, V.Good
GD= Good ,G
FR = Fair, F
PR = Poor, P
Polish Polish I = Ideal,ID
EX = Excellent, X, EXC
VG = Very Good, V, V.Good
GD = Good ,G
FR = Fair, F
PR= Poor, P
Symmetry Symmetry I = Ideal,ID
EX = Excellent, X, EXC
VG = Very Good, V, V.Good
GD = Good ,G
FR = Fair, F
PR= Poor, P
Fluorescence Fluorescence VST = Very Strong ,FL4
STG = Strong ,ST ,FL3
MED = Medium ,FL2
FNT =Faint ,Negligible, FA, FL1
VSL = Very Slight, VSLG, VSLT
NON= None, No, FL0
INC Incription Number * Enter the inscription number of Forevermark.
GRD Grading Number * Enter the grading number of Forevermark.
Is Fancy Is Fancy Yes
No
Fancy Color Fancy Color Yellow, Pink, Blue, Red, Green, Purple, Orange, Violet, Gray, Black, Brown, Champagne, Chameleon, Cognac, White, Other
Fancy Color Overtone Fancy Overtone Yellow, Yellowwish, Pink, Pinkish, Blue, Bluish, Red, Redish, Green, Greenish, Purple, Purplish, Orange, Orangey, Violet, Violetish, Gray, Grayish, Black, Brown, Brownish, Champagne, Cognac, Chameleon, White, Other
Fancy Color Intensity Fancy Intensity Faint, Very Light, Light, Fancy Light, Fancy, Fancy Dark, Fancy Intense, Fancy Vivid, Fancy Deep
Measurements Measurements Example: 8.93 x 6.44 x 3.82
Depth % Depth Percentage Example: 62.4
* Give percentage with only one number after the decimal. Do not include % sign.
Table % Table Percentage Example: 60

* Give percentage in two digit form. Do not include % sign.
Ratio Ratio -
Crown Height Crown Height * Give percentage with only one number after the decimal. Do not include % sign.
Crown Angle Crown Angle * Give a value to the nearest 0.5 degree.
Pavilion Height Pavilion Height Example: 62.3

* Give a value to one decimal place.
Pavilion Angle Pavilion Angle Example: 62.3

* Give a value to one decimal place.
Heart and Arrow Heart and Arrow Yes
No
Eye Clean Eye Clean Yes
No
Girdle % Girdle Percentage * Must be a positive number. Do not include % sign.
Report Comment Report Comment * No more than 255 characters.
Supplier Comments Supplier Comments * Enter no more than 255 characters.
Key To Symbols Key To Symbols Bearding, Brown patch of color, Bruise, Cavity, Chip, Cleavage, Cloud, Crystal, Crystal Surface, Etch Channel, Extra Facet, Feather, Flux Remnant, Indented Natural, Internal Graining, Internal Inscription, Internal Laser Drilling, Knot, Laser Drill Hole, Manufacturing Remnant, Minor Details of Polish, Natural, Needle, No Inclusion, Pinpoint, Reflecting Surface Graining, Surface Graining, Twinning Wisp
Star Length Star Length  
Shade Shade None, White, Yellow, Brown, Green, Grey, Black, Pink, Blue, Mixed, Faint Brown, Faint Green, Other
Culet Culet EL = Extremely Large
VL = Very Large
L = Large
SL = Slightly Large
M = Medium
S = Small
VS = Very Small
N = None
Video Link Video Link Example: https://s3.ap-south-1.amazonaws.com/cvdhvideo/CARAT/VIDEO/106R20-2AF.html

API Overview

Technology Suitable API's
PHP, C#, .NET HTTP POSTS
APIs from Forevermark

Forevermark – provides APIs to automate your trading process on Forevermark. From here you can access all the information related to Forevermark. We do regularly updates the APIs so suggest you to check this portal often. Feel free to give feedback/recommendation to help improve the APIs.

Upload stock to Forevermark

Upload your stock file automatically using our stock upload API. Here is the details for seller to be taken in consideration while uploading their stock direct on Forevermark Platform.

Fields and Values

Stock you upload must be matches the Forevermark accepted field and values. Click here to see accepted stock fields and values.

Upload XLS files

Automate the process of uploading stock through API. You can upload your stock in delimited XLS content or file.

Upload Images & Grading Number

Grading Number and image of diamond can be upload from computer files. You can also upload the same manually. Supported file formats for image are JPG, JPEG or PNG and for grading number it is pdf and image only

Authenticate with Forevermark

Upload using API

The authentication token will be stored in $auth_token. Note this MUST be HTTPS.

$email =  "Your email" ;
$password = "Your password";
$auth_url = "https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/login";
$post_string = "email=" . $email . "&password=" . $password . "";
$request = curl_init($auth_url);
curl_setopt($request, CURLOPT_HEADER , 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
$auth_token = curl_exec ($request);
json_decode($auth_token);
curl_close($request);
echo $auth_token;
using (WebClient client = new WebClient())
{
    byte[] response =
    client.UploadValues("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/login", new NameValueCollection()
    {
        { "email", EMAIL },
        { "password",PASSWORD }
    });
    string result = System.Text.Encoding.UTF8.GetString(response);
    JavaScriptSerializer js = new JavaScriptSerializer();
    dynamic d = js.Deserialize<dynamic>(result);
    try
    {
        token = d["access_token"];
    }
    catch(Exception)
    {
        token = "";
        MessageBox.Show(result.ToString());
    }
}
Using client As WebClient = New WebClient
    Dim response As Byte() = client.UploadValues("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/login", New NameValueCollection() From {
    {"email", EMAIL},
    {"password", PASSWORD}
})
Dim result As String = System.Text.Encoding.UTF8.GetString(response)
Dim js As JavaScriptSerializer = New JavaScriptSerializer()
Dim d As Object = js.Deserialize(Of Object)(result)
Try
token = d("access_token")
Catch ex As Exception
token = ""
MessageBox.Show(result.ToString())
End Try
End Using

Uploading Jewellery To Forevermark

Upload delimited XLSX files

Sample File Download

A great format for data exchange is XLSX format. You can upload your stock in XLSX format in many different ways to Forevermark.

Upload using API

Use HTTP POST to upload jewellery with API, supported by our assistance and explanation.

$fields = array(
    "access_token" => 'Token which generated from Login API '// STOCK XLSX FILE PATH
);
$filepath = 'sample.xlsx';  // STOCK XLSX FILE PATH
$url = "https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/jewellery_upload";
$files = array( basename($filepath) => file_get_contents($filepath));
$curl = curl_init();
$boundary = uniqid();
$delimiter = '-------------'. $boundary;
$post_data = build_data_files($boundary, $fields, $files);
curl_setopt_array($curl, array (
    CURLOPT_URL => $url,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POST => 1,
    CURLOPT_POSTFIELDS => $post_data,
    CURLOPT_FOLLOWLOCATION => TRUE,
    CURLOPT_SSL_VERIFYPEER => FALSE,
    CURLOPT_HTTPHEADER => array (
    "Content-Type: multipart/form-data; boundary=". $delimiter,
    "Content-Length: ".strlen($post_data)
    ),
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 3000,
));
$response = curl_exec($curl);
curl_close($curl);
var_dump($response);

function build_data_files ( $boundary , $fields, $files){
    $data = '';
    $eol = "\r\n";
    $delimiter = '-------------' . $boundary;
    foreach ($fields as $name => $content){
        $data .= "--" . $delimiter . $eol
        . 'Content-Disposition: form-data; name="' . $name . "\"".$eol.$eol
        . $content . $eol;
    }
    foreach ($files as $name => $content) {
        $data .= "--" . $delimiter . $eol
        . 'Content-Disposition: form-data; name="upload_file"; filename="' . $name . '"' . $eol
        . 'Content-Transfer-Encoding: binary'. $eol;
        $data .= $eol;
        $data .= $content . $eol;
    }
    $data .= "--" . $delimiter . "--". $eol;
    return $data;
}
using (WebClient client = new WebClient())
{
    client.Encoding = Encoding.UTF8;
    NameValueCollection parameters = new NameValueCollection();
    parameters.Add("access_token", token); // PASS TOKEN NO
    parameters.Add("upload_file", FilePath); // STOCK XLSX FILE PATH
    client.QueryString = parameters;
    var responseBytes = client.UploadFile("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/jewellery_upload", txtFilePath.Text);
    string result = Encoding.ASCII.GetString(responseBytes);
    // response json format
}
Using client As WebClient = New WebClient

client.Encoding = Encoding.UTF8
Dim parameters As New NameValueCollection()
parameters.Add("access_token", token)  ' PASS TOKEN NO
parameters.Add("upload_file", File path)  ' XLSX STOCK FILE PATH
client.QueryString = parameters
Dim responseBytes = client.UploadFile("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/jewellery_upload", txtFilePath.Text)
Dim result As String = Encoding.ASCII.GetString(responseBytes)

End Using

Delete using API

Use HTTP POST to delete diamonds with API, supported by our assistance and explanation.

Note : Style Number have to be pass with separated commas(,).

$style_no ="Enter Style No."; // For Eg. A101,A102,A103,A104
$access_token = "Token which generated from Login API";
$auth_url = "https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/delete_jewellery";
$post_string = "style_no=" . $style_no . "&access_token=" . $access_token . "";
$request = curl_init($auth_url);
curl_setopt($request, CURLOPT_HEADER , 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
$auth_token = curl_exec ($request);
json_decode($auth_token);
curl_close($request);
echo $auth_token;
using (WebClient client = new WebClient())
{
    byte[] response =
    client.UploadValues("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/delete_jewellery", new NameValueCollection()
    {
        { "access_token", token }, // Pass Token no
        { "style_no","Style No"  } // For Eg. A101,A102,A103,A104
    });
    string result = System.Text.Encoding.UTF8.GetString(response);
    JavaScriptSerializer js = new JavaScriptSerializer();
    dynamic d = js.Deserialize<dynamic>(result);
    try
    {
        MessageBox.Show(d["message"].ToString());
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.ToString());
    }
}
Using client As WebClient = New WebClient
    Dim response As Byte() = client.UploadValues("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/delete_jewellery", New NameValueCollection() From {
        {"access_token", token}, ' PASS TOKEN NO 
        {"style_no", Style No}  ' PASS STYLE NO For Eg. A101,A102,A103,A104
    })
    Dim result As String = System.Text.Encoding.UTF8.GetString(response)
    Dim js As JavaScriptSerializer = New JavaScriptSerializer()
    Dim d As Object = js.Deserialize(Of Object)(result)
    Try
    MessageBox.Show(d("message").ToString())
    Catch ex As Exception
    MessageBox.Show(ex.ToString())
    End Try
End Using

Uploading Media To Forevermark

Upload Images,Video,Card No,Inscription No,360view

Jewellery images,Video,Card No,Inscription No and 360view can upload from computer files or an spreadsheet, or, they can be uploaded manually on Forevermark.

Please choose a media to upload. Only JPG,JPEG,Zip and PNG format will be supported.Please choose your image with any of these format. Media name must contain Style No. ( For Example: StyleNo.jpg )

$fields = array(
    "access_token" => 'Token which generated from Login API ',
    "media_type" => 'image' // Image,video,Card no,Inscription No,360view
);
// files to upload
$filepath = 'HP296.jpg';
$url = "https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/jewellery_media_upload";
$files = array( basename($filepath) => file_get_contents($filepath));
$curl = curl_init();
$boundary = uniqid();
$delimiter = '-------------'. $boundary;
$post_data = build_data_files($boundary, $fields, $files);

curl_setopt_array($curl, array (
    CURLOPT_URL => $url,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POST => 1,
    CURLOPT_POSTFIELDS => $post_data,
    CURLOPT_FOLLOWLOCATION => TRUE,
    CURLOPT_SSL_VERIFYPEER => FALSE,
    CURLOPT_HTTPHEADER => array (
    "Content-Type: multipart/form-data; boundary=". $delimiter,
    "Content-Length: ".strlen($post_data)
    ),
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 3000,
));
$response = curl_exec($curl);
curl_close($curl);
var_dump($response);

function build_data_files ( $boundary , $fields, $files){
    $data = '';
    $eol = "\r\n";
    $delimiter = '-------------' . $boundary;
    foreach ($fields as $name => $content){
        $data .= "--" . $delimiter . $eol
        . 'Content-Disposition: form-data; name="' . $name . "\"".$eol.$eol
        . $content . $eol;
    }
    foreach ($files as $name => $content) {
        $data .= "--" . $delimiter . $eol
        . 'Content-Disposition: form-data; name="upload_file"; filename="' . $name . '"' . $eol
        . 'Content-Transfer-Encoding: binary'. $eol;
        $data .= $eol;
        $data .= $content . $eol;
    }
    $data .= "--" . $delimiter . "--". $eol;
    return $data;
}
using (WebClient client = new WebClient())
{
    client.Encoding = Encoding.UTF8;
    NameValueCollection parameters = new NameValueCollection();
    parameters.Add("access_token", token); // PASS TOKEN NO
    parameters.Add("media_type", "Image");// MEDIA TYPE : Image,video,Card no,Inscription No,360view
    client.QueryString = parameters;
    var responseBytes = client.UploadFile("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/jewellery_media_upload", "FILE PATH");
    string result = Encoding.ASCII.GetString(responseBytes);
    JavaScriptSerializer js = new JavaScriptSerializer();
    dynamic d = js.Deserialize<dynamic>(result);
    try
    {
        if (d["status"] == "1")
        {
            MessageBox.Show("UPLOAD DONE...");
        }
    }
    catch (Exception)
    {
        MessageBox.Show(result.ToString());
    }
}
Using client As WebClient = New WebClient
    client.Encoding = Encoding.UTF8
    Dim parameters As New NameValueCollection()
    parameters.Add("access_token", token)  'PASS TOKEN NO
    parameters.Add("media_type", "Image")  'MEDIA TYPE : Image,video,Card no,Inscription No,360view
    client.QueryString = parameters
    Dim responseBytes = client.UploadFile("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/jewellery_media_upload", "DIAMOND IMAGE / GRADING NUMBER FILE PATH")
    Dim result As String = Encoding.ASCII.GetString(responseBytes)
    Dim js As JavaScriptSerializer = New JavaScriptSerializer()
    Dim d As Object = js.Deserialize(Of Object)(result)
    Try
    If (d("status") = "1") Then
    MessageBox.Show("UPLOAD DONE...");
    End If
    Catch ex As Exception
    MessageBox.Show(result.ToString())
    End Try
End Using

Download Jewellery To Forevermark

Download Jewellery

Jewellery records will be fetch by pagination wise.

Method & response

By entering your page no. all the record of that particular page will be fetch. Response will be in json.

$access_token = "Token which generated from Login API";
$page_no = "1";
$auth_url = "https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/download_jewellery";
$post_string = "access_token=" . $access_token . "&page_no=" . $page_no . "";
$request = curl_init($auth_url);
curl_setopt($request, CURLOPT_HEADER , 0);
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
$auth_token = curl_exec ($request);
json_decode($auth_token);
curl_close($request);
echo $auth_token;
using (WebClient client = new WebClient())
{
    byte[] response =
    client.UploadValues("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/download_jewellery", new NameValueCollection()
    {
        { "access_token", token }, //PASS TOKEN NO
        { "page_no", 1 } //PASS PAGE NO
    });
    string result = System.Text.Encoding.UTF8.GetString(response);
    // RESOPNE JSON FORMAT
}
Using client As WebClient = New WebClient
    Dim response As Byte() = client.UploadValues("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/download_jewellery", New NameValueCollection() From {
    {"access_token", token},  ' PASS TOKEN NO
    {"page_no", 1}  ' PASS PAGE NO
})
Dim result As String = System.Text.Encoding.UTF8.GetString(response)
End Using
' RESOPNE JSON FORMAT

Uploading Diamond Price To Forevermark

Upload Images,Video,Card No,Inscription No,360view

Jewellery images,Video,Card No,Inscription No and 360view can upload from computer files or an spreadsheet, or, they can be uploaded manually on Forevermark.

Please choose a media to upload. Only JPG,JPEG,Zip and PNG format will be supported.Please choose your image with any of these format. Media name must contain Style No. ( For Example: StyleNo.jpg )

$fields = array(
    "access_token" => 'Token which generated from Login API ',
    "Shape_Type" => 'Round' // Round, Fancy
);
// files to upload
$filepath = 'DiamondPrice.xlsx'; // STOCK XLSX FILE PATH
$url = "https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/diamond_price";
$files = array( basename($filepath) => file_get_contents($filepath));
$curl = curl_init();
$boundary = uniqid();
$delimiter = '-------------'. $boundary;
$post_data = build_data_files($boundary, $fields, $files);

curl_setopt_array($curl, array (
    CURLOPT_URL => $url,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POST => 1,
    CURLOPT_POSTFIELDS => $post_data,
    CURLOPT_FOLLOWLOCATION => TRUE,
    CURLOPT_SSL_VERIFYPEER => FALSE,
    CURLOPT_HTTPHEADER => array (
    "Content-Type: multipart/form-data; boundary=". $delimiter,
    "Content-Length: ".strlen($post_data)
    ),
    CURLOPT_RETURNTRANSFER => 1,
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 3000,
));
$response = curl_exec($curl);
curl_close($curl);
var_dump($response);

function build_data_files ( $boundary , $fields, $files){
    $data = '';
    $eol = "\r\n";
    $delimiter = '-------------' . $boundary;
    foreach ($fields as $name => $content){
        $data .= "--" . $delimiter . $eol
        . 'Content-Disposition: form-data; name="' . $name . "\"".$eol.$eol
        . $content . $eol;
    }
    foreach ($files as $name => $content) {
        $data .= "--" . $delimiter . $eol
        . 'Content-Disposition: form-data; name="upload_file"; filename="' . $name . '"' . $eol
        . 'Content-Transfer-Encoding: binary'. $eol;
        $data .= $eol;
        $data .= $content . $eol;
    }
    $data .= "--" . $delimiter . "--". $eol;
    return $data;
}
using (WebClient client = new WebClient())
{
    client.Encoding = Encoding.UTF8;
    NameValueCollection parameters = new NameValueCollection();
    parameters.Add("access_token", token); // PASS TOKEN NO
    parameters.Add("Shape_Type", " Round");// SHAPE TYPE : Round, Fancy
    client.QueryString = parameters;
    var responseBytes = client.UploadFile("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/diamond_price", "FILE PATH");
    string result = Encoding.ASCII.GetString(responseBytes);
    JavaScriptSerializer js = new JavaScriptSerializer();
    dynamic d = js.Deserialize<dynamic>(result);
    try
    {
        if (d["status"] == "1")
        {
            MessageBox.Show("UPLOAD DONE...");
        }
    }
    catch (Exception)
    {
        MessageBox.Show(result.ToString());
    }
}
Using client As WebClient = New WebClient
    client.Encoding = Encoding.UTF8
    Dim parameters As New NameValueCollection()
    parameters.Add("access_token", token)  'PASS TOKEN NO
    parameters.Add("Shape_Type", "Round")  'SHAPE TYPE : Round, Fancy
    client.QueryString = parameters
    Dim responseBytes = client.UploadFile("https://thefmxindia.com/service/NnV7dV5qC2hlBgFYaXLh/diamond_price", "Round / Fancy")
    Dim result As String = Encoding.ASCII.GetString(responseBytes)
    Dim js As JavaScriptSerializer = New JavaScriptSerializer()
    Dim d As Object = js.Deserialize(Of Object)(result)
    Try
    If (d("status") = "1") Then
    MessageBox.Show("UPLOAD DONE...");
    End If
    Catch ex As Exception
    MessageBox.Show(result.ToString())
    End Try
End Using

Preparing Your Stock File For Upload

This page is a reference to the fields and values you can use in XLS files containing your stock listings that you want to upload to Forevermark. The first row should contain the field headers.

Recognized Forevermark fields:
Main diamond details StockNo#, Diamond Location ,Shape, Size, Color, Clarity, Polish, Symmetry, Cut, Fluorescence, Measurements
Prices Price Per Carat, Discount, Final Amount
location and availability Country, Availability
Additional diamond details Fancy Color, Fancy Color Intensity, Fancy Color Overtone, Depth %, Table %, Girdle %, Culet, Crown Height, Crown Angle, Pavilion Height, Pavilion Angle, Eye Clean, Report Comment, Supplier Comment, Star Length, Shade, Key To Symbols, Heart and Arrow, Ratio, Certificate, Video Link, Grading Number
Forevermark accepted values:
Field name Acceptable alternate field names Acceptable field values
Stock ID Stock ID * Enter your inventory stock number.
Availability Availability Available,Memo
Diamond Location Diamond Location Specify the physical location of the diamond
Shape Shape Round = Round, BR, ROUND, RBC, Round Brilliant, round, rbc, rd, RD
Princess = PRN, PR, PRIN, PN, MDSQB, SMB, PRINCESS, Princess, smb
Emerald = E, EM, EC, SQE, SQEM, SX, Emerald, EM, EMERALD, em, Em, ec, Square Emerald
Asscher = Asscher, A, CSS, CSSC, AC
Radiant= R, RAD, RA, RC, RDN, CRB, RCRB, Sq Radiant, SQR, CCSMB, RADIANT, Radiant, Square Radiant
Cushion = CB, Cushion Brilliant, C, CUX, CU, CMB, CUSH, CUS, RCRMB, CRC, CSC, CX, RCSB, SCMB, SCX, Cushion, CB, cushion, Cushion Modified Brilliant
Pear = P, PS, PSH, PB, PMB, PEAR, Pear, pb, ps, p, psh, pmb
Oval = O, OV, OMB, OB, OVAL, Oval, omb, Omb, o, ov
Marquise = MQB, M, MQ, MB, MARQUISE, Marquise, mqb, mq, m
Heart = H, HS, HT, MHRC, HB, HEART, Heart, hb, ht, hs, h
Baguette = Baguette, BAG, BG
Rose = Rose, RS, RRC
Other =Other, X, BAT
Weight Weight Enter .01-99.

* For parcels enter total carat weight up to two decimal points.
Color Color D, E, F, G, H, I, J, K, L, M, N, O-P, Q-R, S-T, U-V, W-X, Y-Z

* For fancy colors use the fancy color column.
Clarity Clarity FL, IF, VVS1, VVS2, VS1, VS2, SI1, SI2, SI3, I1, I2, I3

* For fancy colored stones that have no clarity, enter "N" for none.
Cut Cut I= Ideal,ID
EX = Excellent, X, EXC
VG = Very Good, V, V.Good
GD= Good ,G
FR = Fair, F
PR = Poor, P
Polish Polish I = Ideal,ID
EX = Excellent, X, EXC
VG = Very Good, V, V.Good
GD = Good ,G
FR = Fair, F
PR= Poor, P
Symmetry Symmetry I = Ideal,ID
EX = Excellent, X, EXC
VG = Very Good, V, V.Good
GD = Good ,G
FR = Fair, F
PR= Poor, P
Fluorescence Fluorescence VST = Very Strong ,FL4
STG = Strong ,ST ,FL3
MED = Medium ,FL2
FNT =Faint ,Negligible, FA, FL1
VSL = Very Slight, VSLG, VSLT
NON= None, No, FL0
INC Incription Number * Enter the inscription number of Forevermark.
GRD Grading Number * Enter the grading number of Forevermark.
Is Fancy Is Fancy Yes
No
Fancy Color Fancy Color Yellow, Pink, Blue, Red, Green, Purple, Orange, Violet, Gray, Black, Brown, Champagne, Chameleon, Cognac, White, Other
Fancy Color Overtone Fancy Overtone Yellow, Yellowwish, Pink, Pinkish, Blue, Bluish, Red, Redish, Green, Greenish, Purple, Purplish, Orange, Orangey, Violet, Violetish, Gray, Grayish, Black, Brown, Brownish, Champagne, Cognac, Chameleon, White, Other
Fancy Color Intensity Fancy Intensity Faint, Very Light, Light, Fancy Light, Fancy, Fancy Dark, Fancy Intense, Fancy Vivid, Fancy Deep
Measurements Measurements Example: 8.93 x 6.44 x 3.82
Depth % Depth Percentage Example: 62.4
* Give percentage with only one number after the decimal. Do not include % sign.
Table % Table Percentage Example: 60

* Give percentage in two digit form. Do not include % sign.
Ratio Ratio -
Crown Height Crown Height * Give percentage with only one number after the decimal. Do not include % sign.
Crown Angle Crown Angle * Give a value to the nearest 0.5 degree.
Pavilion Height Pavilion Height Example: 62.3

* Give a value to one decimal place.
Pavilion Angle Pavilion Angle Example: 62.3

* Give a value to one decimal place.
Heart and Arrow Heart and Arrow Yes
No
Eye Clean Eye Clean Yes
No
Girdle % Girdle Percentage * Must be a positive number. Do not include % sign.
Report Comment Report Comment * No more than 255 characters.
Supplier Comments Supplier Comments * Enter no more than 255 characters.
Key To Symbols Key To Symbols Bearding, Brown patch of color, Bruise, Cavity, Chip, Cleavage, Cloud, Crystal, Crystal Surface, Etch Channel, Extra Facet, Feather, Flux Remnant, Indented Natural, Internal Graining, Internal Inscription, Internal Laser Drilling, Knot, Laser Drill Hole, Manufacturing Remnant, Minor Details of Polish, Natural, Needle, No Inclusion, Pinpoint, Reflecting Surface Graining, Surface Graining, Twinning Wisp
Star Length Star Length  
Shade Shade None, White, Yellow, Brown, Green, Grey, Black, Pink, Blue, Mixed, Faint Brown, Faint Green, Other
Culet Culet EL = Extremely Large
VL = Very Large
L = Large
SL = Slightly Large
M = Medium
S = Small
VS = Very Small
N = None
Video Link Video Link Example: https://s3.ap-south-1.amazonaws.com/cvdhvideo/CARAT/VIDEO/106R20-2AF.html