Can my SquareSpace / Box Ally site integrate with Wodify WODs?

Follow

Yep! Please add the below to each page you'd like the WOD displayed:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<div id="wodcontainer" />
<script>
    function loadFormattedWOD(elementId, apiKey, date, location, program, includeSeparator) {
       $.ajax({
          url: 'https://app.wodify.com/API/WODs_v1.aspx',
          data: {
          apiKey: apiKey,
          date: date,
          location: location,
          program: program,
          type: "json"
       },
       dataType: "json",
       success: function(data){
          if(data && data.RecordList.APIWod.FormattedWOD) {
             if (includeSeparator) {
                $('#' + elementId).append('<br>----------<br><br>');
             }
             $('#' + elementId).append(date + '<br><br>' + data.RecordList.APIWod.FormattedWOD);
          }
       }
    });
}

    function loadMultipleFormattedWODs(elementId, apiKey, location, program, numDays) {
       var today = new Date();
       dayCounter = 0; while (dayCounter < numDays) {
          var dateString = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + (today.getDate() - dayCounter);
          var localId = elementId + dayCounter;

          $("#" + elementId).append('<div id="' + localId + '" />');
          loadFormattedWOD(localId, apiKey, dateString, location, program, dayCounter > 0);

          dayCounter++;
       }
    }

    loadMultipleFormattedWODs("wodcontainer", "APIKEY GOES HERE", "YOUR LOCATION GOES HERE", "YOUR PROGRAM GOES HERE", "YOUR NUMBER OF DAYS GOES HERE");
</script>

You will need to update the following:

  • "apiKey": Enter the API key for the tenant here
  • "location": Enter the name of the location you wish to pull WODs from
  • "program": Enter the name of the program you wish to pull WODs from
  • "numDays" : Enter the number of days for which you'd like WODs to be displayed, starting today and moving backwards (to show just the current day, enter 1, to show the past week, enter 7)

 

Note: HTTPS is required to use the WODs API.

Comments