Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 87 Next »


Overview

Chewatch WebService API provides an easy and robust way of getting data from Chemwatch based on parameters selected in a request. It exposes a simple to use REST interface that can be implemented in any programming language capable of working with Web. It also exposes more sophisticated native .NET SOAP interface with WSDL (preferred method for .NET programming).

Chemwatch WebService API has all the required functions to do the following operations:

  • Search Chemicals by Name, Synonym, CAS or internal ID (Chemwatch Number: CW No)
  • Retrieve (M)SDS data-points on a selected chemical (Between 30 and 500 (M)SDS end-points available, depending on the type of record)
  • Retrieve Regulatory data-points on a selected chemical (up to 6,000 end-points available, depending on the chemical)
  • Retrieve documents in PDF format (one of many selected types of documents including SDS, Label(s), MINI-Reports, etc.).

Chemwatch API is the most efficient method of integrating extensive chemical data and documents into ERP systems, laboratory systems, websites, online stores, and custom software platforms with minimal effort.

Authentication

There are two ways of authenticating to use the servcies:

  1. The recommended approach is to set up and use API secret (can be requested from it@chemwatch.net). Please note that the secret is user-dependend. All user settings will apply to the output. The header that has to be set to the secret is named "x-api-key". Simply pass it within a call to a method and the service will authenticate you automatically.
  2. Manual handling of session cookie by calling auth() or authentication() methods. The cookie should then be passwed in subsequent calls to identify the session. This approach wil be good when you need to authenticate once and them make a big number of calls (like calls to update many documents or data sets).

REST

Service URL

Note: For SOAP and WSDL please check further.

Requests

The Chemwatch Web API is based on REST principles: data resources are accessed via standard HTTP requests to an API endpoint.

All requests to the API require authentication. Authentication request, if completed successfully, provide a session cookie that should be attached to all subsequent requests (for more information see below).

Responses

All data is received as XML or JSON object.

Response HTTP Status Codes

Status CodeDescription
200SUCCESS: The request has succeeded. The client can read the result of the request in the body of the response.
400

Bad Request. The request could not be understood by the server due to malformed syntax. The message body will contain more information.

401Unauthorized - The request requires user authentication.
429Limit is exceeded -
500Internal Server Error.


Error Details

Unsuccessful responses return information about the error as an XML (or JSON) object containing the following information:

KeyValue TypeValue Description
Code
integerError code
Message
stringA short description of the cause/description of the error.

EXAMPLE 1:

XML Error Sample
HTTP/1.1 401 Unauthorized
Cache-Control: private
Content-Length: 50
Content-Type: application/xml

<Error xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<Code>401</Code>
	<Message>User is not authenticated</Message>
</Error>

EXAMPLE 2:

JSON Error Sample
HTTP/1.1 401 Unauthorized
Cache-Control: private
Content-Length: 50
Content-Type: application/json

{
	"Code":401,
	"Message":"User is not authenticated"
}


Operations

Authentication


Please note that in most cases you simply need to pass a secret code via header "x-api-key". The service will authenticate the user associated with the secret for you.


Headers
Content-Typeapplication/json
x-api-key<secret key>


Method "authenticate"

Used to authenticate the "User" and obtain the session cookie to be attached to all subsequent requests. 

URL:

XMLGET /api/v1/authenticate
JSONGET /api/v1/json/authenticate

Request Parameters:

Query parameterData TypeRequiredDescription
domainstringyesdomain name
loginstringyesuser login
passwordstringyespassword

Request Sample

GET  /api/v1/authenticate?domain=xxx&login=xxx&password=xxx

All requests to the API require authentication. Authentication requests, if completed successfully, provides a session cookie that should be attached to all subsequent requests.


Response Format:

On success, the response body contains AuthResponse object in XML (JSON) format. Also the response contains cookie with a security token.

XML Response Sample
HTTP/1.1 200 OK
Content-Length: 65
Set-Cookie: Login=FB6615F554E168CE8ED0750B4E39735EE34FF7CE; expires=Sat, 11-Jul-2015 12:39:38 GMT; path=/
Content-Type: application/xml; charset=utf-8

<AuthResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<Code>200</Code>
	<Message>Authentication is successfully completed</Message>
</AuthResponse>
JSON Response Sample
HTTP/1.1 200 OK
Content-Length: 65
Set-Cookie: Login=FB6615F554E168CE8ED0750B4E39735EE34FF7CE; expires=Sat, 11-Jul-2015 12:39:38 GMT; path=/
Content-Type: application/json; charset=utf-8

{
	"Code":200,
	"Message":"Authentication is successfully completed"
}



Following codes are possible (for AuthResponse object):

CodeMessage
200Authentication is successfully completed
241There is no such user
242Password is incorrect
243User is locked
244Subscription has expired
245User password has expired

Method "auth"

Used to authenticate the "User" and obtain the session cookie to be attached to all subsequent requests. 

URL:

XML

POST /api/v1/auth

Http header: Content-Type: application/xml; charset=utf-8
JSON

POST /api/v1/json/auth

Http header: Content-Type: application/json; charset=utf-8


Request Sample

POST   /api/v1/auth

Content-Type: application/xml; charset=utf-8

Request body

XML Request body
<AuthRequest>
    <Domain>xxx</Domain>
    <Login>xxx</Login>
    <Password>xxx</Password>
</AuthRequest>


Request JSON Sample

POST   /api/v1/json/auth

Content-Type: application/json; charset=utf-8

Request body

JSON Request body
{
  "domain": "xxx",
  "login": "xxx",
  "password": "xxx"
}

All requests to the API require authentication. Authentication requests, if completed successfully, provides a session cookie that should be attached to all subsequent requests.


Response Format:

On success, the response body contains AuthResponse object in XML (JSON) format. Also the response contains cookie with a security token.

XML Response Sample
HTTP/1.1 200 OK
Content-Length: 65
Set-Cookie: Login=FB6615F554E168CE8ED0750B4E39735EE34FF7CE; expires=Sat, 11-Jul-2015 12:39:38 GMT; path=/
Content-Type: application/xml; charset=utf-8

<AuthResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<Code>200</Code>
	<Message>Authentication is successfully completed</Message>
</AuthResponse>
JSON Response Sample
HTTP/1.1 200 OK
Content-Length: 65
Set-Cookie: Login=FB6615F554E168CE8ED0750B4E39735EE34FF7CE; expires=Sat, 11-Jul-2015 12:39:38 GMT; path=/
Content-Type: application/json; charset=utf-8

{
	"Code":200,
	"Message":"Authentication is successfully completed"
}

Method: Get Countries - "countries"

Used to obtain the list of "country" parameters.

"Country" value needs to be provided with requests for Data and Documents to ensure the correct regulatory information, or, Document Format is provided.

URL:

XMLGET /api/v1/countries
JSON

GET /api/v1/json/countries

Request Parameters:

Query parameterData TypeRequiredDescription
msdsOnlyboolnoIf true - returns only MSDS countries

Request Sample

GET /api/v1/countries 

GET  /api/v1/countries?msdsOnly=true

Response Format:

Response body contains an array of Country objects in XML (or JSON) format

XML Response Sample
<ArrayOfCountry xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<Country>
		<Code>ARG</Code>
		<Id>81</Id>
		<Name>Argentina</Name>
	</Country>
...
</ArrayOfCountry>
JSON Response Sample
[
	{
		"Code":"ARG",
		"Id":"81",
		"Name":"Argentina"
	},
	...
]


Method: Get Languages - "languages"

Used to obtain the list of "Language" parameters.

"Language" value needs to be provided with requests for Data and Documents to ensure that the document(s) or data requested is "served" in the right language. 

URL:

XMLGET /api/v1/languages
JSONGET /api/v1/json/languages

Request Parameters:

Query parameterData TypeRequiredDescription
msdsOnlyboolnoIf true - returns only MSDS countries

Request Sample

GET  /api/v1/languages 

GET  /api/v1/languages?msdsOnly=true


Response Format:

Response body contains an array of Language objects in XML (or JSON) format

XML Response Sample
<ArrayOfLanguage xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<Language>
		<Code>AR</Code>
		<Id>340719</Id>
		<Name>Arabic</Name>
	</Language>
	...
</ArrayOfLanguage>
JSON Response Sample
[
	{
		"Code":"AR",
		"Id":"340719",
		"Name":"Arabic"
	},
	...
]


Method: Search Materials - "materials"

Used to search the Chemwatch database Materials/Chemicals. Various search parameters supported.

Note: UserPartNo can be used for search.

URL:

XMLGET /api/v1/materials
JSONGET /api/v1/json/materials 

Request Parameters:

Query parameterData TypeRequiredDescription
namestringnoMaterial name search parameter
languageIdintegernoLanguage
casstringnoCAS search parameter
cwNostringnoCwNumber search parameter
gidstringnoGID search parameter
userPartNumberstringnoUser's Part Number parameter
folderIdintegernoFolder
ownboolnoSearched Own collection is set to true. If set to false searched in Full database.
sortFieldstringno

Sorting by field:

"soursetype" - source tyoe cane be primary or secondary,

"name" - default value

sortDirectionstringno

Possible values:

asc   - sorting by ascending

desc - sorting by descending

pageNumberintegernoindicates page number
pageSizeintegernoindicates count of items per page

Request Sample

GET  /api/v1/materials?name=acetone&pageNumber=1&pageSize=15
  • Own search will be performed if own parameter is not specified
  • 'Search in full DB' privilege is required if Full search is performed


Response Format:

Response body contains ListResult of Material object in XML (or JSON) format

XML Response Sample
<ListResultOfMaterial xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<PageCount>1</PageCount>
	<PageNumber>1</PageNumber>
	<PageSize>15</PageSize>
	<RowCount>3</RowCount>
	<Rows>
		<Material>
			<Cas>67-64-1</Cas>
			<CwNo>1090</CwNo>
			<Id>4200280</Id>
			<IsGold>false</IsGold>
			<MaterialData>
				<Field>
					<Name>CW</Name>
					<Value>1090</Value>
				</Field>
				<Field>
					<Name>NAME</Name>
					<Value>acetone</Value>
				</Field>
				...
			</MaterialData>
			<Name>acetone</Name>
		</Material>
		...
	</Rows>
</ListResultOfMaterial>


{
	"PageCount":1,
	"PageNumber":1,
	"PageSize":15,
	"RowCount":3,
	"Rows":[
			{
				"Cas":"67-64-1",
				"CwNo":"1090",
				"Id":4200280,
				"IsGold":false,
				"MaterialData":[
					{"Name":"CW", "Value":"1090"},
					{"Name":"NAME","Value":"acetone"},
					...
				],
				"Name":"acetone"
			},
			...
	]
}
{
  "pageCount": 2,
  "rowCount": 18,
  "pageNumber": 1,
  "pageSize": 10,
  "rows": [
    {
      "materialId": "4200280",
      "groupId": "CW",
      "vendorId": -1,
      "documentType": "ms",
      "countryCode": "ANY",
      "languageCode": "ANY",
      "issueDate": "2016-02-25T00:00:00",
      "fileName": "",
      "cwNumber": "1090",
      "externalUrl": "http://jr.chemwatch.net/cwws/MaterialService.svc/GetMsdsByExternalUrl?mi=4200280&cn=ANY&ln=ANY&fn=&cwn=1090&ui=72190&di=17548&ts=636437314781062845&v=&hc=69FEFE23A5009E59239400E1C27E1A07",
      "sourceType": "p",
      "isCWGold": true,
      "isWeWrite": false,
      "isPrivate": false,
      "isChemwatch": true,
      "isAvailable": true,
      "isLatest": true,
      "groupName": "ChemWatch",
      "docNo": "a1090",
      "countryId": 0,
      "languageId": 0,
      "preferredVendor": "ChemWatch"
    },
    {
      "materialId": "4897766",
      "groupId": "SIGMA",
      "vendorId": 4200002922,
      "documentType": "ms",
      "countryCode": "Netherlands",
      "languageCode": "Dutch",
      "issueDate": "2007-02-15T00:00:00",
      "fileName": "pd6192754.txt.gz",
      "cwNumber": "31257-5",
      "externalUrl": "http://jr.chemwatch.net/cwws/DocumentService.svc/GetDocumentContentByExternalUrl?mi=4897766&gid=SIGMA&cn=118&ln=340711&fn=pd6192754.txt.gz&cwn=31257-5&ui=72190&di=17548&ts=636437314781218843&v=&hc=C59678AEC87755438BB856AA1F45E089",
      "sourceType": "p",
      "isCWGold": false,
      "isWeWrite": false,
      "isPrivate": false,
      "isChemwatch": false,
      "isAvailable": true,
      "isLatest": true,
      "groupName": "Sigma-Aldrich",
      "docNo": "6192754",
      "countryId": 118,
      "languageId": 340711,
      "preferredVendor": "Sigma-Aldrich (Merck)"
    },
    {
      "materialId": "4897766",
      "groupId": "SIGMA",
      "vendorId": 5591,
      "documentType": "ms",
      "countryCode": "United States",
      "languageCode": "English",
      "issueDate": "2014-07-01T00:00:00",
      "fileName": "pd12515147.pdf",
      "cwNumber": "31257-5",
      "externalUrl": "http://jr.chemwatch.net/cwws/DocumentService.svc/GetDocumentContentByExternalUrl?mi=4897766&gid=SIGMA&cn=140&ln=340700&fn=pd12515147.pdf&cwn=31257-5&ui=72190&di=17548&ts=636437314781218843&v=&hc=FC5425874B20A8B00C9BA9BE1486164D",
      "sourceType": "p",
      "isCWGold": false,
      "isWeWrite": false,
      "isPrivate": false,
      "isChemwatch": false,
      "isAvailable": true,
      "isLatest": true,
      "groupName": "Sigma-Aldrich",
      "docNo": "12515147",
      "countryId": 140,
      "languageId": 340700,
      "preferredVendor": "Sigma Aldrich (as MiliporeSigma, Merck)"
    },
    {
      "materialId": "4897766",
      "groupId": "SIGMA",
      "vendorId": 5594,
      "documentType": "ms",
      "countryCode": "Germany",
      "languageCode": "English",
      "issueDate": "2012-12-04T00:00:00",
      "fileName": "pd12897617.pdf",
      "cwNumber": "31257-5",
      "externalUrl": "http://jr.chemwatch.net/cwws/DocumentService.svc/GetDocumentContentByExternalUrl?mi=4897766&gid=SIGMA&cn=96&ln=340700&fn=pd12897617.pdf&cwn=31257-5&ui=72190&di=17548&ts=636437314781218843&v=&hc=08E8E8F2F75CA9E1169835F0074F7479",
      "sourceType": "p",
      "isCWGold": false,
      "isWeWrite": false,
      "isPrivate": false,
      "isChemwatch": false,
      "isAvailable": true,
      "isLatest": true,
      "groupName": "Sigma-Aldrich",
      "docNo": "12897617",
      "countryId": 96,
      "languageId": 340700,
      "preferredVendor": "Sigma-Aldrich (Merck)"
    },
    {
      "materialId": "4897766",
      "groupId": "SIGMA",
      "vendorId": 5607,
      "documentType": "ms",
      "countryCode": "Australia",
      "languageCode": "English",
      "issueDate": "2013-04-15T00:00:00",
      "fileName": "pd12685675.pdf",
      "cwNumber": "31257-5",
      "externalUrl": "http://jr.chemwatch.net/cwws/DocumentService.svc/GetDocumentContentByExternalUrl?mi=4897766&gid=SIGMA&cn=82&ln=340700&fn=pd12685675.pdf&cwn=31257-5&ui=72190&di=17548&ts=636437314781218843&v=&hc=E72303F2B250C12A13129AA266B43978",
      "sourceType": "p",
      "isCWGold": false,
      "isWeWrite": false,
      "isPrivate": false,
      "isChemwatch": false,
      "isAvailable": true,
      "isLatest": true,
      "groupName": "Sigma-Aldrich",
      "docNo": "12685675",
      "countryId": 82,
      "languageId": 340700,
      "preferredVendor": "Sigma-Aldrich (Merck)"
    },
    {
      "materialId": "4897766",
      "groupId": "SIGMA",
      "vendorId": 30763,
      "documentType": "ms",
      "countryCode": "Spain",
      "languageCode": "English",
      "issueDate": "2012-12-04T00:00:00",
      "fileName": "pd12897609.pdf",
      "cwNumber": "31257-5",
      "externalUrl": "http://jr.chemwatch.net/cwws/DocumentService.svc/GetDocumentContentByExternalUrl?mi=4897766&gid=SIGMA&cn=133&ln=340700&fn=pd12897609.pdf&cwn=31257-5&ui=72190&di=17548&ts=636437314781218843&v=&hc=2A425D4F47449D64C698611AECBFCAD4",
      "sourceType": "p",
      "isCWGold": false,
      "isWeWrite": false,
      "isPrivate": false,
      "isChemwatch": false,
      "isAvailable": true,
      "isLatest": true,
      "groupName": "Sigma-Aldrich",
      "docNo": "12897609",
      "countryId": 133,
      "languageId": 340700,
      "preferredVendor": "Sigma-Aldrich (Merck)"
    },
    {
      "materialId": "4897766",
      "groupId": "SIGMA",
      "vendorId": 18671,
      "documentType": "ms",
      "countryCode": "Switzerland",
      "languageCode": "English",
      "issueDate": "2012-12-04T00:00:00",
      "fileName": "pd12897618.pdf",
      "cwNumber": "31257-5",
      "externalUrl": "http://jr.chemwatch.net/cwws/DocumentService.svc/GetDocumentContentByExternalUrl?mi=4897766&gid=SIGMA&cn=135&ln=340700&fn=pd12897618.pdf&cwn=31257-5&ui=72190&di=17548&ts=636437314781218843&v=&hc=9CEA46130EF05D6F902370895420D4E3",
      "sourceType": "p",
      "isCWGold": false,
      "isWeWrite": false,
      "isPrivate": false,
      "isChemwatch": false,
      "isAvailable": true,
      "isLatest": false,
      "groupName": "Sigma-Aldrich",
      "docNo": "12897618",
      "countryId": 135,
      "languageId": 340700,
      "preferredVendor": "Sigma-Aldrich (Merck)"
    },
    {
      "materialId": "4897766",
      "groupId": "SIGMA",
      "vendorId": 33777,
      "documentType": "ms",
      "countryCode": "Canada",
      "languageCode": "English",
      "issueDate": "2014-08-18T00:00:00",
      "fileName": "pd12897611.pdf",
      "cwNumber": "31257-5",
      "externalUrl": "http://jr.chemwatch.net/cwws/DocumentService.svc/GetDocumentContentByExternalUrl?mi=4897766&gid=SIGMA&cn=86&ln=340700&fn=pd12897611.pdf&cwn=31257-5&ui=72190&di=17548&ts=636437314781218843&v=&hc=46A5014E6D9E0FFEF52238F9C6375370",
      "sourceType": "p",
      "isCWGold": false,
      "isWeWrite": false,
      "isPrivate": false,
      "isChemwatch": false,
      "isAvailable": true,
      "isLatest": true,
      "groupName": "Sigma-Aldrich",
      "docNo": "12897611",
      "countryId": 86,
      "languageId": 340700,
      "preferredVendor": "Sigma Aldrich (as MiliporeSigma, Merck)"
    },
    {
      "materialId": "4897766",
      "groupId": "SIGMA",
      "vendorId": 24961,
      "documentType": "ms",
      "countryCode": "Italy",
      "languageCode": "English",
      "issueDate": "2012-12-04T00:00:00",
      "fileName": "pd12897620.pdf",
      "cwNumber": "31257-5",
      "externalUrl": "http://jr.chemwatch.net/cwws/DocumentService.svc/GetDocumentContentByExternalUrl?mi=4897766&gid=SIGMA&cn=105&ln=340700&fn=pd12897620.pdf&cwn=31257-5&ui=72190&di=17548&ts=636437314781218843&v=&hc=C23E439D40143B76892356AE07FB7544",
      "sourceType": "p",
      "isCWGold": false,
      "isWeWrite": false,
      "isPrivate": false,
      "isChemwatch": false,
      "isAvailable": true,
      "isLatest": true,
      "groupName": "Sigma-Aldrich",
      "docNo": "12897620",
      "countryId": 105,
      "languageId": 340700,
      "preferredVendor": "Sigma-Aldrich (Merck)"
    },
    {
      "materialId": "4897766",
      "groupId": "SIGMA",
      "vendorId": 25489,
      "documentType": "ms",
      "countryCode": "Norway",
      "languageCode": "English",
      "issueDate": "2012-12-04T00:00:00",
      "fileName": "pd12897621.pdf",
      "cwNumber": "31257-5",
      "externalUrl": "http://jr.chemwatch.net/cwws/DocumentService.svc/GetDocumentContentByExternalUrl?mi=4897766&gid=SIGMA&cn=284&ln=340700&fn=pd12897621.pdf&cwn=31257-5&ui=72190&di=17548&ts=636437314781218843&v=&hc=72146D842EBC61E768BBFC5FE8F6E0D8",
      "sourceType": "p",
      "isCWGold": false,
      "isWeWrite": false,
      "isPrivate": false,
      "isChemwatch": false,
      "isAvailable": true,
      "isLatest": true,
      "groupName": "Sigma-Aldrich",
      "docNo": "12897621",
      "countryId": 284,
      "languageId": 340700,
      "preferredVendor": "Sigma-Aldrich (Merck)"
    }
  ]
}

Method: Get Own Materials - "ownmaterials"

Used to get own Materials. Page & Sort parameters supported.

URL:

XMLGET /api/v1/ownmaterials
JSONGET /api/v1/json/ownmaterials 

Request Parameters:

Query parameterData TypeRequiredDescription
viewTypestringno

Possible values:

material    - MaterialName mode,

preferred  - PreferredName mode,

catalog     - CatName mode

sortFieldstringno

Sorting by field:

"soursetype" - source tyoe cane be primary or secondary,

"name" - default value

sortDirectionstringno

Possible values:

asc   - sorting by ascending

desc - sorting by descending

pageNumberintegernoindicates page number
pageSizeintegernoindicates count of items per page

Request Sample

GET  /api/v1/ownmaterials?pageNumber=1&pageSize=15


Response Format:

Response body contains ListResult of Material object in XML (or JSON) format

XML Response Sample
<ListResultOfMaterial xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<PageCount>1</PageCount>
	<PageNumber>1</PageNumber>
	<PageSize>15</PageSize>
	<RowCount>3</RowCount>
	<Rows>
		<Material>
			<Cas>67-64-1</Cas>
			<CwNo>1090</CwNo>
			<Id>4200280</Id>
			<IsGold>false</IsGold>
			<MaterialData>
				<Field>
					<Name>CW</Name>
					<Value>1090</Value>
				</Field>
				<Field>
					<Name>NAME</Name>
					<Value>acetone</Value>
				</Field>
				...
			</MaterialData>
			<Name>acetone</Name>
		</Material>
		...
	</Rows>
</ListResultOfMaterial>
JSON Response Sample
{
	"PageCount":1,
	"PageNumber":1,
	"PageSize":15,
	"RowCount":3,
	"Rows":[
			{
				"Cas":"67-64-1",
				"CwNo":"1090",
				"Id":4200280,
				"IsGold":false,
				"MaterialData":[
					{"Name":"CW", "Value":"1090"},
					{"Name":"NAME","Value":"acetone"},
					...
				],
				"Name":"acetone"
			},
			...
	]
}

Method: Get CwNumbers by Cas - "cwnumbers"

In most cases, CAS Number (Chemical Abstracts Service  Number) is the "official" identifier for Pure Chemicals.

In most cases, Chemwatch Number (Chemwatch Chemical ID Number) corresponds to CAS one-to-one.

This Method provides the functionality to "get" the Chemwatch Number by passing a CAS number.

URL:

XMLGET /api/v1/cwnumbers
JSONGET /api/v1/json/cwnumbers 

Request Parameters:

Query parameterData TypeRequiredDescription
casstringyesCas number
showOwnboolnoshow cw numbers, which user has

Request Sample

GET  /api/v1/cwnumbers?cas=67-64-1 

GET  /api/v1/cwnumbers?cas=67-64-1&showOwn=true 

Response Format:

Response body contains an array of strings

XML Response Sample
<ArrayOfstring xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<string>1090</string>
	<string>7122729</string>
	<string>4896-40</string>
</ArrayOfstring>
JSON Response Sample
[
	"1090",
	"7122729",
	"4896-40"
]


Material Data Requests

Method (GET): Get Material Data - "materialsdata"

This Method is used to obtain a predefined collection of data-points using a single request. This means the method is good to obtain data resolved by Chemwatch number, and not appropriate for Vendor Extracted Data (another method called materialsvgddata should be used in this case).

Data Methods can be created and managed in the Chemwatch Method Builder (separate URL and instructions available). 

This Method is recommended where:

  • Large Collection of data points are required per request
  • Consistent collection of DP is required on an ongoing basis (e.g. GHS Label Data Method will return 15 end points required to populate a "label")

URL:

XMLGET /api/v1/materialsdata
JSONGET /api/v1/json/materialsdata
CSVGET /api/v1/csv/materialsdata
XLSGET /api/v1/xls/materialsdata
HTMLGET /api/v1/html/materialsdata

Request Parameters:

Query parameterData TypeRequiredDescription
idsstringyesComma separated CwNumbers (if parameter entityType is material) or CAS number (if parameter entityType is cas)
entityTypestringyes

Determines the type of previous parameter 'ids'.

Possible values:

material - means that 'ids' are CwNumbers

cas        - means that 'ids' are Cas Numbers

Galleria data fields will only respond to entitytype = CAS. They will appear as empty when called on entitytype = material.

methodNamestringyes (if dataPoints is missing)UserMethod name.
dataPointsstringyes (if methodName is missing)Comma separated DataPoint's names.
languageIdintegernoLanguage
countryIdintegernoCountry
saveTagsboolno
separatorstringno
downloadImagesboolnoAllows to download images
folderIdintegernoFolder
msdsFormatstringno

Msds Format.

Possible values: reach, local or ghs

Request Sample

GET   /api/v1/materialsdata?ids=123,67-64-1&entityType=cas&methodName=Material_Name
GET   /api/v1/materialsdata?ids=1114&entityType=Material&dataPoints=MaterialName,CWNumber


Response Format:

Response body contains an array of MaterialData objects in XML (JSON) format

XML Response Sample
<ArrayOfMaterialData xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<MaterialData>
		<Field>
			<Name>MaterialName</Name>
			<Value>ROCHELLE - PURE CHEM TEST</Value>
		</Field>
	</MaterialData>
	...
</ArrayOfMaterialData>
JSON Response Sample
[
	[
		{
			"Name":"MaterialName",
			"Value":"ROCHELLE - PURE CHEM TEST"
		}
	],
	...
]

Important! Following values should be sent as integer

  • Possible values of MsdsFormat: None = 0, Reach = 1, Local = 2, Ghs =3
  • Possible values of EntityType: Material = 1, Cas = 2

Method: Get material data-points - "datapoints"

This Method is typically used for instant requests for single or a few data points (AD-HOC requests). 


URL:

XMLGET /api/v1/datapoints
JSONGET /api/v1/json/datapoints

Request Parameters: no

Request Sample

 GET /api/v1/datapoints

Response Format:

Response body contains an array of DataPoinCategory objects in XML (JSON) format (field SubCategories is object of type DataPoinCategory)

XML Response Sample
<ArrayOfDataPointCategory xmlns="http://schemas.datacontract.org/2004/07/Chemwatch.API.Entities" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<DataPointCategory>
		<DataPoints>
			<DataPoint xmlns="">
				<Description>Ingredient 1</Description>
				<Id>307</Id>
				<Name>Ingredient1</Name>
			</DataPoint>
			...
		</DataPoints>
		<Name>Ingredients</Name>
		<SubCategories/>
	</DataPointCategory>
	...
</ArrayOfMaterialData>
JSON Response Sample
[
	{
		"DataPoints":[
					{
						"Description":"Ingredient 1",
						"Id":307,
						"Name":"Ingredient1"
					},
					 ...
		]
		"Name":"Ingredients",
		"SubCategories":[]
	}
	...
]


Method (GET): Get Material VGD Data - "materialsvgddata"

This Method is used to obtain a predefined collection of VGD using a single request.

Data Methods can be created and managed in the Chemwatch Method Builder (separate URL and instructions available).

Right now "materialsvgddata" method is reporting only the documents, which are in the user's folders


URL:

XMLGET /api/v1/materialsvgddata
JSONGET /api/v1/json/materialsvgddata 
CSVGET /api/v1/csv/materialsvgddata 
XLSGET /api/v1/xls/materialsvgddata 
HTMLGET /api/v1/html/materialsvgddata 

Request Parameters:

Query parameterData TypeRequiredDescription
docNumbersstringyesComma separated Document Numbers
methodNamestringyes (if dataPoints is missing)UserMethod name.
dataPointsstringyes (if methodName is missing)Comma separated DataPoint's names.
saveTagsboolno
separatorstringno
downloadImagesboolnoAllows to download images
msdsFormatstringno

Msds Format.

Possible values: reach, local or ghs

Request Sample

GET   /api/v1/materialsvgddata?docnumbers=11133975&methodName=Material_Name


Response Format:

Response body contains an array of MaterialData objects in XML (JSON) format

XML Response Sample
<ArrayOfMaterialData xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<MaterialData>
		<Field>
			<Name>MaterialName</Name>
			<Value>ROCHELLE - PURE CHEM TEST</Value>
		</Field>
	</MaterialData>
	...
</ArrayOfMaterialData>
JSON Response Sample
[
	[
		{
			"Name":"MaterialName",
			"Value":"ROCHELLE - PURE CHEM TEST"
		}
	],
	...
]



Method: Search Vendors - "vendors"

This method allow searching Vendors and Vendor Ids available in the system. Sometimes vendor ID can be used in the subsequent calls for data.

URL:

XMLGET /api/v1/vendors
JSONGET /api/v1/json/vendors 

Request Parameters:

Query parameterData TypeRequiredDescription
namestringyesVendor name
sortFieldstringno

Sorting by field:

"soursetype" - source tyoe cane be primary or secondary,

"name" - default value

sortDirectionstringno

Possible values:

asc   - sorting by ascending

desc - sorting by descending

pageNumberintegernoindicates page number
pageSizeintegernoindicates count of items per page

Request Sample

GET   /api/v1/vendors?name=merc

Response Format:

Response body contains ListResult of Vendor object in XML (JSON) format

XML Response Sample
<ListResultOfVendor xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<PageCount>32</PageCount>
	<PageNumber>1</PageNumber>
	<PageSize>10</PageSize>
	<RowCount>319</RowCount>
	<Rows>
		<Vendor>
			<City>Cabo PE</City>
			<Country>
				<Code>BRA</Code>
				<Id>85</Id>
				<Name>Brazil</Name>
			</Country>
			<Gid>PETROFLE</Gid>
			<Id>1785</Id>
			<Name>Petroflex Industria E Comercio</Name>
			<State/>
			<VendorGroupId>45360</VendorGroupId>
		</Vendor>
		...
	</Rows>
</ListResultOfVendor>
JSON Response Sample
{
	"PageCount":32,
	"PageNumber":1,
	"PageSize":10,
	"RowCount":319,
	"Rows":[
		{
			"City":"Cabo PE",
			"Country":{"Code":"BRA","Id":"85","Name":"Brazil"},
			"Gid":"PETROFLE",
			"Id":1785,
			"Name":"Petroflex Industria E Comercio",
			"State":"",
			"VendorGroupId":45360
		},
		...
	]
}


Document Requests

Get Documents - method "documents"

This Method is used to obtain a Vendor SDS from the Chemwatch Database.

URL:

XMLGET /api/v1/documents
JSONGET /api/v1/json/documents

Request Parameters:

Query parameterData TypeRequiredDescription
cwNostringyes Cw Number
gidstringnoGID search parameter
folderIdintegernoFolder
languageIdsinteger (comma separated)noComma separated Languges Ids
countryIdsinteger (comma separated)noComma separated Countries Ids
ownboolnoSearched Own collection is set to true. If set to false searched in Full database
sortFieldstringno

Sorting by field:

"soursetype" - source tyoe cane be primary or secondary,

"name" - default value

sortDirectionstringno

Possible values:

asc   - sorting by ascending

desc - sorting by descending

pageNumberintegernoindicates page number
pageSizeintegernoindicates count of items per page

Request Sample

GET /api/v1/documents?cwNo=1090

Response Format:

Response body contains ListResult of Document object in XML (JSON) format

XML Response Sample
<ListResultOfDocument xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<PageCount>194</PageCount>
	<PageNumber>1</PageNumber>
	<PageSize>10</PageSize>
	<RowCount>1936</RowCount>
	<Rows>
		<Document>
			<CWNumber>10019</CWNumber>
			<CountryCode>United States</CountryCode>
			<CountryId>140</CountryId>
			<DocNo>4624274</DocNo>
			<DocumentType>ms</DocumentType>
			<ExternalUrl>http://dev.chemwatch.net/CWWS.M3/DocumentService.svc/GetDocumentContentByExternalUrl...</ExternalUrl>
			<FileName>pd4624274.htm.gz</FileName>
			<FolderId i:nil="true"/>
			<GroupId>ALCANAL</GroupId>
			<GroupName>Alcan</GroupName>
			<IsAvailable>true</IsAvailable>
			<IsCWGold>false</IsCWGold>
			<IsChemwatch>false</IsChemwatch>
			<IsLatest>false</IsLatest>
			<IsPrivate>false</IsPrivate>
			<IsWeWrite>false</IsWeWrite>
			<IssueDate>1992-07-27T00:00:00</IssueDate>
			<LanguageCode>English</LanguageCode>
			<LanguageId>340700</LanguageId>
			<MaterialId>5566246</MaterialId>
			<PreferredVendor>Alcan</PreferredVendor>
			<SourceType>p</SourceType>
			<VendorId>4200000272</VendorId>
		</Document>
		...
	</Rows>
</ListResultOfDocument>
JSON Response Sample
{
	"PageCount":194,
	"PageNumber":1,
	"PageSize":10,
	"RowCount":1936,
	"Rows":[
		{
			"CWNumber":"10019",
			"CountryCode":"United States",
			"CountryId":140,
			"DocNo":"4624274",
			"DocumentType":"ms",
			"ExternalUrl":"http:\/\/dev.chemwatch.net\/CWWS.M3\/DocumentService.svc...",
			"FileName":"pd4624274.htm.gz",
			"FolderId":null,
			"GroupId":"ALCANAL",
			"GroupName":"Alcan",
			"IsAvailable":true,
			"IsCWGold":false,
			"IsChemwatch":false,
			"IsLatest":false,
			"IsPrivate":false,
			"IsWeWrite":false,
			"IssueDate":"\/Date(712159200000+1000)\/",
			"LanguageCode":"English",
			"LanguageId":340700,
			"MaterialId":"5566246",
			"PreferredVendor":"Alcan",
			"SourceType":"p",
			"VendorId":4200000272
		},
		...
	]
}


Get Documents by Part Number - method "GetDocumentsByPartNumber"

This Method is used to obtain a Vendor SDS from the Chemwatch Database using Part Number.

URL:

XMLGET /api/v1/GetDocumentsByPartNumber
JSONGET /api/v1/json/GetDocumentsByPartNumber

Request Parameters:

Query parameterData TypeRequiredDescription
userPartNumberstringyes Part Number
gidstringnoGID search parameter
folderIdintegernoFolder
languageIdsinteger (comma separated)noComma separated Languges Ids
countryIdsinteger (comma separated)noComma separated Countries Ids
ownboolnoSearched Own collection is set to true. If set to false searched in Full database
sortFieldstringno

Sorting by field:

"soursetype" - source tyoe cane be primary or secondary,

"name" - default value

sortDirectionstringno

Possible values:

asc   - sorting by ascending

desc - sorting by descending

pageNumberintegernoindicates page number
pageSizeintegernoindicates count of items per page

Request Sample

GET /api/v1/GetDocumentsByPartNumber?userPartNumber=123

Response Format:

Response body contains ListResult of Document object in XML (JSON) format

XML Response Sample
<ListResultOfDocument xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><PageCount>2</PageCount><PageNumber>1</PageNumber><PageSize>10</PageSize><RowCount>18</RowCount> <Rows> <Document><CWNumber>1090</CWNumber><CountryCode>ANY</CountryCode><CountryId>0</CountryId><DocNo>a1090</DocNo><DocumentType>ms</DocumentType> <ExternalUrl>http://jr.chemwatch.net/cwws/MaterialService.svc/GetMsdsByExternalUrl?mi=4200280&cn=ANY&ln=ANY&fn=&cwn=1090&ui=72190&di=17548&ts=636437315161229971&v=&hc=946C8C579E77CF57471DB8763C8F56E7</ExternalUrl><FileName/><FolderId i:nil="true"/><GroupId>CW</GroupId><GroupName>ChemWatch</GroupName><IsAvailable>true</IsAvailable><IsCWGold>true</IsCWGold><IsChemwatch>true</IsChemwatch><IsLatest>true</IsLatest><IsPrivate>false</IsPrivate><IsWeWrite>false</IsWeWrite><IssueDate>2016-02-25T00:00:00</IssueDate><LanguageCode>ANY</LanguageCode><LanguageId>0</LanguageId><MaterialId>4200280</MaterialId><PreferredVendor>ChemWatch</PreferredVendor><SourceType>p</SourceType><VendorId>-1</VendorId></Document> <Document><CWNumber>31257-5</CWNumber><CountryCode>Netherlands</CountryCode><CountryId>118</CountryId><DocNo>6192754</DocNo><DocumentType>ms</DocumentType> <ExternalUrl>http://jr.chemwatch.net/cwws/DocumentService.svc/GetDocumentContentByExternalUrl?mi=4897766&gid=SIGMA&cn=118&ln=340711&fn=pd6192754.txt.gz&cwn=31257-5&ui=72190&di=17548&ts=636437315161229971&v=&hc=7CEE0BE193FE0FC70B5E6AC7E7C81380</ExternalUrl><FileName>pd6192754.txt.gz</FileName><FolderId i:nil="true"/><GroupId>SIGMA</GroupId><GroupName>Sigma-Aldrich</GroupName><IsAvailable>true</IsAvailable><IsCWGold>false</IsCWGold><IsChemwatch>false</IsChemwatch><IsLatest>true</IsLatest><IsPrivate>false</IsPrivate><IsWeWrite>false</IsWeWrite><IssueDate>2007-02-15T00:00:00</IssueDate><LanguageCode>Dutch</LanguageCode><LanguageId>340711</LanguageId><MaterialId>4897766</MaterialId><PreferredVendor>Sigma-Aldrich (Merck)</PreferredVendor><SourceType>p</SourceType><VendorId>4200002922</VendorId></Document>		...
	</Rows>
</ListResultOfDocument>
JSON Response Sample
{
  "pageCount": 2,
  "rowCount": 18,
  "pageNumber": 1,
  "pageSize": 10,
  "rows": [
    {
      "materialId": "4200280",
      "groupId": "CW",
      "vendorId": -1,
      "documentType": "ms",
      "countryCode": "ANY",
      "languageCode": "ANY",
      "issueDate": "2016-02-25T00:00:00",
      "fileName": "",
      "cwNumber": "1090",
      "externalUrl": "http://jr.chemwatch.net/cwws/MaterialService.svc/GetMsdsByExternalUrl?mi=4200280&cn=ANY&ln=ANY&fn=&cwn=1090&ui=72190&di=17548&ts=636437315544361059&v=&hc=EEB831CCF61D46F07542D09A53A21985",
      "sourceType": "p",
      "isCWGold": true,
      "isWeWrite": false,
      "isPrivate": false,
      "isChemwatch": true,
      "isAvailable": true,
      "isLatest": true,
      "groupName": "ChemWatch",
      "docNo": "a1090",
      "countryId": 0,
      "languageId": 0,
      "preferredVendor": "ChemWatch"
    },
		...
	]
}


Get report / document in HTML - "report"

This Method is used to obtain Chemwatch Documents and reports generated using "Templates". 

These include GOLD SDS, Mini SDS, Labels, etc.

With this "method" the API will "serve" a HTML document.

Note: The list of available Templates can be obtained using Templates method.

URL:

XML

GET /api/v1/report

JSON

GET /api/v1/json/report

Request Parameters:

Query parameterData TypeRequiredDescription
templatestringyes (see Get Templates)Template name
templateIdintyes (only if CustomTemplate is selected)Report's template
cwNostringyesCw Number
materialIdintegernoMaterial Id
userPartNumberstringnoUser's PartNumber
vendorIdlongnoVendor Id (use for WeWrites)
countryIdintegernoIndicates country of report
languageIdintegernoIndicates language of report

Request Sample

GET   /api/v1/report?template=spills&cwNo=1090

Response Format:

Response body contains string with html report

XML Response Sample
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN...
</string>
JSON Response Sample
"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Transitional..."


Get report / document in PDF - method pdfreport

This Method is used to obtain Chemwatch Documents and reports generated using "Templates". These include GOLD SDS, Mini SDS, Labels, etc.

With this "method" the API will "serve" a PDF document.

Note: The list of available Templates can be obtained using Templates method

URL:

XMLGET /api/v1/pdfreport
JSONGET /api/v1/json/pdfreport

Request Parameters:

Query parameterData TypeRequiredDescription
templatestringyes (see Get Templates)Template name
templateIdintyes (only if CustomTemplate is selected)Report's template
cwNostringyesCw Number
materialIdintegernoMaterial Id
userPartNumberstringnoUser's PartNumber
vendorIdlongnoVendor Id (use for WeWrites)
countryIdintegernoIndicates country of report
languageIdintegernoIndicates language of report

Request Sample

GET   /api/v1/pdfreport?template=mini&cwNo=1090

Response Format:

Response contains stream of pdf file. (You can see pdf report in browser directly)

Get Templates - method "templates"

URL:

XMLGET /api/v1/templates
JSONGET /api/v1/json/templates

Request Parameters: no

Request Sample

GET   /api/v1/templates

Response Format:

Response body contains an array of TemplateSummary objects in XML (JSON) format

XML Response Sample
<ArrayOfTemplateSummary xmlns="http://schemas.datacontract.org/2004/07/Chemwatch.API.Entities" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
	<TemplateSummary>
		<Description>Custom template or Label</Description>
		<Template>CustomTemplate</Template>
	</TemplateSummary>
	<TemplateSummary>
		<Description>Standard operating procedure</Description>
		<Template>Sop</Template>
	</TemplateSummary>
	...
</ArrayOfTemplateSummary>
JSON Response Sample
[
	{
		"Description":"Custom template or Label",
		"Template":"CustomTemplate"
	},
	{
		"Description":"Standard operating procedure",
		"Template":"Sop"
	},
	...
]

Template types:

TemplateDescription

CustomTemplate

Chose this type to specify template by IDs. Should be used for all labels.
MsdsChemwatch SDS.
MiniChemwatch Mini SDS.
FireFightingFire fighting report,
FirstAidFirst aid advice.
SpillsSpills control report.
ChinaCHINA report.
AdviceToDoctorAdvice to doctor.
EnvironmentalEnvironment report.
PpePersonal protection means.
SopStandard operating procedure.
ToxicologicalToxicological report.
EpgEPG report.
TrecTREC reprot.


Get Vendor SDS - method document

This Method is used to obtain Vendor SDS document 

With this "method" the API will "serve" document with extension provided in request

Note: The list of available document names can be obtained using 

URL:

XMLGET /api/v1/document
JSONGET /api/v1/json/document

Request Parameters:

Query parameterData TypeRequiredDescription
fileNamestringyesDocument name

Request Sample

GET   /api/v1/document?fileName=pd11407714.pdf

Response Format:

Response contains stream of file with extension provided in fileName parameter . (Vendor SDS is downloaded automatically)

Msds Request

Send Msds Request - method "MsdsRequest"

This method sends Msds Request

URL:

XML

POST /api/v1/msdsrequest

additional http header: Content-Type: application/xml; charset=utf-8
JSON

POST /api/v1/json/msdsrequest

additional http header: Content-Type: application/json; charset=utf-8


Request Sample

POST   /api/v1/msdsrequest

Content-Type: application/xml; charset=utf-8

Request body

XML Request body
<MsdsRequestEntity>
  <ProductName>test xml</ProductName>
  <ProductNumber>test xml</ProductNumber>
  <Vendor>test xml</Vendor>
  <ReferenceID>reference</ReferenceID>
  <FileName>abc.pdf</FileName>
  <File>base64 encoded file</File>
</MsdsRequestEntity>


Response Format:

Response body contains a boolean value

XML Response Sample
<boolean>true</boolean>


JSON Request Sample

POST   /api/v1/json/msdsrequest

Content-Type: application/json; charset=utf-8

Request body

JSON Request body
{"ProductName":"test", "ProductNumber": "test", "Vendor": "test"}


Response Format:

Response body contains a boolean value

JSON Response Sample
true



Folder Node Methods

Get Folder Id By Full Path - method "folderIdByFullPath"

This method is used to obtain folder ID by full path provided as a parameter. It helps in the subsequent calls which allow restricting results by a sub-tree (folder ID passed in become a root folder for the sub-tree). Only results belonging to the specified folder and all its children will be returned.

URL:

XMLGET /api/v1/folderIdByFullPath
JSONGET /api/v1/json/folderIdByFullPath

Request Parameters:

Query parameterData TypeRequiredDescription
pathstringyesFull folder path

Request Sample

GET   /api/v1/FolderIdByFullPath?path=ENTERPRISE/FOLDERS/benz

Response Format:

Response body contains just integer folder Id

XML Response Sample
<int xmlns="http://schemas.microsoft.com/2003/10/Serialization/">1012072</int>
JSON Response Sample
1012072


Get Root Folder Id - method RootFolderId

This method is used to obtain Root Folder ID. Folder ID may be useful in subsequent queries.

URL:

XMLGET /api/v1/RootFolderId
JSONGET /api/v1/json/RootFolderId

Request Parameters:

None

Request Sample

 GET /api/v1/RootFolderId

Response Format:

Response body contains just integer folder Id

XML Response Sample
<int xmlns="http://schemas.microsoft.com/2003/10/Serialization/">997557</int>
JSON Response Sample
997557


SOAP

Endpoint

http://jr.chemwatch.net/api/chemwatchservice.svc/soap

WSDL


SOAP endpoint is useful for generating client code to access a web service.

e.g. svcutil.exe (https://msdn.microsoft.com/en-us/library/aa347733%28v=vs.110%29.aspx)

  • Possible values of MsdsFormat: None = 0, Reach = 1, Local = 2, Ghs =3
  • Possible values of EntityType: Material = 1, Cas = 2

  • No labels