The recent ability to export to git repos is really useful. Is there anyway to do this automatically once a week? Looking at the REST API page for export it does not seem possible yet. Just curious if I was missing something or if there is some other intended solution.
Out of the box, no, there is no way to export the application to Git on a schedule.
However, it would be very simple to automate this with a workflow. Something like …
- Timer Trigger, configured to export on your desired schedule / frequency.
- Losant API Node using the Application: Export action.
The body of the request would look like the following (you’ll need to delete the comments to make it valid JSON) …
{
"includeDevices": true, // or false
"includeDataTableRows": true, // or false
"includeFiles": true, // or false
"email": "your-email@example.com",
"callbackUrl": "https://callback-example.com", // can omit this or email if desired, but not both
"exportType": "repo",
"credentialName": "NAME_OF_GIT_CREDENTIAL", // its name, not its ID
"repo":{
"branch":"BRANCH_TO_COMMIT_TO",
"directory":"directory/path", // delete this if going to root
"commitMessage": "MY COMMIT MESSAGE"
},
"forceJob":true
}
This doesn’t account for error handling, callbacks / notifications and the like but it should be enough to get you started.
1 Like