if request.path.find('/static/') != -1 or request.path == '/code':
if not 'login' in session and not 'admin_auth' in session and not 'down' in session:
session.clear()
return abort(401)
i dont't have idea with these parametersis there any idea to ignore this command so that my api will work
API Issue with aapanel
Madhvi
Can you show me your api method and parameters?
aaPanel_Jose
//MARK:- Post & Get Api Interaction
func postData(urlStr: String, params: Dictionary? = nil, showIndicator: Bool = true, completion: @escaping (ApiResponse?) -> Void) {
if NetworkReachabilityManager()!.isReachable {
if showIndicator {
Proxy.shared.showActivityIndicator()
}
AF.request("\(Apis.serverUrl)\(urlStr)",
method: .post,
parameters: params!,
encoding: URLEncoding.httpBody,
headers:[ "Authorization": "Bearer \(Proxy.shared.accessTokenNil())",
"User-Agent":"\(AppInfo.userAgent)"]).responseJSON { response in
debugPrint("Url,\(Apis.serverUrl)\(urlStr), Acces-Token, \(Proxy.shared.accessTokenNil())")
debugPrint("PostParam", "\(params!)")
Proxy.shared.hideActivityIndicator()
if response.data != nil && response.error == nil {
debugPrint("RESPONSE",response.value!)
debugPrint("JSON-RESPONSE", NSString(data: response.data!, encoding: String.Encoding.utf8.rawValue)!)
let dict = response.value as? [String:AnyObject]
if let dateCheck = dict!["datecheck"] as? String {
if !Proxy.shared.expiryDateCheckMethod(expiryDate: dateCheck) {
return
}
}
if response.response?.statusCode == 200 {
let res : ApiResponse?
res = ApiResponse(jsonData: response.data!, data: dict, message: dict!["message"] as? String ?? AlertTitle.success)
completion(res!)
} else if response.response?.statusCode == 400 {
Proxy.shared.displayStatusCodeAlert( dict!["error"] as? String ?? AlertTitle.error)
} else {
self.statusHandler(response.response, data: response.data, error: response.error as NSError?)
}
} else {
self.statusHandler(response.response, data: response.data, error: response.error as NSError?)
}
}
} else {
Proxy.shared.hideActivityIndicator()
Proxy.shared.openSettingApp()
}
}
func getData(urlStr: String, showIndicator: Bool = true, completion: @escaping (ApiResponse?) -> Void) {
if NetworkReachabilityManager()!.isReachable {
if showIndicator {
Proxy.shared.showActivityIndicator()
}
AF.request("\(Apis.serverUrl)\(urlStr)",
method: .get, parameters: nil,
encoding: JSONEncoding.default,
headers:[ "Authorization": "Bearer \(Proxy.shared.accessTokenNil())",
"User-Agent":"\(AppInfo.userAgent)"] ).responseJSON { response in
debugPrint("Url,\(Apis.serverUrl)\(urlStr), Acces-Token, \(Proxy.shared.accessTokenNil())")
Proxy.shared.hideActivityIndicator()
if response.data != nil && response.error == nil {
debugPrint("RESPONSE",response.value!)
debugPrint("JSON-RESPONSE", NSString(data: response.data!, encoding: String.Encoding.utf8.rawValue)!)
let dict = response.value as? [String:AnyObject]
if let dateCheck = dict!["datecheck"] as? String {
if !Proxy.shared.expiryDateCheckMethod(expiryDate: dateCheck) {
return
}
}
if response.response?.statusCode == 200 {
let res : ApiResponse?
res = ApiResponse(jsonData: response.data!, data: dict, message: dict!["message"] as? String ?? AlertTitle.success)
completion(res!)
} else if response.response?.statusCode == 400 {
Proxy.shared.displayStatusCodeAlert( dict!["error"] as? String ?? AlertTitle.error)
} else {
self.statusHandler(response.response, data: response.data, error: response.error as NSError?)
}
} else {
self.statusHandler(response.response, data: response.data, error: response.error as NSError?)
}
}
} else {
Proxy.shared.hideActivityIndicator()
Proxy.shared.openSettingApp()
}
}
\
aaPanel_Jose
its post and get method i am used
"LoginForm[username]": request.email! as AnyObject ,
"LoginForm[password]": request.password! as AnyObject ,
"LoginForm[device_token]" : "(Proxy.shared.deviceToken())",
"LoginForm[device_type]" : "(DeviceInfo.deviceType)",
"LoginForm[device_name]" : "(DeviceInfo.deviceName)"
login parameters
any update on this
aaPanel_Jose
Hi any update with this issue
Hello@Madhvi#13222
I checked your code and found that your parameters may not meet the api request specification, please refer to the API documentation we provide
aaPanel_Jose
Hi is there any way so to ignore the api request specification, so that my api will work
aaPanel_Jose
Any update wit this
Madhvi
Do you want to request the API of the panel or your own API?
aaPanel_Jose
we have our project on this aa-panel and wants that project api to run but it gives error.
we have not made any change or any work with the panel api
aaPanel_Jose
hi any update with this
aaPanel_Jose
any update with this issue
Madhvi
I still don’t know much about the specific problem. If you need to shield parameter authentication, you can try to comment out all the code of the request_check method.