### CourseActivated Webhook Example (XML) Source: https://support.anewspring.com/en/articles/70426 This is an example of an XML message sent when a learner starts a course. It includes creation timestamp, event type, and user/course details. ```xml ``` -------------------------------- ### CourseActivated Webhook Example (JSON) Source: https://support.anewspring.com/en/articles/70426 This is an example of a JSON message sent when a learner starts a course. It includes creation timestamp, event type, and user/course details. ```json { "created": "2014-09-01T12:00:00.000Z", "event": "CourseActivated", "id": "5db1cc3b-4306-4689-91e4-def0bff0e58d", "user": { "course": { "id": "prince2", "name": "Prince 2", "uid": "a62b0836-7682-11eb-b67e-06575dd7e8c5" }, "id": "jwatson", "name": "John Watson", "uid": "c21f7c68-7682-11eb-b67e-06575dd7e8c5" } } ``` -------------------------------- ### Add User API Call Example Source: https://support.anewspring.com/en/articles/70412-api-calling-the-api-and-the-output-format Example of adding a user via the API using cURL. Ensure to use HTTPS and include the API key in the header for security. The Content-Type should be set appropriately. ```bash curl -H "X-API-Key: ************************************" -H "Content-Type: application/x-www-form-urlencoded" -X POST -d "login=testuser&firstName=test&lastName=test" https://demo.anewspring.com/api/addUser/testid ``` -------------------------------- ### POST /instantiate Source: https://support.anewspring.com/en/articles/70407-api-calls-templates-and-courses Creates a new course based on a specific template using either an external ID or a UID. ```APIDOC ## POST /instantiate/{templateID}/{courseID} ### Description Creates a new course based on a specific template using the template's external ID or UID. ### Method POST ### Endpoint /instantiate/{templateID}/{courseID} or /instantiate?templateUID={templateUID}&courseID={courseID} ### Parameters #### Path Parameters - **templateID** (string) - Required - The external ID of the template. - **courseID** (string) - Required - The external ID for the new course. #### Query Parameters - **templateUID** (string) - Optional - The UID of the template. - **courseID** (string) - Required - The external ID for the new course. ``` -------------------------------- ### GET /getBookableEventSubscriptions/{eventID} or POST /getBookableEventSubscriptions?eventID={eventID} Source: https://support.anewspring.com/en/articles/70421 Retrieves all subscriptions for a given event using its external ID. Supports both GET and POST methods. ```APIDOC ## GET /getBookableEventSubscriptions/{eventID} or POST /getBookableEventSubscriptions?eventID={eventID} ### Description Use this endpoint to retrieve all subscriptions associated with a specific event. The event is identified by its external ID, referred to as `eventID`. ### Method GET or POST ### Endpoint `/getBookableEventSubscriptions/{eventID}` (for GET) `/getBookableEventSubscriptions?eventID={eventID}` (for POST) ### Parameters #### Path Parameters - **eventID** (string) - Required - The external ID of the event. #### Query Parameters - **eventID** (string) - Required - The external ID of the event. ### Request Example **GET Request:** `/getBookableEventSubscriptions/your_event_id_here` **POST Request:** `/getBookableEventSubscriptions?eventID=your_event_id_here` ### Response #### Success Response (200) - **subscriptions** (array) - A list of subscriptions for the event. - **learnerId** (string) - The ID of the learner. - **subscriptionDate** (string) - The date the learner subscribed. - **status** (string) - The status of the subscription. #### Response Example ```json { "subscriptions": [ { "learnerId": "learner_123", "subscriptionDate": "2023-10-27T10:00:00Z", "status": "Subscribed" } ] } ``` ``` -------------------------------- ### SSO with Course and Activity Parameters Source: https://support.anewspring.com/en/articles/70423 Initiate SSO and automatically open a specific course and activity for the learner. This requires both the course and activity external IDs. ```http GET https:///do?action=sso&user=1234&token=24345226-ec3a-4d90-a5d0-aa99c80ec491&course=course01&activity=activity01 ``` -------------------------------- ### Path and Query Parameters Source: https://support.anewspring.com/en/articles/70412-api-calling-the-api-and-the-output-format Explains how to use path parameters and query parameters, including examples for different scenarios. ```APIDOC ## Path and Query Parameters ### Description This section details how to handle parameters, specifically distinguishing between path parameters and query parameters, and provides examples for their usage. ### Parameter Types API calls can include parameters that are part of the URL path or passed as query parameters. Some parameters designated as `path` parameters can also be sent as query parameters. #### Path Parameters These are typically external IDs and are appended directly to the URL path after a forward slash (`/`). Special characters must be URL-encoded. **Example for `POST /updateCourse/{ID}`** Let `ID = "1234 ABC"`. **Method 1: In the path** Endpoint: `/updateCourse/1234%20ABC` ```bash curl -H "X-API-Key: ************************************" \ -H "Content-Type: application/x-www-form-urlencoded" \ -X POST \ -d "startDate=2020-12-16&expireDate=2021-06-16" \ https://demo.anewspring.com/api/updateCourse/1234%20ABC ``` **Method 2: In the query string** Endpoint: `/updateCourse?ID=1234%20ABC` ```bash curl -H "X-API-Key: ************************************" \ -H "Content-Type: application/x-www-form-urlencoded" \ -X POST \ -d "startDate=2020-12-16&expireDate=2021-06-16" \ https://demo.anewspring.com/api/updateCourse?ID=1234%20ABC ``` #### Query Parameters UIDs should always be sent in the query string. Path parameters can also be used as query parameters. **Example for `POST /updateCourse?UID={UID}`** Let `UID = "1807abf8-f34b-404d-8bb3-d6b8fd5ffb27"`. **In the query string:** Endpoint: `/updateCourse?UID=1807abf8-f34b-404d-8bb3-d6b8fd5ffb27` ```bash curl -H "X-API-Key: ************************************" \ -H "Content-Type: application/x-www-form-urlencoded" \ -X POST \ -d "startDate=2020-12-16&expireDate=2021-06-16" \ https://demo.anewspring.com/api/updateCourse?UID=1807abf8-f34b-404d-8bb3-d6b8fd5ffb27 ``` ``` -------------------------------- ### GET /getBookableEventSubscriptions/{eventID} or POST /getBookableEventSubscriptions?eventID={eventID} Source: https://support.anewspring.com/en/articles/70421-api-calls-events Retrieves all subscriptions for a given event using its external ID. This endpoint can be accessed via GET with the eventID as a path parameter or POST with the eventID as a query parameter. ```APIDOC ## GET /getBookableEventSubscriptions/{eventID} ### Description Retrieves all subscriptions of an event using its external ID. ### Method GET ### Endpoint /getBookableEventSubscriptions/{eventID} ### Parameters #### Path Parameters - **eventID** (string) - Required - The external ID of the event. ### Response #### Success Response (200) - **subscriptions** (array) - A list of subscriptions for the event. #### Response Example { "subscriptions": [ { "learnerId": "learner123", "subscriptionDate": "2023-10-27T10:00:00Z" } ] } ## POST /getBookableEventSubscriptions?eventID={eventID} ### Description Retrieves all subscriptions of an event using its external ID. ### Method POST ### Endpoint /getBookableEventSubscriptions?eventID={eventID} ### Parameters #### Query Parameters - **eventID** (string) - Required - The external ID of the event. ### Response #### Success Response (200) - **subscriptions** (array) - A list of subscriptions for the event. #### Response Example { "subscriptions": [ { "learnerId": "learner123", "subscriptionDate": "2023-10-27T10:00:00Z" } ] } ``` -------------------------------- ### GET /getEvents Source: https://support.anewspring.com/en/articles/70419 Retrieves a list of all calendar items. ```APIDOC ## GET /getEvents ### Description Use this to get a list of all calendar items. ### Method GET ### Endpoint /getEvents ``` -------------------------------- ### SSO with User and Token Source: https://support.anewspring.com/en/articles/70423 Example of initiating SSO using the user's external ID and a valid login token. ```http GET https:///do?action=sso&user=1234&token=24345226-ec3a-4d90-a5d0-aa99c80ec491 ``` -------------------------------- ### SSO with Redirect Parameter Source: https://support.anewspring.com/en/articles/70423 Initiate SSO and redirect the learner to a specific relative URL within the learning environment. This is useful for directing users after clicking a link in an email notification. Do not combine with 'course' or 'activity' parameters. ```http GET https:///do?action=sso&user=1234&token=24345226-ec3a-4d90-a5d0-aa99c80ec491&redirect=%2Fdo%3Faction%3Dplayer%26type%3DLesson%26id%3D1234%26courseId%3D1234 ``` -------------------------------- ### GET /getSkillProfiles Source: https://support.anewspring.com/en/articles/70588 Retrieves a list of all available skill profiles. ```APIDOC ## GET /getSkillProfiles ### Description Use this to get all profiles. ### Method GET ### Endpoint /getSkillProfiles ``` -------------------------------- ### GET /getStudentSkillProfiles Source: https://support.anewspring.com/en/articles/70588 Retrieves all skill profiles linked to a specific user. ```APIDOC ## GET /getStudentSkillProfiles/{userID} ### Description Use this to get all profiles that a user is linked to. ### Method GET ### Endpoint /getStudentSkillProfiles/{userID} or /getStudentSkillProfiles?userUID={userUID} ### Parameters #### Path Parameters - **userID** (string) - Required - The external ID of the user. #### Query Parameters - **userUID** (string) - Optional - The UID of the user. ``` -------------------------------- ### SSO MemoTraining Email Flow (Without Custom Link) Source: https://support.anewspring.com/en/articles/70424-sso-primary-login-method-and-email-notifications Demonstrates the URL sequence for SSO authentication when the email link points directly to the aNewSpring environment. ```text https://demo.anewspring.com/do?action=player&id=123&type=Training&courseId=789 https://example.com/login?redirect=true https://demo.anewspring.com/api/getLoginToken/ABC https://demo.anewspring.com/do?action=sso&user=ABC&token=24345226-ec3a-4d90-a5d0-aa99c80ec491 https://demo.anewspring.com/do?action=player&id=123&type=Training&courseId=789 ``` -------------------------------- ### Initiate SSO Redirect Source: https://support.anewspring.com/en/articles/70423 Initiates the SSO process by redirecting the user's browser to the learning environment with the provided parameters. ```APIDOC ## GET /do?action=sso ### Description Initiates the Single Sign-On (SSO) process by redirecting the user's browser. This endpoint requires a valid login token obtained from the `/getLoginToken/` endpoint. ### Method GET ### Endpoint `/do?action=sso` ### Parameters #### Query Parameters - **user** (string) - Required - The external ID of the user. Mandatory if `userUID` is not provided. - **userUID** (string) - Required - The UID of the user. Mandatory if `user` is not provided. - **token** (string) - Required - The one-time login token retrieved from the `/getLoginToken/` API. - **course** (string) - Optional - The external ID of the course to automatically open after login. Cannot be combined with `redirect`. - **activity** (string) - Optional - The external ID of the activity to automatically open after login. Requires the `course` parameter to be present. - **redirect** (string) - Optional - A relative URL to redirect the user to after login. Cannot be combined with `course` or `activity`. ### Request Example ``` GET https:///do?action=sso&user=1234&token=24345226-ec3a-4d90-a5d0-aa99c80ec491 ``` ### Request Example with Course and Activity ``` GET https:///do?action=sso&user=1234&token=24345226-ec3a-4d90-a5d0-aa99c80ec491&course=course01&activity=activity01 ``` ### Request Example with Redirect ``` GET https:///do?action=sso&user=1234&token=24345226-ec3a-4d90-a5d0-aa99c80ec491&redirect=%2Fdo%3Faction%3Dplayer%26type%3DLesson%26id%3D1234%26courseId%3D1234 ``` ### Response #### Success Response (302 Found) - Redirects the user's browser to the specified URL or the default landing page. #### Response Example (Browser redirect, no JSON response) ``` -------------------------------- ### Get User Results (All Subscriptions) Source: https://support.anewspring.com/en/articles/70418 Retrieves the results for all subscriptions of a specific user. ```APIDOC ## GET /getResults/{userID} ### Description Use this endpoint to get the results of all subscriptions of a specific user. You will need to use the external ID (userID) or UID (userUID) of the user (learner). ### Method GET ### Endpoint /getResults/{userID} ### Query Parameters - **userUID** (string) - Required - The UID of the user. ### Request Example GET /getResults?userUID=a62b0793-7682-11eb-b67e-06575dd7e8c5 ```