Facebook ads api : how to get photo_id for creating canvas photo - facebook-graph-api

In facebook ads api, i want to create an instant experience. So i'm creating the Instant Experience image as a first step (https://developers.facebook.com/docs/marketing-api/guides/collection/)
So i got id of the image uploaded in the ad account gallery for creating canvas photo.
canvas_photo={
"photo_id": $photo_id, // id of the image
}
But that's giving me an error
**(#100) Param canvas_photo[photo_id] must be a valid photo id **
Please guide me how to get a PHOTO_ID for creating canvas photo

Related

How to post a photo to a page with a tagged Product via Graph API v12.0?

We have a Facebook Shop and a Business Page, and are using Facebook Graph API to create Photo posts on the Business Page using the Javascript SDK running in a browser. How do you include the tagged Product in the Create Photo request?
https://developers.facebook.com/docs/graph-api/reference/photo/ mentions a tags field you can pass which is described as "Tags on this photo", however it has a tag_uid "The user_id of the tagged person". Is this tags field how you are supposed to tag a product?
A similar question from 2017 was not answered and is so old I thought I'd post a new one: Publish new facebook post with tagged product
What we've tried so far
To get a list of our products, we can use GET ${businessId}/owned_product_catalogs to retrieve a list of catalogs, and then GET ${productCatId/products with a filter: '{"custom_label_0":{"eq":"something_to_match"}}' to get a specific product in the catalog. So now we have the ID of a product we want to tag e.g. "4378279312278116". (we happen to use custom_label_x fields meaningfully, of course the filter could have been something else but this works for us)
To create the photo post, we can POST /${account.id}/photos with a payload like:
{ caption: 'Test caption',
url: image_url,
access_token: account.access_token,
tags: [
{
tag_uid: "4378279312278116",
tag_text: 'Test tag',
x: 10, y: 10
}
]
}
This request completes OK and does post the photo, but nothing is tagged on it when we view it on our page.
Trying to read the photo with GET ${photo_id} only returns basic infomation fields created_time, id, name. I can't see how to read further fields on the photo object to check if the tags data was associated with it correctly.
Any advice please?

Share multiple videos on one page onto facebook page wall

I'm using Facebook C# SDK to post on fan page wall. (I created FBApp ext...) and using FB connect (Javascript) to user login, with this scope - "publish_actions,manage_pages,publish_stream". after user login i got an access_token to post on the page.
I have a page, and on the page settings "Everyone can add photos and videos to Testpage's timeline" is checked.
I can post message and picture, but when i tried to post a video (Youtube URL), it's appears on section "Recent Posts by Others on Testpage". When the Everyone can add photos and videos to Testpage's timeline" is not checked, I don't see any post.
To post a video on page, I must enabled "Everyone can add photos and videos to Testpage's timeline"?
When i success to post a video, Why the video appears on "Recent Posts by Others on Testpage"?
My Facebook user is admin on the page and I'm login with this user.
Thank's
To do this, you need to get the access token from the user accounts, and not from the FB.Login.
string getPagesTokensUrl = string.Format(#"https://graph.facebook.com/me/accounts?access_token={0}",accessToken);
using (WebClient wc = new WebClient())
{
var pagesTokens = wc.DownloadString(getPagesTokensUrl);
JObject o = JObject.Parse(pagesTokens);
for (int i = 0; i < o["data"].Count(); i++)
{
if (o["data"][i]["id"].ToString() == ConfigurationManager.AppSettings["YOUR PAGE ID"])
{
return o["data"][i]["access_token"].ToString();
}
}
}

Upload photo to facebook fanpage appcelerator titanium

I have an app that lets me take a pic or choose from my gallery and upload it to my personal fb page.
How can I let it upload to my fanpage instead of my own page?
I use this for putting it in my page:
var data = {picture: image};
Titanium.Facebook.requestWithGraphPath('me/photos', data, "POST", function(e){
if(e.success) {
var d = Titanium.UI.createAlertDialog({
title: Titanium.App.Properties.getString("namn"),
message: 'Uploaded!',
buttonNames: ['Ok'],
});
d.show(); }
It wont just work to change the 'me/photos' to 'pageid/photos'.
What will I have to do to get it to work?
Thanx
As described under the photos secion in the Graph API Documentation for
Page
You should name the parameter source and not picture
Also, make sure you have the publish_stream and manage_pages permissions

not full information returned in Graph API

I am trying to get the url for specific post on friends page that I liked.
Post should be made by 3d user no friends page by these steps:
Put to message some url to facebook open page (e.g.
https://developers.facebook.com/tools/explorer/ )
Wait while url data is loaded to message
Remove only url from post, all loaded data should be presented!
Write some text, e.g. "message"
I liked that message on friend's wall.
I've got it's id using fql.query request
select id, type from object_url where id in (select object_id from like where user_id = <your_id>)
But when I select data by this id using graph api or fql.query, i can't get the url from these post! !

Graph API equivalent for sharing photo?

Trying to create a wall post with photo attached. Photo is a Facebook-hosted photo within some album.
Problem here - Facebook won't allow including facebook-hosted content in posts ((#100) FBCDN image is not allowed in stream )
From the Web UI, it's possible to "Share" a photo on my wall - that's almost what i need but i don't know the Graph API equivalent for that operation (if there's any)
Any help appreciated.
The answer is "me/links"
passing http://www.facebook.com/photo.php?fbid=** as a link
With the Graph API you can share the photo as a link.
this is the documentation:
https://developers.facebook.com/docs/reference/api/user/#links
You need send a POST request to me/feed/. And indeed send the link: http://www.facebook.com/photo.php?fbid=[the id of the photo]
Make sure the publish_stream permission is allowed for the access_token.
with Jquery this is an example:
$.post(
'http://www.facebook.com/me/feed',
{
link: 'http://www.facebook.com/photo.php?fbid=[THE_PHOTO_ID],
access_token: [YOUR_ACCESS_TOKEN]
},
function(result) { console.log('shared'); },
'text'
);