HTTP request in FIBARO Home Center 2 with virtual device - api

I use the FIBARO Home Center 2 and I am trying to start a boiler and a heater during the cheapest prices using an URL (API), but I don't know how to request the prices and/or timestamps from the URL.
I'm trying to start a boiler and a heater at the cheapest times. If required, will provide URL.
thanks

Related

"No 'Access-Control-Allow-Origin' header" error when making a request to a public API

This is the documentation of the API I'm trying to make a request to.
Relevant section:
Public Data Functions
Ticker
GET https://kiwi-coin.com/api/ticker/
Returns JSON object:
last - last BTC price
date - price date
high - last 24 hours till date price high
low - last 24 hours till date price low
vwap - last 24 hours till date volume weighted average price: vwap
volume - last 24 hours till date volume
bid - highest buy order
ask - lowest sell order
Here's my code:
$.ajax({
type: "GET",
url: "https://kiwi-coin.com/api/ticker/",
});
Yep, there's no way of handling the response. Ignore this for now,
I'm just focusing on getting the request to work.
Here's the error I get in the console:
Failed to load https://kiwi-coin.com/api/ticker/: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://cloud-rooster.glitch.me' is therefore not allowed access.
What am I doing wrong? This API works for other users (e.g. bots).
I checked out the other questions with a similar title, but from what I could make out the answers all involved making changes to the server, which isn't an option in this case.
If the API server doesn't support CORS, there are two options:
JSONP. Though you can't make cross-origin XHRs without adequate permission, you CAN include a JavaScript file from anywhere. If the API server returns something like callback({ json data ...}), then you can use the data without having to jump through hoops. However, it doesn't seem like KiwiCoin supports that.
Run your own server from the same origin as your client application (probably the same server that hosts your HTML/JS files), and have endpoints on your server that forward to the API server. This is foolproof.
One thing I noticed from looking at your code is that you have calls to process.env, which doesn't exist in the browser. That might be the sign you need to try option #2!
It turns out I was running the function from the client-side (in the browser), rather than server-side (in a Node.js environment).
Duh!
Problem solved.

Prestashop multiple cart created in short time interval

The last days my store show more than hundred abandoned cart create by non registered customer.
the logs show that the activity is coming from a specific IP: 157.56.176.228.
Googling the IP show that it's some sort of Microsoft service.
Is there away to block it?

Bigcommerce - request products based on a list of IDs

I am using the Bigcommerce API to develop a small standalone application for a client. I store product information in a local database anytime I fetch products from Bigcommerce, to reduce latency and network load. However, products can change on Bigcommerce, and while it is acceptable for my application to show mildly outdated information, I will need to update my local cache at some point. My current plan is to do this by storing the original date I requested the product, after which I will need to perform another request to refresh the cache.
My question is, given a list of products (including their Bigcommerce IDs), is there a way to request updates to all of them through a single call to the Products Resource? I can make a request for each individual product by calling:
GET {api}/v2/products/{id}
I can also request all products within an unbroken ID range by calling:
GET {api}/v2/products?min_id={value}&max_id={value}
I am able to successfully call both of the above methods, and I can chain them together in loops to fetch all products. What I want to do is request multiple products with unrelated IDs in a single call. So, something like this:
//THIS IS NOT A REAL METHOD!
GET {api}/v2/products?id[]={value1}&id[]={value2}
Is there any way I can do this? Or is there another approach to solving this that I haven't considered? My main requirements are:
Minimal API requests. My application is small but my client's bigcommerce store is not, and I will be processing tens of thousands of products. I have limited CPU and network resources available, and I simply cannot process that many requests.
Scalable. As I said, my client's store is large, and growing. I need a solution whose overhead scales at a manageable rate with number of products.
Note: my application is a small web application written in PHP running on a Linux shared hosting environment. It is a back of house system which will likely only be used by single user at a time, during standard business hours. I haven't tagged the question with PHP because my question is about the API, which is language agnostic.
One approch can be.
First get all products from BigCommerce using simple products call.
Set some interval time to get updated product list.
You can use min_date_modified and max_date_modified OR min_date_created and max_date_created in products API call to get updated products details.

Multiple options for purchase in VirtueMart

I want to use virtue mart for online shopping system on a joomla website. But I wonder if it supports multiple purchase options like;
Add to Cart (will added into the cart)
Download Online (customer will be able to download the files like .pdf or .mp3)
Get physical product (product will be shipped to the customers address, or can visit the head-office and get it by hand, etc)
The Payment methods would be like;
Online payment (via credit card, online banking, paypal, master card, visa card, etc)
Other Means (via bank, western union, within the country options, or can visit the head-office and pay it by hand, etc)
Please, guide me if it is possible, and if yes, then a brief detail on HOW?
Thank you very much.
Using Virtue-mart you can achieve all your requirement easily.
You can get following options with VM
Add to cart options
Call us For details
Download files with external plugins
Shipping options to physical address
Payment with all major credit cards
even more.
By default VM have Following Payment options
Paypal
Authorize.net
System Pay
Payzen
even more you can find on the plugin Store
For your shipping option you will get shipping plugin from VM Team
UPS(Paid)
USPS(Paid)
FEDEX(Paid)
You can create custom methods(For warehouse pickup).
For online file download you can get many plugins like
Hope this will make a clear idea about VM.
If you are planning for huge Virtual store (more than 1000 of item VM is Good for you it have lot of additional features.)
for small stores better to go for Wordpress & WooCommecrce(Simple and Easy)

paypal subscribe monthly option and buy now full price in one button call

I have looked through the docs of paypal's api and cant find and option that will allow me to have a user click on a buy now button on my site and when they land on the paypal payment screen be presented with two ways to pay.
Either a monthly cost of $25. subscription model.
One time yearly payment of $300. non-subscription model.
Has anyone done this or could point me in the right direction. Ideally i want the select options to live on the paypal side not my website's side.
THanks
After looking into this some more here is what i found:
2 options:
- Create two buttons with each values. 1 reoccurring and 1 flat rate.
- Create a button with drop-down code that has two reoccurring payment options. You need to have a drop-down on your site for them to select and pass that option to PayPal. The only downside to this is that they both seem to have to be reoccurring and cant be different types.