2015-04-07 91 views
2

我试图访问edx课程信息到我的iOS应用程序。最好是,我想让用户访问他们正在参加的课程列表。从edX API检索数据

当我使GET请求,我的数据显示如下: “未提供认证证书。”

{

详细=;

}

这里是我的代码:

import UIKit 
import Alamofire 

let kEdxResourceURL = "http://mobile3.m.sandbox.edx.org/" 

class ViewController: UIViewController { 

    override func viewDidLoad() { 
     super.viewDidLoad() 

     Alamofire.request(.GET, kEdxResourceURL + "api/mobile/v0.5/users/wedu/course_enrollments/").responseJSON() { 
     (_, _, data, _) in 
      println(data!) 
     } 
    } 
} 
+0

它说你必须通过身份验证凭据为特定用户获得它报名参加课程。 – Jay

回答

0

即使移动V0.5已过时,让我从开放API给予edX开发指南复制此。

EDX API认证 的OAuth 2.0 通过EDX平台API使用OAuth 2.0进行身份验证。 OAuth 2.0是许多需要安全用户身份验证的系统使用的开放标准。有关更多信息,请参阅OAuth 2.0标准。 注册您的开放edX实例

要使用edX Platform API和Open edX实例的课程,您必须使用Open edX服务器注册您的应用程序。有关详细信息,请参阅OAuth 2.0规范。

http://edx.readthedocs.io/projects/edx-platform-api/en/latest/authentication.html