I'm currently trying to access, through my marketing app, all the insights of my ads/campaings/ads account (clicks,impressions,etc). The tokens I generate has permissions for ads_management,ads_read,read_insights and manage_pages.
Nevertheless, I always get this answer:
{"data":[],"paging":{"cursors":{"before":"MAZDZD","after":"LTEZD"}}}
(I get that response after I post something like
curl -G \
-d "fields=impressions" \
-d "access_token=my_access_token" \
"https://graph.facebook.com/v2.8/act_MyAccountNumber/insights"
And then make a get using the report id, when the report id is completed)
I added my account as admin of the app and also added it in the Authorized Ad Account IDs list.
My app has development level access.
What am I doing wrong?
Are you sure you had impressions recently?
Because I observe similar thing when try to access it with default date_preset that is 30 days:
> get "act_*****/insights", "impressions"
=> []
> get "act_*****/insights?date_preset=lifetime", "impressions"
=> ["11"]
Related
Im trying to get the active users who were logged in past one week. but there only one API which gives currently active sessions(users). is there any way to get all the active user Id or user count who were logged-in in one week ?
I tried API /sessions api which gave me only currently active users
If you are using IS-6.0.0, this option can be used.
Enable the following event handler in deployment.toml file to update the last logon time of the users when they log into applications.
[identity_mgt.events.schemes.identityUserMetadataMgtHandler.properties]
enable=true
It will update the login timestamp in http://wso2.org/claims/identity/lastLogonTime claim.
Use SCIM API to filter out users who has last logon time between given two time stamps.
Sample CURL:
curl --location --request GET 'https://localhost:9443/scim2/Users?filter=urn:ietf:params:scim:schemas:extension:enterprise:2.0:User.lastLogonTime+ge+1674065031350+and+urn:ietf:params:scim:schemas:extension:enterprise:2.0:User.lastLogonTime+le+1674065770177&count=10&startIndex=1' \
--header 'Authorization: Basic YWRtaW46YWRtaW4='
NOTE: This filtering will work only when pagination parameters are given.
filter=urn:ietf:params:scim:schemas:extension:enterprise:2.0:User.lastLogonTime+ge+1674065031350+and+urn:ietf:params:scim:schemas:extension:enterprise:2.0:User.lastLogonTime+le+1674065770177 -> means that filter the users who has last logon time greater than 1674065031350 and less than 1674065770177
Is there any admin service similar to RemoteUserStoreManagerService present in wso2 apim 1.10 to get information about what api is published by a particular user and what api he is subscribed?
I know we can get this information from database, but I want to use admin service.
Thanks,
Santosh
You can use Store Jaggery APIs in APIM 1.10.0 for this.
To get all APIs created by user john.
1) Login as admin user (or any other user who has both publisher and store access)
curl -X POST -c cookies http://localhost:9763/store/site/blocks/user/login/ajax/login.jag -d 'action=login&username=admin&password=admin'
2) Search for APIs published by john.
curl -X POST -b cookies "http://localhost:9763/store/site/blocks/search/api-search/ajax/search.jag" -d "action=searchAPIs&query=provider:john&start=0&end=3"
To get all APIs subscribed by user john
1) Login as user john.
curl -X POST -c cookies http://localhost:9763/store/site/blocks/user/login/ajax/login.jag -d 'action=login&username=john&password=pass'
2) Get all subscriptions
curl -b cookies http://localhost:9763/store/site/blocks/subscription/subscription-list/ajax/subscription-list.jag?action=getAllSubscriptions
I am trying to make a POST request to the Facebook API to create instant articles, like so:
curl \
-F 'access_token={access token}' \
-F 'html_source="<!doctype html><html>blah blah blah</html>"' \
-F 'published=true' \
-F 'development_mode=false' \
https://graph.facebook.com/{page-id}/instant_articles
I am an admin for the app, and when I debug my access token, the scope shows email, pages_show_list, pages_manage_instant_articles, public_profile, but the request returns this error:
{"error":
{"message":"(#200) Requires pages_manage_instant_articles permission to manage the object",
"type":"OAuthException",
"code":200,
"fbtrace_id":"Exyv2VtZ5m4"}
}
Anyone have any ideas about what's going on? Thanks and let me know if you need more info!
Solved! I added the version to the url.
https://graph.facebook.com/v2.7/{page-id}/instant_articles
When I first worked with Graph API I faced the same issue but that was in Android.
Although the solution in my case, user / admin have to sign in first and give permission to access facebook data using GraphAPI
I'm just starting out with Facebook SSO and OpenGraph. I have SSO working with my iOS app and now I'm starting to see how to publish OpenGraph actions.
I've set up a new Action Type and I need to submit it. When I do, I get the error:
You must publish at least one action to your Timeline using this action type. Review the documentation.
Ok, so I click the helpful documentation link and it tells me I want to do this:
https://graph.facebook.com/me/recipebox:cook?recipe=http://www.example.com/pumpkinpie.html&access_token=YOUR_ACCESS_TOKEN
So I translate that into this:
https://graph.facebook.com/me/fotoferret:hug?ferret=http://www.example.com/pumpkinpie.html&access_token=MY_ACCESS_TOKEN
fotoferret is my namespace, hug is my action
where MY_ACCESS_TOKEN is the value returned by:
https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=MY_APP_ID&client_secret=MY_APP_SECRET
When I pasted my translated URL I get this error back:
{
"error": {
"message": "An active access token must be used to query information about the current user.",
"type": "OAuthException",
"code": 2500
}
}
an this point I'm confused. I've tried publishing an action to my timeline, but it tells me a I need an active access token, which I've provided. So how can I publish an action?
When using an app access token please use the ID of the user not /me. You are doing actions on behalf of the app not directly of the user.
User Access Token
https://graph.facebook.com/me/fotoferret:hug?ferret=http://www.example.com/pumpkinpie.html&access_token=MY_ACCESS_TOKEN
App Access Token
https://graph.facebook.com/ID/fotoferret:hug?ferret=http://www.example.com/pumpkinpie.html&access_token=MY_ACCESS_TOKEN
When using the Graph Explorer be sure to switch the option to POST and not get GET. GET is set by default so it will return the actions not create one.
Or using cURL
curl -F 'access_token=MY_ACCESS_TOKEN' \
-F 'ferret=http://www.example.com/pumpkinpie.html' \
https://graph.facebook.com/ID/fotoferret:hug
If you have "Requires App Token to Publish" enabled and get
{"error":{"message":"(#15) This method must be called with an app access_token.","type":"OAuthException","code":15}}
It means you are using
curl -F 'access_token=MY_ACCESS_USER_TOKEN' \
-F 'ferret=http://www.example.com/pumpkinpie.html' \
https://graph.facebook.com/me/fotoferret:hug
Use MY_APP_TOKEN. If you get,
{"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500}}
it means you are using
curl -F 'access_token=MY_APP_TOKEN' \
-F 'ferret=http://www.example.com/pumpkinpie.html' \
https://graph.facebook.com/me/fotoferret:hug
You should use the numeric id
curl -F 'access_token=MY_APP_TOKEN' \
-F 'ferret=http://www.example.com/pumpkinpie.html' \
https://graph.facebook.com/ID/fotoferret:hug
If you get
{"error":{"message":"(#200) Requires extended permission: publish_actions","type":"OAuthException","code":200}}
The user doesn't have publish_actions actions in their set for me/permissions, it should be there as "publish_actions": 1 if it is not, grant the permission by selecting "Get Access Token" and choosing (you must change to suit in your app code scope as well)
It might be easier if you use the graph API explorer to generate an access token for you app and use that. That would at least eliminate any chance of error from your fetching the access token.
I have an app and I want to post to the users feed.
All the users have allowed publish_stream permission but I have no idea how to post to their feeds which I should be able to do even if the user is offline.
I want to use curl and the graph like this:
curl -F 'access_token=...' \
-F 'message=Hello, Arjun. I like this new API.' \
https://graph.facebook.com/arjun/feed
Do I simply use the access code I got when the users initially allowed me access, or do I have to get a new access code each time I want to post to their feed, if so, how do I do that?
Any help, much appreciated.
After the user authorized your application you get an access-token from facebook. You can use this token to post to the users-wall until he changes his password or removes your application from his application list.
I think you need to include your api-key in the request. Otherwise please provide the error message your getting!