Buildfire: How to set data written to datastore as live

47 Views Asked by At

I am writing data to my buildfire datastore using the API endpoint: https://public.buildfire.com/1.0/cms/save

My data is being written successfully, changes are being saved correctly, etc.

When I make a change the change shows up on the control side and widget in my dashboard in browser. However the changes do not go out to the plugin on the app of the client side until I hit publish.

I have a function code that runs on a schedule to consistently fetch updated data, and I need that data to go out to the clients automatically without having to publish. I was trying to add a parameter for mode: 1 for live, but it's not working. Does anyone know of a way to set the data being written to live mode automatically?

Here is my code snippet for my function:

const insertOrUpdateDataToBuildFire = async (schedule) => { const requestData = { plugin_id: "mypluginID", instance_id: "myInstanceID", tag: "thetagforthisdata", data: schedule, mode: "1" //here is where I am trying to pass along the parameter to set it to live mode };

await axios.post('https://public.buildfire.com/1.0/cms/save', requestData, {
    headers: {
        'Authorization': `Bearer ${process.env.xapi_key}`,
        'Content-Type': 'application/json',
        'x-api-key': process.env.x_api_key
    }
});

};

I have tried to use mode & liveMode. I have tried onUpdate, but that's for when the control side grabs an update and doesn't update when the datastore updates. I also tried to set a refresh time on the widget/index.html

0

There are 0 best solutions below