Example #1
0
        /// <summary>
        /// Gets the url to directly launch/view the course registration in a browser
        /// </summary>
        /// <param name="registrationId">Unique Identifier for the registration</param>
        /// <param name="redirectOnExitUrl">Upon exit, the url that the SCORM player will redirect to</param>
        /// <returns>URL to launch</returns>
        /// <param name="debugLogPointerUrl">Url that the server will postback a "pointer" url regarding
        /// a saved debug log that resides on s3</param>
        /// <param name="parameters">Dictionary for any additional parameters that could be passed along in the request</param>
        public string GetLaunchUrl(string registrationId, string redirectOnExitUrl, string cssUrl, string debugLogPointerUrl, IDictionary <string, object> parameters)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            request.Parameters.Add("regid", registrationId);
            if (!String.IsNullOrEmpty(redirectOnExitUrl))
            {
                request.Parameters.Add("redirecturl", redirectOnExitUrl);
            }
            if (!String.IsNullOrEmpty(cssUrl))
            {
                request.Parameters.Add("cssurl", cssUrl);
            }
            if (!String.IsNullOrEmpty(debugLogPointerUrl))
            {
                request.Parameters.Add("saveDebugLogPointerUrl", debugLogPointerUrl);
            }
            if (parameters != null)
            {
                foreach (var parameter in parameters)
                {
                    request.Parameters.Add(parameter.Key, parameter.Value);
                }
            }

            return(request.ConstructUrl("rustici.registration.launch"));
        }
        public void launch()
        {
            ServiceRequest req = new ServiceRequest(cfg);

            req.Parameters.Add("auth", "no auth");
            req.Parameters.Add("reporturl", "http://scorm.com");
            string url = req.ConstructUrl("rustici.reporting.launchReport");

            WebRequest wr = HttpWebRequest.Create(url);

            ((HttpWebRequest)wr).AllowAutoRedirect = false;
            WebResponse rsp = wr.GetResponse();

            Console.WriteLine(((HttpWebResponse)rsp).StatusCode);
            Console.WriteLine(((HttpWebResponse)rsp).StatusDescription);

            Console.WriteLine("Header: ");
            foreach (string key in ((HttpWebResponse)rsp).Headers.AllKeys)
            {
                Console.WriteLine(string.Format("{0} : {1}", key, rsp.Headers[key]));
            }
            Console.WriteLine("end of header");

            Console.WriteLine(rsp.ResponseUri);


            Console.WriteLine(new StreamReader(rsp.GetResponseStream()).ReadToEnd());
        }
        /// <summary>
        /// Calling this method returns a URL to the actual export data for a given export. Note that the export must
        /// be complete in order to download it's associated data.
        /// </summary>
        /// <param name="export">An Export object containing information about the export to download</param>
        /// <returns>A URL from which the export data can be downloaded</returns>
        public String GetDownloadUrl(Export export)
        {
            ServiceRequest sr = new ServiceRequest(this.configuration);

            sr.Parameters.Add("exportid", export.Id);
            sr.Server = export.ServerLocation;
            return(sr.ConstructUrl("rustici.export.download"));
        }
Example #4
0
        /// <summary>
        /// Get a URL to target a file import form for importing a course to the SCORM Cloud.
        /// </summary>
        /// <param name="courseId">the desired id for the course</param>
        /// <param name="redirectUrl">the url for the browser to be redirected to after import</param>
        /// <returns></returns>
        public String GetImportCourseUrl(string courseId, string redirectUrl)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            request.Parameters.Add("courseid", courseId);
            if (!String.IsNullOrEmpty(redirectUrl))
            {
                request.Parameters.Add("redirecturl", redirectUrl);
            }
            return(request.ConstructUrl("rustici.course.importCourse"));
        }
     /// <summary>
     /// Calling this method returns a URL which will authenticate and launch a Reportage session, starting
     /// at the specified Reportage URL entry point.
     /// </summary>
     /// <returns>A URL from which the export data can be downloaded</returns>
     public String GetReportUrl(String reportageAuth, String reportUrl)
     {
         ServiceRequest request = new ServiceRequest(configuration);
 	    //Relative path, auto add the right server name
 	    string fullReportUrl = reportUrl;
         if (reportUrl.StartsWith("/Reportage"))
         {
             fullReportUrl = "http://" + request.Server + reportUrl;
         }
         request.Parameters.Add("auth", reportageAuth);
         request.Parameters.Add("reporturl", fullReportUrl);
 	    return request.ConstructUrl("rustici.reporting.launchReport");
     }
Example #6
0
        /// <summary>
        /// Get the url that points directly to a course asset
        /// </summary>
        /// <param name="courseId">Unique Course Identifier</param>
        /// <param name="path">Path to asset from root of course</param>
        /// <param name="versionId">Specific Version</param>
        /// <returns>HTTP Url to Asset</returns>
        public String GetAssetUrl(String courseId, String path, int versionId)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            request.Parameters.Add("courseid", courseId);
            request.Parameters.Add("path", path);
            if (versionId != Int32.MinValue)
            {
                request.Parameters.Add("versionid", versionId);
            }

            return(request.ConstructUrl("rustici.course.getAssets"));
        }
        /// <summary>
        /// Calling this method returns a URL which will authenticate and launch a Reportage session, starting
        /// at the specified Reportage URL entry point.
        /// </summary>
        /// <returns>A URL from which the export data can be downloaded</returns>
        public String GetReportUrl(String reportageAuth, String reportUrl)
        {
            ServiceRequest request = new ServiceRequest(configuration);
            //Relative path, auto add the right server name
            string fullReportUrl = reportUrl;

            if (reportUrl.StartsWith("/Reportage"))
            {
                fullReportUrl = "http://" + request.Server + reportUrl;
            }
            request.Parameters.Add("auth", reportageAuth);
            request.Parameters.Add("reporturl", fullReportUrl);
            return(request.ConstructUrl("rustici.reporting.launchReport"));
        }
Example #8
0
        /// <summary>
        /// Get the url that can be opened in a browser and used to preview this course, without
        /// the need for a registration.
        /// </summary>
        /// <param name="courseId">Unique Course Identifier</param>
        /// <param name="versionId">Version Id</param>
        public String GetPreviewUrl(String courseId, String redirectOnExitUrl, String cssUrl)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            request.Parameters.Add("courseid", courseId);
            if (!String.IsNullOrEmpty(redirectOnExitUrl))
            {
                request.Parameters.Add("redirecturl", redirectOnExitUrl);
            }
            if (!String.IsNullOrEmpty(cssUrl))
            {
                request.Parameters.Add("cssurl", cssUrl);
            }
            return(request.ConstructUrl("rustici.course.preview"));
        }
Example #9
0
        /// <summary>
        /// Gets the url to directly launch/view the course registration in a browser
        /// </summary>
        /// <param name="registrationId">Unique Identifier for the registration</param>
        /// <param name="redirectOnExitUrl">Upon exit, the url that the SCORM player will redirect to</param>
        /// <returns>URL to launch</returns>
        /// <param name="debugLogPointerUrl">Url that the server will postback a "pointer" url regarding
        /// a saved debug log that resides on s3</param>
        public string GetLaunchUrl(string registrationId, string redirectOnExitUrl, string cssUrl, string debugLogPointerUrl)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            request.Parameters.Add("regid", registrationId);
            if (!String.IsNullOrEmpty(redirectOnExitUrl))
            {
                request.Parameters.Add("redirecturl", redirectOnExitUrl);
            }
            if (!String.IsNullOrEmpty(cssUrl))
            {
                request.Parameters.Add("cssurl", cssUrl);
            }
            if (!String.IsNullOrEmpty(debugLogPointerUrl))
            {
                request.Parameters.Add("saveDebugLogPointerUrl", debugLogPointerUrl);
            }

            return(request.ConstructUrl("rustici.registration.launch"));
        }
Example #10
0
        /// <summary>
        /// Return a url that can be embedded in the action attribute of a form element
        /// </summary>
        /// <param name="redirectUrl">The url to redirect to after the upload is complete</param>
        /// <param name="permissionDomain">The permission domain in which the upload should be placed</param>
        public String GetUploadUrl(String redirectUrl, String permissionDomain, UploadToken token)
        {
            ServiceRequest request = new ServiceRequest(configuration);

            request.Parameters.Add("token", token.tokenId);

            //Forget about backend server, just upload through main domain,
            //as it should be fine, and required if using SSL
            //request.Server = token.server;

            if (!String.IsNullOrEmpty(permissionDomain))
            {
                request.Parameters.Add("pd", permissionDomain);
            }
            if (!String.IsNullOrEmpty(redirectUrl))
            {
                request.Parameters.Add("redirecturl", redirectUrl);
            }
            return(request.ConstructUrl("rustici.upload.uploadFile"));
        }
        /// <summary>
        /// Gets the url to directly launch/view the course registration in a browser
        /// </summary>
        /// <param name="registrationId">Unique Identifier for the registration</param>
        /// <param name="redirectOnExitUrl">Upon exit, the url that the SCORM player will redirect to</param>
        /// <returns>URL to launch</returns>
        /// <param name="debugLogPointerUrl">Url that the server will postback a "pointer" url regarding
        /// a saved debug log that resides on s3</param>
        public string GetLaunchUrl(string registrationId, string redirectOnExitUrl, string cssUrl, string debugLogPointerUrl)
        {
            ServiceRequest request = new ServiceRequest(configuration);
              request.Parameters.Add("regid", registrationId);
              if (!String.IsNullOrEmpty(redirectOnExitUrl))
            request.Parameters.Add("redirecturl", redirectOnExitUrl);
              if (!String.IsNullOrEmpty(cssUrl))
            request.Parameters.Add("cssurl", cssUrl);
              if (!String.IsNullOrEmpty(debugLogPointerUrl))
            request.Parameters.Add("saveDebugLogPointerUrl", debugLogPointerUrl);

              return request.ConstructUrl("rustici.registration.launch");
        }
 /// <summary>
 /// Get the url that can be opened in a browser and used to preview this course, without
 /// the need for a registration.
 /// </summary>
 /// <param name="courseId">Unique Course Identifier</param>
 /// <param name="versionId">Version Id</param>
 public String GetPreviewUrl(String courseId, String redirectOnExitUrl, String cssUrl)
 {
     ServiceRequest request = new ServiceRequest(configuration);
     request.Parameters.Add("courseid", courseId);
     if (!String.IsNullOrEmpty(redirectOnExitUrl))
         request.Parameters.Add("redirecturl", redirectOnExitUrl);
     if (!String.IsNullOrEmpty(cssUrl))
         request.Parameters.Add("cssurl", cssUrl);
     return request.ConstructUrl("rustici.course.preview");
 }
 /// <summary>
 /// Get a URL to target a file import form for importing a course to the SCORM Cloud.
 /// </summary>
 /// <param name="courseId">the desired id for the course</param>
 /// <param name="redirectUrl">the url for the browser to be redirected to after import</param>
 /// <returns></returns>
 public String GetImportCourseUrl(string courseId, string redirectUrl)
 {
     ServiceRequest request = new ServiceRequest(configuration);
     request.Parameters.Add("courseid", courseId);
     if (!String.IsNullOrEmpty(redirectUrl))
         request.Parameters.Add("redirecturl", redirectUrl);
     return request.ConstructUrl("rustici.course.importCourse");
 }
        /// <summary>
        /// Get the url that points directly to a course asset
        /// </summary>
        /// <param name="courseId">Unique Course Identifier</param>
        /// <param name="path">Path to asset from root of course</param>
        /// <param name="versionId">Specific Version</param>
        /// <returns>HTTP Url to Asset</returns>
        public String GetAssetUrl(String courseId, String path, int versionId)
        {
            ServiceRequest request = new ServiceRequest(configuration);
            request.Parameters.Add("courseid", courseId);
            request.Parameters.Add("path", path);
            if (versionId != Int32.MinValue)
            {
                request.Parameters.Add("versionid", versionId);
            }

            return request.ConstructUrl("rustici.course.getAssets");
        }
        public void launch()
        {
            ServiceRequest req = new ServiceRequest(cfg);
            req.Parameters.Add("auth", "no auth");
            req.Parameters.Add("reporturl", "http://scorm.com");
            string url = req.ConstructUrl("rustici.reporting.launchReport");

            WebRequest wr = HttpWebRequest.Create(url);
            ((HttpWebRequest)wr).AllowAutoRedirect = false;
            WebResponse rsp = wr.GetResponse();

            Console.WriteLine(((HttpWebResponse)rsp).StatusCode);
            Console.WriteLine(((HttpWebResponse)rsp).StatusDescription);

            Console.WriteLine("Header: ");
            foreach (string key in ((HttpWebResponse)rsp).Headers.AllKeys)
            {
                Console.WriteLine(string.Format("{0} : {1}", key, rsp.Headers[key]));
            }
            Console.WriteLine("end of header");

            Console.WriteLine(rsp.ResponseUri);


            Console.WriteLine(new StreamReader(rsp.GetResponseStream()).ReadToEnd());
        }
        /// <summary>
        /// Return a url that can be embedded in the action attribute of a form element
        /// </summary>
        /// <param name="redirectUrl">The url to redirect to after the upload is complete</param>
        /// <param name="permissionDomain">The permission domain in which the upload should be placed</param>
        public String GetUploadUrl(String redirectUrl, String permissionDomain, UploadToken token)
        {
            ServiceRequest request = new ServiceRequest(configuration);
            request.Parameters.Add("token", token.tokenId);

            //Forget about backend server, just upload through main domain,
            //as it should be fine, and required if using SSL
            //request.Server = token.server;

            if (!String.IsNullOrEmpty(permissionDomain)) {
                request.Parameters.Add("pd", permissionDomain);
            }
            if (!String.IsNullOrEmpty(redirectUrl)) {
                request.Parameters.Add("redirecturl", redirectUrl);
            }
            return request.ConstructUrl("rustici.upload.uploadFile");
        }
 /// <summary>
 /// Calling this method returns a URL to the actual export data for a given export. Note that the export must 
 /// be complete in order to download it's associated data.
 /// </summary>
 /// <param name="export">An Export object containing information about the export to download</param>
 /// <returns>A URL from which the export data can be downloaded</returns>
 public String GetDownloadUrl(Export export)
 {
     ServiceRequest sr = new ServiceRequest(this.configuration);
     sr.Parameters.Add("exportid", export.Id);
     sr.Server = export.ServerLocation;
     return sr.ConstructUrl("rustici.export.download");
 }