Legacy API - Rapaport Price Lists
XML Web
To import the Rapaport Price List into your system, we recommend that you program your software to retrieve and import complete datasets of price lists or List Prices for specific shapes, sizes, color and clarities.
We advise that you schedule your software to automatically download the latest Price Lists at least once a week to maintain up-to-date prices.
Note: You can also retrieve a Rapaport List Price for a specific shape, size, color and clarity.
Authentication Code
This is the Login method used for XML services:
POST /webservices/prices/rapaportprices.asmx HTTP/1.1
Host: technet.rapaport.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
string
string
Get Price sheet
POST /webservices/prices/rapaportprices.asmx HTTP/1.1
Host: technet.rapaport.com
Content-Type: text/xml
Content-Length: 564
?xml version="1.0" encoding="utf-8"?>
Round
Get Price
POST /webservices/prices/rapaportprices.asmx HTTP/1.1
Host: technet.rapaport.com
Content-Type: text/xml
Content-Length: 630
round
1
D
vs1
console.log( 'Code is Poetry' );
JSON
- You can retrieve the Rapaport price sheets, price changes, and specific prices using JSON format.
- Each request and response has two sections: The ‘header’ and ‘body’.
- The header section contains metadata, such as your username and password in the request and the response contains the results.
- The body section contains the parameters and data that are sent and retrieved. The parameters differ per request and the corresponding response.
Usage:
- All data should be sent using POST.
- For authentication purposes, each request needs a username and password in the header section.
- All requests must go to a URL starting with HTTPS because you pass user credentials.
- Send request as Content-Type: application/x-www-form-urlencoded.
- URL-Encode the request
- Optional values can be omitted or left blank.
- The response always contains an ‘error_code’ field. Value 0 means the operation succeeded.
Each size range of diamonds has its own grid. For smaller sizes, the price grids refer to diamonds with color and clarity ranges. For larger diamonds, each color/clarity combination has a price. In the printed version and PDF files, all prices are in hundreds of U.S. dollars per carat.
In the electronic data files, the prices are the full dollar price per carat.
JSON Available values and formats
- username – string
- password – string
- shape – string – “round”, “pear” or “”
- size – decimal – e.g. 2.10
- color – string – “D”, “E”, “F”, “G”, “H”, “I”, “J”, “K”, “L”, “M”, “N”.
- clarity – string – “IF”, “VVS1”, “VVS2”, “VS1”, “VS2”, “SI1”, “SI2”, “SI3”, “I1”, “I2”, “I3”
- dates will be in YYYY-MM-DD format
Required Field
Code
Shape: Select the round or the pear price list
Size: Select the corresponding size range on the price list.
Color: Select the row with the corresponding color.
Clarity: Select the corresponding column for your clarity.
IMPORTANT: For Price sheet and Price changes You only need the shape Field.
POST /HTTP/JSON/Prices/GetPriceSheet.aspx HTTP/1.1
Host: technet.rapaport.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 148
{
"request": {
"header": {
"username": "",
"password": ""
},
"body": {
'shape' : 'round',
'size' : 2.10,
'color' : 'E',
'clarity' : 'VS2'
}
}
}
Price-Response (Round)
[
{
"shape": "Round",
"low_size": 0.01,
"high_size": 0.03,
"color": "d",
"clarity": "if",
"caratprice": "830.0000",
"date": "09/15/2023 00:00:00"
},
{
"shape": "Round",
"low_size": 0.01,
"high_size": 0.03,
"color": "d",
"clarity": "vvs1",
"caratprice": "830.0000",
"date": "09/15/2023 00:00:00"
},
{
"shape": "Round",
"low_size": 0.01,
"high_size": 0.03,
"color": "d",
"clarity": "vvs2",
"caratprice": "830.0000",
"date": "09/15/2023 00:00:00"
},
]
Price-Response (Pear)
[
{
"shape": "pear",
"low_size": 0.01,
"high_size": 0.03,
"color": "d",
"clarity": "if",
"caratprice": "830.0000",
"date": "09/15/2023 00:00:00"
},
{
"shape": "pear",
"low_size": 0.01,
"high_size": 0.03,
"color": "d",
"clarity": "vvs1",
"caratprice": "830.0000",
"date": "09/15/2023 00:00:00"
},
{
"shape": "pear ",
"low_size": 0.01,
"high_size": 0.03,
"color": "d",
"clarity": "vvs2",
"caratprice": "830.0000",
"date": "09/15/2023 00:00:00"
},
]
More Sample Codes
HTTP Post with WebRequest (C#)
string URL = "FILE_URL_PATH";
WebRequest webRequest = WebRequest.Create(URL);
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
Stream reqStream = webRequest.GetRequestStream();
string postData = "username=myusername&password=mypassword";
byte[] postArray = Encoding.ASCII.GetBytes(postData);
reqStream.Write(postArray, 0, postArray.Length);
reqStream.Close();
StreamReader sr = new StreamReader(webRequest.GetResponse().GetResponseStream());
string Result = sr.ReadToEnd();
HTTP POST with WebClient
string URL = "FILE_URL_PATH";
WebClient webClient = new WebClient();
System.Collections.Specialized.NameValueCollection formData = new
System.Collections.Specialized.NameValueCollection();
formData["Username"] = "myusername";
formData["Password"] = "mypassword";
byte[] responseBytes = webClient.UploadValues(URL, "POST", formData);
string Result = Encoding.UTF8.GetString(responseBytes);
Get Price
{
"response": {
"header": {
"error_code": 0,
"error_message": ""
},
"body": {
"shape": "round",
"low_size": 2.00,
"high_size": 2.99,
"color": "E",
"clarity": "VS2",
"caratprice": 17000,
"date": "2010-12-31"
}
}
}
Get Price Sheet
{
"response": {
"header": {
"error_code": 0,
"error_message": ""
},
"body": {
"price": [
{
"shape": "round",
"low_size": 0.01,
"high_size": 0.03,
"color": "D",
"clarity": "IF",
"caratprice": 860,
"date": "2010-12-31"
} ,
]
}
}
}
Get Price Sheet Changes
{
"response": {
"header": {
"error_code": 0,
"error_message": ""
},
"body": {
"pricechange": [
{
"shape": "pear",
"low_size": 0.01,
"high_size": 0.03,
"color": "D",
"clarity": "IF",
"caratprice": 860,
"date": "2010-12-31",
"old_caratprice": 850,
"old_date": "2010-12-24"
} ,
]
}
}
}
Get Price Sheet Info
{
"response": {
"header": {
"error_code": 0,
"error_message": ""
},
"body": {
"last_price_publication_date": "2014-06-26",
"total_price_changes": 4,
"round_price_changes": 2,
"pear_price_changes": 2
}
}
Java
package com.rapaport.technet.webservices;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
public final class WebServiceCodeSample {
private static final String TECHNET_NAMESPACE_PREFIX = "technet";
private static final String WEBSERVICE_SECURE_URL =
"https://technet.rapaport.com/webservices/prices/rapaportprices.asmx";
private static final String WEBSERVICE_INSECURE_URL =
"http://technet.rapaport.com/webservices/prices/rapaportprices.asmx";
private enum Shapes {
ROUND("Round"), PEAR("Pear");
private final String enumString;
private Shapes(final String enumString) {
this.enumString = enumString;
}
};
public static void main(String[] args) throws Exception {
final WebServiceCodeSample webServiceCodeSample = new WebServiceCodeSample();
final String authenticationTicket = webServiceCodeSample.login("username", "password");
webServiceCodeSample.getPrice(authenticationTicket, "Round", 0.4F, "D", "VS1");
webServiceCodeSample.getPriceSheet(authenticationTicket, Shapes.ROUND);
}
/**
* Get the login token
*
* @param username
* @param password
* @return The authentication ticket
* @throws SOAPException
*/
private String login( final String username, final String password) throws SOAPException {
final SOAPMessage soapMessage = getSoapMessage();
final SOAPBody soapBody = soapMessage.getSOAPBody();
final SOAPElement loginElement = soapBody.addChildElement("Login", TECHNET_NAMESPACE_PREFIX);
loginElement.addChildElement("Username", TECHNET_NAMESPACE_PREFIX).addTextNode(username);
loginElement.addChildElement("Password", TECHNET_NAMESPACE_PREFIX).addTextNode(password);
soapMessage.saveChanges();
final SOAPConnection soapConnection = getSoapConnection();
final SOAPMessage soapMessageReply = soapConnection.call(soapMessage,WEBSERVICE_SECURE_URL);
final String textContent = soapMessageReply.getSOAPHeader().getFirstChild().getTextContent();
soapConnection.close();
return textContent;
}
/**
* Returns the price
*
* @param authenticationTicket
* @param shape
* @param size
* @param color
* @param clarity
* @throws SOAPException
*/
private void getPrice( final String authenticationTicket, final String shape, final float size, final String color,
final String clarity) throws SOAPException {
final SOAPMessage soapMessage = getSoapMessage();
addAuthenticationTicket(authenticationTicket, soapMessage);
final SOAPBody soapBody = soapMessage.getSOAPBody();
final SOAPElement getPriceElement = soapBody.addChildElement("GetPrice", TECHNET_NAMESPACE_PREFIX);
getPriceElement.addChildElement("shape", TECHNET_NAMESPACE_PREFIX).addTextNode(shape);
getPriceElement.addChildElement("size", TECHNET_NAMESPACE_PREFIX).addTextNode(String.valueOf(size));
getPriceElement.addChildElement("color", TECHNET_NAMESPACE_PREFIX).addTextNode(color);
getPriceElement.addChildElement("clarity", TECHNET_NAMESPACE_PREFIX).addTextNode(clarity);
soapMessage.saveChanges();
final SOAPConnection soapConnection = getSoapConnection();
final SOAPMessage soapMessageReply = soapConnection.call(soapMessage,WEBSERVICE_INSECURE_URL);
final SOAPBody replyBody = soapMessageReply.getSOAPBody();
final Node getPriceResponse = replyBody.getFirstChild();
final Node getPriceResult = getPriceResponse.getFirstChild();
final NodeList childNodes = getPriceResult.getChildNodes();
final String replyShape = childNodes.item(0).getTextContent();
final String lowSize = childNodes.item(1).getTextContent();
// ... etc etc
// You can create a bean that will encompass all elements
soapConnection.close();
} /**
* Gets the price sheet
*
* @param authenticationTicket
* @param shapes
* @throws SOAPException
* @throws TransformerException
*/
private void getPriceSheet( final String authenticationTicket, final Shapes shapes)
throws SOAPException, TransformerException {
final SOAPMessage soapMessage = getSoapMessage();
addAuthenticationTicket(authenticationTicket, soapMessage);
final SOAPBody soapBody = soapMessage.getSOAPBody();
final SOAPElement getPriceSheetElement =
soapBody.addChildElement("GetPriceSheet", TECHNET_NAMESPACE_PREFIX);
getPriceSheetElement.addChildElement(
"shape", TECHNET_NAMESPACE_PREFIX).addTextNode(shapes.enumString);
soapMessage.saveChanges();
final SOAPConnection soapConnection = getSoapConnection();
final SOAPMessage soapMessageReply = soapConnection.call(soapMessage, WEBSERVICE_INSECURE_URL);
// this will print out the result
// Create transformer
final TransformerFactory tff = TransformerFactory.newInstance();
final Transformer tf = tff.newTransformer();
// Get reply content
final Source sc = soapMessageReply.getSOAPPart().getContent();
// Set output transformation
final StreamResult result = new StreamResult(System.out);
tf.transform(sc, result);
System.out.println();
// Close connection
soapConnection.close();
}
/**
* Create a SOAP Connection
*
* @return
* @throws UnsupportedOperationException
* @throws SOAPException
*/
private SOAPConnection getSoapConnection() throws UnsupportedOperationException, SOAPException {
final SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
final SOAPConnection soapConnection = soapConnectionFactory.createConnection();
return soapConnection;
}
/**
* Create the SOAP Message
*
* @return
* @throws SOAPException
*/
private SOAPMessage getSoapMessage() throws SOAPException {
final MessageFactory messageFactory = MessageFactory.newInstance();
final SOAPMessage soapMessage = messageFactory.createMessage();
// Object for message parts
final SOAPPart soapPart = soapMessage.getSOAPPart();
final SOAPEnvelope envelope = soapPart.getEnvelope();
envelope.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema");
envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
envelope.addNamespaceDeclaration("enc", "http://schemas.xmlsoap.org/soap/encoding/");
envelope.addNamespaceDeclaration("env", "http://schemas.xmlsoap.org/soap/envelop/");
// add the technet namespace as "technet"
envelope.addNamespaceDeclaration(TECHNET_NAMESPACE_PREFIX, "http://technet.rapaport.com/");
envelope.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");
return soapMessage;
}
private void addAuthenticationTicket( final String authenticationTicket, final SOAPMessage soapMessage)
throws SOAPException {
final SOAPHeader header = soapMessage.getSOAPHeader();
final SOAPElement authenticationTicketHeader =
header.addChildElement("AuthenticationTicketHeader", TECHNET_NAMESPACE_PREFIX);
authenticationTicketHeader.addChildElement(
"Ticket", TECHNET_NAMESPACE_PREFIX).addTextNode(authenticationTicket);
}
}
PHP
//use nusoap library: http://sourceforge.net/projects/nusoap/
//tested with php 5, nusoap version 0.9.5
require_once('lib/nusoap.php');
//NOTE: both parameters and values are case sensitve!
//NOTE: the internal php class SoapClient does not work with named parameters and SOAP headers
//prepare soap request to Rapaport:
$rap_soapUrl = "https://technet.rapaport.com/webservices/prices/rapaportprices.asmx?wsdl";
$soap_Client = new nusoap_client($rap_soapUrl, 'wsdl');
$rap_credentials['Username'] = "loginname";
$rap_credentials['Password'] = "yourpassword";
//do login, and save authentication ticket for further use:
$result = $soap_Client->call('Login', $rap_credentials);
$rap_auth_ticket = $soap_Client->getHeaders();
//get complete price sheet, and save as a file (call this both for Round and Pear):
$paramsB["shape"] = "Round";
$soap_Client->setHeaders($rap_auth_ticket);
$result = $soap_Client->call('GetPriceSheet', $paramsB);
$file=fopen("c:\\temp\\round_prices.csv","w+") or exit("Unable to open file!");
for ($i=0; $i
{
$curLine = "";
$curLine .= $result['GetPriceSheetResult']['!Date'];
$curLine .= "," . $result['GetPriceSheetResult']['!Shape'];
$curLine .= "," . $result['GetPriceSheetResult']['Prices']['diffgram']['NewDataSet']['Table'][$i]['LowSize'];
$curLine .= "," . $result['GetPriceSheetResult']['Prices']['diffgram']['NewDataSet']['Table'][$i]['LowSize'];
$curLine .= "," . $result['GetPriceSheetResult']['Prices']['diffgram']['NewDataSet']['Table'][$i]['Color'];
$curLine .= "," . $result['GetPriceSheetResult']['Prices']['diffgram']['NewDataSet']['Table'][$i]['Clarity'];
$curLine .= "," . $result['GetPriceSheetResult']['Prices']['diffgram']['NewDataSet']['Table'][$i]['Price'];
fwrite($file, $curLine.PHP_EOL);
}
fclose($file);
?>
PHP: Single Price List
call('Login', $rap_credentials);
$rap_auth_ticket = $soap_Client->getHeaders();
//get price for single diamond
$paramsA["shape"] = "round";
$paramsA["size"] = "1.11";
$paramsA["color"] = "F";
$paramsA["clarity"] = "vs1";
$soap_Client->setHeaders($rap_auth_ticket);
$result = $soap_Client->call('GetPrice', $paramsA);
echo $result['GetPriceResult']['price'];
?>
VDB
Dim strPost As String
Dim objHTTP, replyTXT As String
Dim AuthenticationTicket As String
AuthenticationTicket = ""
Set objHTTP = CreateObject("Msxml2.ServerXMLHTTP")
strPost = "https://technet.rapaport.com/HTTP/Authenticate.aspx"
'Get authentication ticket:
objHTTP.Open "POST", strPost, False
Call objHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
objHTTP.send ("Username=USERNAME&Password=PASSWORD")
replyTXT = objHTTP.responseText
If objHTTP.Status = "200" Then 'success
AuthenticationTicket = replyTXT
Else
'authentication failed, you need to deal with this.
AuthenticationTicket = ""
End If
'save files:
Dim PriceSheetURL As String
Dim PriceSheetCSV As String
Dim iFileNumber As Integer
'rounds:
PriceSheetURL = "http://technet.rapaport.com/HTTP/Prices/CSV2_Round.aspx"
PriceSheetURL = PriceSheetURL & "?ticket=" & AuthenticationTicket
objHTTP.Open "GET", PriceSheetURL, False
objHTTP.send
If objHTTP.Status = "200" Then
'save the file:
PriceSheetCSV = objHTTP.responseText
iFileNumber = FreeFile
Open "C:\Temp\Rounds.csv" For Output As #iFileNumber
Print #iFileNumber, PriceSheetCSV
Close #iFileNumber
End If
'pears:
PriceSheetURL = "http://technet.rapaport.com/HTTP/Prices/CSV2_Pear.aspx"
PriceSheetURL = PriceSheetURL & "?ticket=" & AuthenticationTicket
objHTTP.Open "GET", PriceSheetURL, False
objHTTP.send
If objHTTP.Status = "200" Then
'save the file:
PriceSheetCSV = objHTTP.responseText
iFileNumber = FreeFile
Open "C:\Temp\Pear.csv" For Output As #iFileNumber
Print #iFileNumber, PriceSheetCSV
Close #iFileNumber
End If
Linux Scrips
# Wget must be version 1.10.2 or higher to support the "--post-data"
# If your login / password contain any special characters, you must url-encode it.
command./
/LOGIN=myraplogin
PASSWD=myrappasswd
# Or ask if running the script manually and no login and password is provided
[ "$LOGIN" -a "$PASSWD" ] || {
echo -n " Enter Rapnet login: "
read LOGIN
echo -n "Enter Rapnet password: "
read PASSWD
}
umask 000
error() {
echo -e "\007$*"
echo "Press Enter to continue"
read scrap
exit
}
wget --post-data="username=$LOGIN&password=$PASSWD" -O /tmp/round.csv "https://technet.rapaport.com/HTTP/Prices/CSV2_Round.aspx"
wget --post-data="username=$LOGIN&password=$PASSWD" -O /tmp/pear.csv "https://technet.rapaport.com/HTTP/Prices/CSV2_Pear.aspx"/
ColdFusion