I have all the boards of logged in user and using Pinterest api I am able to fetch the pins from given board but Create pins is not working.
I have create Application on Pinterest Developer https://developers.pinterest.com/
As per document , I have added collaborator for authenticated users. Send perfect parameters for create pins after permission api.
I got perfect response in permission api and in boards but getting error in create pin from my application.
Please look below my code:
PDKClient.sharedInstance().createPin(withImageURL: URL.init(string: aImageUrl), link: URL.init(string: "https://www.pinterest.com"), onBoard: myBoardID, description: "Hello All", withSuccess: { (response) in
//print(response)
print("Pinterest sucess")
}, andFailure: { (error) in
print(error as Any)
print("Pinterest Fail")
})
For this api I am always getting 404 or 400 error.
Please help me for that.
Thanks in advance.
Related
I try to upload video to Facebook using Graph API.
But always see error message
(#100) No permission to publish the video.
Facebook app has Development mode. I created test user there. My role is admin. FB access token is valid.
Here my code here:
private func upload(url: URL) {
guard let data = try? Data(contentsOf: url) else { return }
let connection = GraphRequestConnection()
connection.delegate = self
var items: [String: Any] = [:]
items["title"] = "Test title from api"
items["\(url.absoluteString)"] = data
let keys = ["value" : "EVERYONE"]
items["privacy"] = keys
let request = GraphRequest(graphPath: "me/videos", parameters: items, httpMethod: .post)
connection.add(request) { reqconnection, anyInfo, error in
print(reqconnection)
print(anyInfo)
print(error)
}
connection.start()
}
I saw a lot of questions about it, but mostly they are too old and don't work for me.
Share video to FB
From thread FB Developers here - the same error, but they didn't find solution
Also check this docs - doesn't work
Also I'm a bit confused what docs are right for post video in Facebook.
Because in docs I see
The Video API allows you to publish Videos on Pages and Groups. Publishing on Users is not supported.
but also in another docs see Graph API with path me/videos. So it confused me a bit.
What docs are correct for my case:
here
here
From docs I see that
Your app should manage permissions as follows:
Graph API Requests - Before you send Graph API requests, you should check for necessary permissions and request them if needed.
Where can I find permission publish_actions?
Please help to figure out how to fix that.
I only can upload via ShareDialog. Like here and docs here
I'm using pod 'SwiftInstagram', '~> 1.0.6' for Instagram login and fetching user
This error is coming from fetching Instagram followers list.
private var api = Instagram.shared
func getUserFollowers (completionHandler: #escaping (Bool, InstagramUsersObject?, String?) -> Swift.Void) {
api.userFollowers(success: { (users) in
// success, got the user followers
print(users)
let followersList = self.createJSONObjectForInstagramUsers(data: users)
let userList = Mapper<InstagramUsersObject>().map(JSONObject: followersList)
print(followersList)
completionHandler(true, userList, "")
}) { (error) in
// error while fetching user followers
//InstagramError(kind: invalidRequest, message: "This endpoint has been retired")
print(error)
completionHandler(false, nil, error.localizedDescription)
}
}
As per Instagram API changelog the /users endpoint has been suddenly deprecated (previously it was annunced that the deprecation would have occurred on July 31st). All the followers and relationship related informations were fetched through the /users endpoint. I suppose that every app or framework was using this endpoint to retrieve the followers and related information, as I'm not aware of any other method, and now it is no longer possible with any of the new Graph APIs.
Please understand there are 4 major changes using Instagram API.
Few endpoints are permanently deprecated with effect from 4th April
There is change API response in few cases.
Change in API rate limit from 30th March
No new app registration allowed
So presently error you are facing is related to the first issue, Please change your code to handle other 3 scenarios.
https://www.instagram.com/developer/changelog/
https://www.instagram.com/developer/
I am experiencing issue while trying to create pin with Pinterest SDK, I use this code:
PDKClient.sharedInstance().createPin(with: imageToShare, link: URL.init(string: "https://someUrl"), onBoard: "MyBoard", description: "",
progress: { (percent) in
}, withSuccess: { (response) in
print("Success")
}) { (error) in
if let error = error {
print(error)
}
}
And I receive this particular response:
Error Domain=com.alamofire.error.serialization.response Code=-1011
"Request failed: not found (404)" UserInfo
{NSLocalizedDescription=Request failed: not found (404),
NSErrorFailingURLKey=https://api.pinterest.com/v1/pins/
User is logged in into Pinterest application, just before calling this line of code, I am able to successfully create board with name MyBoard via the same API, but I am stuck within creation of the pin.
I tried to create pin with image url (because I thought that maybe it is because of my image), but it outputs the same response.
I am using twitter and facebook sdk within the same code, Info.plist seems allright.
Any clues?
Apparently the problem was, that onBoard actually requires not a board name, but it's identifier. So when you create pin board programatically -- (PDKClient.sharedInstance().createBoard) you should fetch and save it's identifier, which can be fetched in response (response.board().identifier).
I was stuck within this problem for the past 1.5 hours and figured it out just after posting the question :) I think it can be useful for someone else, because official SDK wiki is not very informative and git repository is quite dead too.
I am trying to retrieve all pages a user has liked on Facebook in my app. Taking from the Graph API, here is my code:
let request3 = FBSDKGraphRequest(graphPath: "/me/likes", parameters: ["fields": "id,name,picture, user_likes"])
request3.startWithCompletionHandler({ (connection3, result3, erreur3) -> Void in
if erreur3 == nil {
print(result3)
}
else {
print(erreur3)
}
})
this code yields this:
{
data = (
);
}
I also tried "me/likes", and it gave me the same empty data set. I tried some of the answers here Facebook Graph API - likes returns me an empty set as well but none of those worked.
I have the "user_likes" permission, and I have a valid AccessToken as well.
Also, I have set my Facebook likes to public, so I know they aren't being hidden because of privacy settings. Any idea how to get the user likes?
thanks
See this is screenshot i got data ..
if you have don't permission on graph explore then you don't get any result..
in a development you add permission on graph explorer then after when you live your app you need to submit your app for permission.
if you have any query then tell me i will help you.
I want to use the YouTube Data API to get the links to thumbnails for a specific YouTube video in my iOS app. I went to Google Developers Console and created a new project.
For that project I then went to "APIs" and removed the default APIs it enables for me and added the YouTube Data API. I then went to credentials, created a Public Key (as I don't need the user to log in or anything, just getting the thumbnail URLs) as iOS, which gave me an API key. I added the Bundle Identifier for my project under Allowed Applications.
Now in my app I tried the following code:
let test = NSURLSession.sharedSession().dataTaskWithURL(NSURL(string: "https://www.googleapis.com/youtube/v3/videos?id=7lCDEYXw3mM&key=*MYKEYHERE*&part=snippet,contentDetails,statistics,status")!, completionHandler: { (data, response, error) -> Void in
let json = NSJSONSerialization.JSONObjectWithData(data, options: nil, error: nil)
println("JSON: \(json)")
})
But it prints out the error:
JSON: Optional({
error = {
code = 403;
errors = (
{
domain = usageLimits;
message = "Access Not Configured. Please use Google Developers Console to activate the API for your project.";
reason = accessNotConfigured;
}
);
message = "Access Not Configured. Please use Google Developers Console to activate the API for your project.";
};
})
What exactly am I doing wrong?
There is a known problem about Bundle id in the console. If you can just remove that restriction, it should just work fine.
You can track the original issue from here: https://code.google.com/p/gdata-issues/issues/detail?id=5770
Here's what you need, YouTube has a service API via web to consult this types of things. I'm using this URL to consult all videos from a user (getting every videos: URL, Thumbnail, views, duration, etc). I'm sure you'll find thumbnails for a particular video. Its a JSON response so you'll have to take a good look to the structure but can't get simpler than this.
http://gdata.youtube.com/feeds/api/users/USER_NAME/uploads?v=2&alt=json&#&start-index=1&max-results=10