This example demonstrates how to use the SoftSlate Cloud Platform API to add and/or update content pages on your SCP site, from a file on your local filesystem. The scenario is, you would like to maintain some of your site content in a system that stores files locally (for example, using a desktop application that you are familiar with). When it comes time to upload the content, instead of logging into SCP, finding the Content Page to update, and copying and pasting the changes, you could simply fire off this script (or something like it).

The script is a Bash script that uses Perl to manipulate the content a little bit before sending it to SCP, and curl to actually perform the request.

To run this script, save it to a file, and make it executable. For our example, we have named the file "scpContentPageUpdate.sh". Call the script with one argument, which is the path to the file on your local system whose content you wish to use to update the content page on SCP. Here is an example:

The system will generate a code for the content page from the file name (My_Content_Page). The script calls the "createOrUpdate" endpoint. This means if a matching content page with the same code does not already exist, it will create a new one. If one does exist, it will update the "description" field with the content from the file.