i'm using swift in my app
and i'm trying to post a relationship (Follow) with scope ("follower_list+relationships") using Alamofire
Note: I'm using sandbox users for testing
with this code
let userid = "testAccount"
let urlString = "https://api.instagram.com/v1/users/\(userid)/relationship?access_token=\(INSTAGRAM_IDS.INSTAGRAM_Token)&action=follow"
Alamofire.request(urlString).responseJSON { response in switch response.result {
case .success(let JSON):
let response = JSON as! NSDictionary
let userModel = response
print("SUCCESS")
print(userModel)
case .failure(let error):
print("ERROR")
print(error)
}
}
and also tried this one
let userid = "testAccount"
let urlString = "https://api.instagram.com/v1/users/\(userid)/relationship?access_token=\(INSTAGRAM_IDS.INSTAGRAM_Token)"
let parameters: Parameters = ["action": "follow"]
Alamofire.request(urlString, method: .post, parameters: parameters, encoding: URLEncoding.default, headers: nil).responseJSON { response in switch response.result {
case .success(let JSON):
let response = JSON as! NSDictionary
let userModel = response
print("SUCCESS")
print(userModel)
case .failure(let error):
print("ERROR")
print(error)
}
}
BUT still got this message ??
ERROR responseSerializationFailed(Alamofire.AFError.ResponseSerializationFailureReason.jsonSerializationFailed(Error Domain=NSCocoaErrorDomain Code=3840 "Invalid value around character 0." UserInfo={NSDebugDescription=Invalid value around character 0.}))
any idea ??