Commodities.APISED
This endpoint makes an HTTP GET request to retrieve the latest commodity rates for various symbols in the specified currency. The request includes the symbols of the commodities and the base currency. The response contains the success status, any errors, the base currency, and the rates for each commodity symbol in the specified base currency.
Query Parameter
Description
symbols
Comma seperate values from supported symbols list.
base
desired currency for pricing information
Example Request
- javaScript
- Node.js
- PHP
- Axios
- fetch
import axios from 'axios';
const options = {
method: 'GET',
url: 'https://commodities-apised.p.rapidapi.com/v1/latest',
params: {
symbols: 'COCOA,COFFEE,CORN,COTTON,GASOLINE,LUMBER,NATURALGAS,OATS,OIL,ORANGEJUICE,SOYBEAN,SUGAR,WHEAT',
base: 'USD'
},
headers: {
'X-RapidAPI-Key': '<YourApiKey>',
'X-RapidAPI-Host': 'commodities-apised.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}
Example Response
{
"success": true,
"errors": [],
"base_currency": "USD",
"rates": {
"COCOA": 5404,
"COFFEE": 189.38,
"CORN": 433.07,
"COTTON": 87.72,
"GASOLINE": 2.2253,
"LUMBER": 542.79,
"NATURALGAS": 2.026,
"OATS": 3.7129,
"OIL": 73.96,
"ORANGEJUICE": 3.78668,
"SOYBEAN": 1182.25,
"SUGAR": 23.98,
"WHEAT": 592.12
}
}
This endpoint makes an HTTP GET request to retrieve market data for various commodities. The request includes a list of symbols and the base currency. The response contains the success status, any errors, the base currency, and the market data for each symbol including open, high, low, previous, and current values.
Query Parameter
Description
symbols
Comma seperate values from supported symbols list.
base
desired currency for pricing information
Example Request
- javaScript
- Node.js
- PHP
- Axios
- fetch
import axios from 'axios';
const options = {
method: 'GET',
url: 'https://commodities-apised.p.rapidapi.com/v1/market-data',
params: {
symbols: 'COCOA,COFFEE,CORN,COTTON,GASOLINE,LUMBER,NATURALGAS,OATS,OIL,ORANGEJUICE,SOYBEAN,SUGAR,WHEAT',
base: 'USD'
},
headers: {
'X-RapidAPI-Key': '<YourApiKey>',
'X-RapidAPI-Host': 'commodities-apised.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}
Example Response
{
"success": true,
"errors": [],
"base_currency": "USD",
"rates": {
"COCOA": {
"open": 5187,
"high": 5416,
"low": 5184,
"prev": 5228,
"current": 5401
},
"COFFEE": {
"open": 188.93,
"high": 191.48,
"low": 188.53,
"prev": 187.78,
"current": 189.43
},
"CORN": {
"open": 437.56,
"high": 437.81,
"low": 433.07,
"prev": 438.56,
"current": 433.07
},
"COTT
This endpoint retrieves the list of supported commodities and currencies
Query Parameter
Description
Example Request
- javaScript
- Node.js
- PHP
- Axios
- fetch
import axios from 'axios';
const options = {
method: 'GET',
url: 'https://commodities-apised.p.rapidapi.com/v1/supported',
headers: {
'X-RapidAPI-Key': '<YourApiKey>',
'X-RapidAPI-Host': 'commodities-apised.p.rapidapi.com'
}
};
try {
const response = await axios.request(options);
console.log(response.data);
} catch (error) {
console.error(error);
}
Example Response
{
"success": true,
"supported_commodities": [
{
"commodity_code": "COCOA",
"commodity_name": "Cocoa",
"commodity_weight_measurement": "Metric Ton (mt)"
},
{
"commodity_code": "COFFEE",
"commodity_name": "Coffee",
"commodity_weight_measurement": "Pound (lb)"
},
{
"commodity_code": "CORN",
"commodity_name": "Corn",
"commodity_weight_measurement": "Bushel (BU)"
},
{
"commodity_code": "COTTON",
"commodity