CAC-Locker Integration (INTERPODIA ADMIN ONLY)

Integration Checklist:

  1. A client is interested in integrating Interpodia with the CAC
  2. Interpodia will explain our integration with the CAC and what it can and cannot do (You can send the information from this google doc: Interpodia Integrations)
  3. We get a signed contract from our client that shows they should get this integration
  4. The client reaches out to their Sport Representative (consultant) at the CAC to initiate the process on their end
  5. The client signs MOU with CAC
  6. The client receives a full list of multi-sport module ids and sport-specific module ids from the CAC
  7. The client works with Interpodia on which (if any) multi-sport modules they want to bring into Interpodia via the API
  8. The client works with Interpodia on which (if any) multi-sport modules they want to export to CAC via the API
  9. The client works with Interpodia on which (if any) sport-specific modules they want to manually pull from the CAC Insights tool and import into Interpodia 
  10. Interpodia completes our configuration.

    INTERPODIA INTERNAL STEPS:
      • Create External System (one per site)
      • Create Plugin (one per site)
      • Create one or more Course Type Groups
      • Create your course types, make sure to include:
        1. the data exchange settings (if you're importing, or exporting, or both)
        2. the CAC module ID at the bottom (foreign id)
        3. the External System 
      • Create Plugin application (one per organization connecting to the CAC)
      • Set up the periodic task that initiates the API to send accounts to CAC then get course records back.  
    1. Interpodia asks the client for a few test accounts (first name, last name, NCCP number) that will have course records in the CAC for modules that we are bringing across to be verified in testing.
    2. Interpodia provides the CAC technical representative (JC jccharbonneau@coach.ca) with:
      1. the endpoint
      2. the API key
    3. JC provides the NCCP number to use in the Plugin Application
    4. Testing starts, we can test on production, it's pretty safe.  
      1. Before asking JC to test, see if the endpoints are returning anything.  Use the Accounts endpoint, eg. it should have "accounts" in the URL, like https://2mev.com/rest/v2/plugin/cac/accounts/?api_key=6a6Ju1AWD7U91N4D25T7surw5oV6x4H go to that URL and you should see some results returned.
      2. if you don't see any results, the config isn't correct.
    1. If you get results, ask JC to try testing and to let you know what he finds.

    Create Plugin (one per site)

    Eg: https://snowreg.com/eventsquare/admin/panel/plugin_app/plugin/4/change/

    If it does not exist, create a new plugin with type CAC - Coaching Association of Canada.

    External system: Need one per site.  See "identity_attribute_id" section below for the identity attribute you should use.

    PLUGIN CONFIGURATION ENTRYS

    If we want to use some keys and values for all PluginApplications, we can set it here (e.g. course_records_limit_per_batch or course_records_completion_date_range_start_date)

     

    Create Plugin application

    We need to set up PluginApplication for every Event organization that wants to use this API. :

    • plugin: CAC - Coaching Association of Canada
    • content-type: event_app.Organization
    • object id: id of the organization to import/export course records

     

    PLUGIN APPLICATION CONFIGURATION ENTRYS

    • api_key = Added by Interpodia
      api key that we give to Locker (example value: MG5OXKKFXBo4C56wWX5i)
      We can use any random string and provide it to the CAC
    • identity_attribute_id = id of the Attribute where NCCP# values for identities in this organization are stored (example value: 107)
      • Often we have multiple existing attributes on a site from different organizations that are tracking the NCCP number.  In this case, you should create a new attribute, such as https://2mev.com/eventsquare/admin/panel/account_app/identityattribute/161/change/?_changelist_filters=q%3Dnccp  that will be used by the API, and sync all of the existing NCCP number attributes to the new attribute by putting all of them in an attribute sync group (set on the attribute):

      • Resave all attribute values for the NCCP identity attribute that currently stores the coach NCCP numbers.  This will copy the value into all other attribute identities in the sync group.  You need to do this because the integration is using the new attribute and there are no values in that attribute.  To do this, use a URL like https://ccnbikes.com/eventsquare/admin/panel/account_app/identityattributevalue/?attribute_id__in=1 where the value at the end is the identity attribute id you want to resave all values for.  This will filter the results for just the identity attribute values for that attribute.  Then click Select All, then from the drop-down choose Re-save Instances

    If it’s not set in PluginApplication, the system tries to get it from DataExchangeSettings and then from ExternalSystem, in this order.

    • course_type_group_ids = ids of CourseTypeGroups that belong to this organization and needs to be imported/exported (example value: 1,2,3,4,5,6)
    • locker_auth_nccp_id = Provided by the CAC
    • locker_auth_token = Provided by the CAC
    • course_records_limit_per_batch = 500

    Based on how we want to use the plugin, we add the necessary keys defined in the Import/Export section.

    Send CAC the endpoint "PUT request" and "GET request"

    we need to send CAC the endpoint: https://2mev.com/rest/v2/plugin/cac/accounts/?api_key=6a6Ju1AWD7U91N4D25T7surw5oV6x4H"

    • Same URL for PUT and GET
    • We replace everything after the = with the API key set in the plugin application

    Set up periodic task to send accounts to CAC then get course records back

    Copy the set up here: https://2mev.com/eventsquare/admin/panel/djcelery/periodictask/18/change/