What is the Program API?

Follow

Wodify currently offers an API to access the WODs. A common problem is that the gym wants to filter the WODs by the Program, but the list of Programs changes often enough that it is undesirable to hardcode in a list of Programs. As a solution, we now also offer an API to get a list of Programs. This API can return XML or JSON based on your needs.


The endpoint for the API is: app.wodify.com/API/Programs_v1.aspx.

The API accepts three parameters:

  • apikey - Your affiliate's API key for authentication
  • type - Possible values are "xml" or "json" (default is "xml")
  • endcoding - Possible values as "ascii", "utf-8", or "utf-16" (default is "ascii")


Example: app.wodify.com/API/Programs_v1.aspx?apikey=rwdy3j2rk15m31ta0r6111116&type=json&encoding=utf-8

returns in JSON:


{  
  "RecordList":  
    {    
      "Program":
        [        
          {        
            "Id": "1009",        
            "Name": "CrossFit",        
            "Description": null,        
            "Color": null,        
            "PublishExternally": "True",        
            "CountTowardsAttendanceLimits": "True",        
            "CreatedBy": "17597",        
            "CreatedOn": "2014-01-02T10:39:48",        
            "UpdatedBy": "17597",        
            "UpdatedOn": "2014-01-02T10:39:48",        
            "Is_Active": "True"      
          },        
          {        
            "Id": "1032",        
            "Name": "Test Program",        
            "Description": null,        
            "Color": null,        
            "PublishExternally": "True",        
            "CountTowardsAttendanceLimits": "True",        
            "CreatedBy": "39175",        
            "CreatedOn": "2014-02-13T10:31:19",        
            "UpdatedBy": "39175",        
            "UpdatedOn": "2014-02-13T10:31:19",        
            "Is_Active": "True"      
          }    
        ]  
    }
}  


Switching it to XML: app.wodify.com/API/Programs_v1.aspx?apikey=rwdy3j2rk15m31ta0r6111116&type=xml&encoding=utf-8   

produces:  

<?xml version="1.0" encoding="UTF-8"?>
  <RecordList>  
    <Program>    
      <Id>1009</Id>    
      <Name>CrossFit</Name>    
      <Description />    
      <Color />    
      <PublishExternally>True</PublishExternally>    
      <CountTowardsAttendanceLimits>True</CountTowardsAttendanceLimits>      
      <CreatedBy>17597</CreatedBy>    
      <CreatedOn>2014-01-02T10:39:48</CreatedOn>      
      <UpdatedBy>17597</UpdatedBy>    
      <UpdatedOn>2014-01-02T10:39:48</UpdatedOn>    
      <Is_Active>True</Is_Active>  
    </Program>  
    <Program>    
      <Id>1032</Id>    
      <Name>Test Program</Name>    
      <Description />    
      <Color />    
      <PublishExternally>True</PublishExternally>    
      <CountTowardsAttendanceLimits>True</CountTowardsAttendanceLimits>      
      <CreatedBy>39175</CreatedBy>    
      <CreatedOn>2014-02-13T10:31:19</CreatedOn>    
      <UpdatedBy>39175</UpdatedBy>    
      <UpdatedOn>2014-02-13T10:31:19</UpdatedOn>    
      <Is_Active>True</Is_Active>  
    </Program>
</RecordList>  


The fields returned are:  

  • ID: The ID of the Program. You will likely not need this.
  • Name: The name of the Program. In other Wodify APIs, this is what is used as input.
  • Description: The description of the Program.
  • Color: The hex color code used by Wodify to represent this program in various places. PublishExternally: Whether or not the classes from this Program will be shown in the public whiteboard, etc. by default.
  • CountTowardsAttendanceLimits: Whether or not attending classes for this Program counts towards an athlete's member plan's attendance limits. If you are listing programs on your site, this may be a useful piece of information to display to athletes.
  • CreatedBy: The user ID of the user that created this Program.
  • CreatedOn: The timestamp (in EST) that this Program was created.
  • UpdatedBy: The user ID of the user that last updated this Program.
  • UpdatedOn: The timestamp (in EST) that this Program was last updated.
  • IsActive: Whether or not this Program is currently in use in Wodify.


Sample:

<!doctype HTML>
<html>
  <head> </head>  
  <body>  
    <select id='program_list'>    
    <option value='0'>Select a Program</option>
    <?php
      $curl = curl_init('http://app.wodify.com/API/Programs_v1.aspx?apikey=YOURAPIKEYHERE&type=json&encoding=utf-8');
      curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
      $curl_response = curl_exec($curl);
      curl_close($curl);
      $programs = json_decode($curl_response, true);
      foreach ($programs['RecordList']['Program'] as $program): ?>    
        <option id='<?= $program['Id'] ?>'><?= $program['Name'] ?></option>
    <?php endforeach; ?>
    </select>  
  </body>
</html>

Comments