Model Prices API
The Model Prices API is a classic REST API where you can get data about specific products like for example Marklin 39027 or Marklin 39491.
get-product
Get data about a specific product. Call the function like this:
https://www.modelprices.com/wp-json/public/get-product?currency=CURRENCY&brand=BRAND&model=MODEL&key=YOUR-API-KEY
For example like this:
https://www.modelprices.com/wp-json/public/get-product?currency=EUR&brand=marklin&model=30000&key=YOUR-API-KEY
In return, you will get a JSON with information like this:
{
"brand": "Marklin",
"model": "39491",
"url": "https://www.modelprices.com/p/marklin-39491/",
"price": "564.00",
"currency": "EUR",
"expired": 0,
"remaining_api_quota_today": 20
}
product-available
Check if a specific product is available or not. Call the function like this:
https://www.modelprices.com/wp-json/public/product-available?brand=BRAND&model=MODEL&key=YOUR-API-KEY
For example like this:
https://www.modelprices.com/wp-json/public/product-available?brand=marklin&model=30000&key=YOUR-API-KEY
In return you simply get a true/false. Is the product available or not.
Getting an API key
To get an API key, you need to write to me. When you do so, please write a few lines about how and where you will use the API.
If you use the API on website or similar, please make sure you credit (i.e. link to) Model Train Prices.
WordPress plugin
If you are using WordPress (you should 👍), you can avoid the API by using the WordPress plugin “Model Trains Data”. This plugin wraps the API call in a shortcode, which makes things simpler if you just want to show the price of a few models on your site.