在進行程序的開發之前,我們需要獲得物流唐山APP的API,在這里我推薦大家使用Charles抓取數據包獲得API。以下是Charles說明:
Charles 是在 Mac 下常用的網絡封包截取工具,在做移動開發時,我們為了調試與服務器端的網絡通訊協議,常常需要截取網絡封包來分析。Charles 通過將自己設置成系統的網絡訪問代理服務器,使得所有的網絡訪問請求都通過它來完成,從而實現了網絡封包的截取和分析。除了在做移動開發中調試端口外,Charles 也可以用於分析第三方應用的通訊協議。配合 Charles 的 SSL 功能,Charles 還可以分析 Https 協議。
Charles 主要的功能包括:
1.截取 Http 和 Https 網絡封包。
2.支持重發網絡請求,方便后端調試。
3.支持修改網絡請求參數。
4.支持網絡請求的截獲並動態修改。
5.支持模擬慢速網絡。
接下來就是我講介紹Charles的使用,首先,下載安裝Charles,打開Charles,如下圖所示進行設置:

在此填入代理端口,如8888,點擊ok。

然后:

打開設置—>網絡,獲得本機ip地址192.168.1.103

接下來就是使用iPhone進行設置,首先保證手機與電腦在同一個局域網,點擊連接的WIFI,在HTTP代理選項點擊手動,輸入電腦的ip地址以及我們設置的代理端口8888

使用Safari隨便打開一個網頁,發現Charles已經可以使用了。

接下來打開物流唐山APP,可以看到數據包已經被抓取到了

接下來就是查看每個請求的Request和Response,在這里我們可以看到GetMapPoint(首頁地圖API)請求使用GET方法。
Request參數,mMapx,mMapY,mtype。

Response返回結果:json數據,字典數組。

以下是我抓取的API列表:
- #define TSLAPI_PREFIX @"http://www.560315.com/MobileAPI/"
- #define TSLAPI_UPDATE @"versionIOS" //更新
- #define TSLAPI_MAP @"getMapPoint" //地圖
- #define TSLAPI_SHARE @"shareList" //分享
- #define TSLAPI_LOGIN @"Login" //登錄
- #define TSLAPI_REGISTER @"SaveUser" //注冊
- #define TSLAPI_SAVEPWD @"SavePwd" //修改密碼
- #define TSLAPI_RECOMMEND @"InformationRecommend" //熱點關注
- #define TSLAPI_GoodsSource @"WlGoodsSourceInfoList" //貨源
- #define TSLAPI_VehicleSource @"SearchWlVehicleSourceInfo" //車源
- #define TSLAPI_Warehouse @"WarehouseList" //庫源
- // 第1列
- #define TSLAPI_DistributionStation @"DistributionStationList" //配貨站
- // 找加油站 SearchUserInfo?type=20
- // 找加氣站 SearchUserInfo?type=19
- // 找維修站 SearchUserInfo?type=21
- // 第2列
- #define TSLAPI_Railway @"LogisticsRailwayList" //物流專線
- // 找物流企業 SearchUserInfo
- #define TSLAPI_GoodsMasterList2 @"GoodsMasterList2" //發貨企業
- #define TSLAPI_DistributionCenter @"DistributionCenterList" //配送中心
- #define TSLAPI_ExpressStation @"ExpressStationList" //快遞網點
- #define TSLAPI_Terminal @"WlTerminalList" //末端網點
- // 第3列
- #define TSLAPI_Park @"LogisticsParkList" //園區
- #define TSLAPI_shebei @"WlshebeiList" //設備
- #define TSLAPI_Finance @"LogisticsFinanceList" //金融
- #define TSLAPI_People @"Hrm_ResumeList" //人才
- #define TSLAPI_Specialyer @"Specialyer" //專家
- // 第4列
- #define TSLAPI_Information @"SearchInformationList" //資訊
- #define TSLAPI_Price @"SearchLookForPrice" //運價
- // 找統計
- #define TSLAPI_Company @"Hrm_CompanyList" //招聘
- #define TSLAPI_AudioAdd @"AudioAdd" // 音頻
- #define TSLAPI_FeedBackSave @"FeedBackSave" // 音頻返回提交
- #define TSLAPI_CollectionSave @"User_CollectionSave" // 收藏
- #define User_CollectionList @"User_CollectionList" // 收藏列表
- #define TSLAPI_IMAGES @"http://www.560315.com/Content/Web/images/Information/"//圖片
