コード例 #1
0
			protected override IRequest DoRequest(string method, string url, Requests.RequestOptions options)
			{

				string full_url = _requests.ApiServer + "/SensorCloud/devices/" + _requests.DeviceId + url;
				options.AddParam("auth_token", _requests.AuthToken);
				var request = base.DoRequest(method, full_url, options);
				
				//if we get an authentication error, reatuheticate, update the authToken and try to make the request again
				if(request.ResponseCode == System.Net.HttpStatusCode.Forbidden)
				{
					_requests.Authenticate();

					full_url = _requests.ApiServer + "/SensorCloud/devices/" + _requests.DeviceId + url;
					options.AddParam("auth_token", _requests.AuthToken);
					request = base.DoRequest(method, full_url, options);
				}

				return request;
			}