Integrating the Business Portal - API

Studioware contains a full Application Programming Interface (API) to allow you to access your class data from your preferred programming language.  The API is exposed as a REST service.  Typically, you could use JavaScript (or a library such as jQuery, or Angular) to access the data and display the results on your web page.  All data returned from the RestAPI is in JSON format.
 
Tip:  There is a popular free tool called PostMan that allows you to easily consume RestAPI services.  Let us know if you need help getting PostMan setup.

Advantages:

There are many advantages to using the RestAPI, including
  • Your class data can be displayed directly on your existing web site.  Your students/parents will not need to open the Business Portal in another window/tab (or an iframe) to browse your class offerings
  • We are committed to expanding the functionality exposed in the RestAPI.  That is, over time, will will expose new RestAPI methods.

Disadvantages

  • You need a programmer to consume the RestAPI and integrate the data into your existing web site
Tip: You can hire our developers to integrate the RestAPI with your existing web site. Contact us to discuss your requirements at support@Studioware2.com
 
To get started using the RestAPI, follow these instructions:
  1. Click on Administration
  2. Click on API
  3. By default, your class data is not available through the API.
  4. Click on the "Enable Studioware API" if you want to expose your class data over the RestAPI
  5. After you click on the "Enable Studioware API", you will see your API Key.  This is the value you need to use in the RestAPI Headers to retrieve your class data: 
  6. If you need to stop the access to your RestAPI, click on the "Disable Studioware API" button, and your data will no longer be available in the RestAPI
    Tip: If you disable your Studioware API, and then re-enable, Studioware will generate a new API Key.  That is, your previous API cannot be used, you must update your programming logic to include the newly generated API Key
  7. You can now use the Studioware API Key to call the RestAPI services to access your data.
 

Important Note:

  • The Studioware RestAPI endpoint  is located here: https://www.studioware2.com/api/
  • The RestAPI documentation is located here: https://www.studioware2.com/ApiHelp
  • We have a complete sample HTML page that you can try and download by clicking on Administration | API while logged onto Studioware
  • Try the sample API page now
 

Sample Code

Here's a sample of calling the Studioware RestAPI to obtain a list of classes.  This sample is programmed using the jQuery javascript library.  Additional samples can be found in the sample HTML page.
 
<script>

    console.log("starting retrieveClasses");

    // Set your Studioware API Key here
    var apiKey = 'ENTER-YOUR-API-KEY-FROM-STUDIOWARE-HERE';

    // use jQuery to invoke the Studioware Rest Service to get the list of classes
    console.log("retrieveClasses() => About to call Studioware RestAPI to get list of classes");
    $.ajax({                
        url: 'https://www.studioware2.com/api/classes',                
        headers: {
            'API_KEY': apiKey
        },               
        cache: false,
        async: true,
        type: 'GET',
        dataType: 'json'
    })
    .done(
        function (data) {

            // The Studioware ReastAPI has respondes
            console.log("Sucessfully called the Studioware RestAPI");

            if (data == null) {
                console.error("No class data returned");
            } else {

                // we have class data
                // loop over the class data and display the data on the browser's console
                $.each(data, function (i, _class) {
                    console.log("Class Name: " + _class.Name);
                    console.log("Class Id: " + _class.Id);
                    console.log("Allows OnlineEnrollment: " + _class.OnlineEnrollment);                    
                    console.log("Full Class Object:", _class);
                });
                
                console.log("Finished Processing the Class Data");
            }
        }
    )
    .error(
        function (jqXHR, textStatus, errorThrown) {
            console.error("ERROR calling Studioware RestAPI", jqXHR);                    
            alert(jqXHR.responseText || textStatus);
        }
    );

</script>

 

 
 

Add Feedback