Get started
API Endpoint
https://api.periodiske-system.dk/
This API provides you with information from the periodic table. Make a request to any of the endpoints to receive the exact information you need. The API also features a variety of functions like parsers for checmical formulas.
To use this API, you need an API key. Please contact us at rla@movir.dk to get your own API key.
Parser
# Here is a curl example
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.periodiske-system.dk/parser/cleanFormula",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array('formula' => 'H4(SO4)2'),
));
$response = curl_exec($curl);
curl_close($curl);
To pretty print a chemical formula in HTML, call the /parser/cleanFormula endpoint :
https://api.periodiske-system.dk/parser/cleanFormula
Parser example :
{"clean_formula":"H<sub>4</sub>(SO<sub>4</sub>)<sub>2</sub>"}
QUERY PARAMETERS
| Field | Type | Description |
|---|---|---|
| api_key | String | Your API key. |
| formula | String | The formula to parse |
Retrieve elements
# Here is a curl example
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.periodiske-system.dk/elements/full",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET"
));
$response = curl_exec($curl);
curl_close($curl);
You can load all elements in JSON format by calling the /parser/cleanFormula endpoint :
https://api.periodiske-system.dk/elements/full
QUERY PARAMETERS
| Field | Type | Description |
|---|---|---|
| api_key | String | Your API key. |
Errors
The Westeros API uses the following error codes:
| Error Code | Meaning |
|---|---|
| X000 | Some parameters are missing. This error appears when you don't pass every mandatory parameters. |
| X001 |
Unknown or unvalid secret_key. This error appears if you use an unknow API key or if your API key expired.
|
| X002 |
Unvalid secret_key for this domain. This error appears if you use an API key non specified for your domain. Developper or Universal API keys doesn't have domain checker.
|
| X003 |
Unknown or unvalid user token. This error appears if you use an unknow user token or if the user token expired.
|