Facebook Score Update Publish_Action - facebook-graph-api

I have the following code to update the score of the user:
FB.api("USERID>/scores", 'POST', {score: currentScore, access_token: "APP_ACCESS_TOKEN"},
function(response){
if (!response || response.error)
{console.error(response);}
else { console.log(response);}
}
);
The same code was working fine in my previous application. But this time even when I am getting the response rate true then also its not updating score. I have also tried by posting the score through the direct link(as below) to cross check in case I have some problem with my code.
https://graph.facebook.com/USER_ID/scores?score=USER_SCORE&access_token=APP_ACCESS_TOKEN
The result I am getting is as under:
{
"data": [
{
"user": {
"name": "Harsh",
"id": "xxxxx"
},
"score": 0,
"application": {
"name": "xxxxxxxx",
"canvas_name": "xxxxxxxxx",
"namespace": "xxxxxxxxxx",
"id": "xxxxxxxxxx"
}
}
]
}
as far as I know this is result of reading score. Can someone help me where I am wrong.
FYI:
1. I am passing APP_ACCESS_TOKEN
2. My app is registered as Game
3. I am taking publish_actions permission

Related

Facebook (Instagram) Graph API not returning instagram_business_account

First of all, let me explain what I have today:
I have a access token with the following permissions: email, public_profile, pages_show_list, pages_read_engagement, instagram_basic, instagram_manage_insights
I have a valid access token
The accounts that I'm trying to access are Business Account or Content Creator account
With that in mind, here's my problem: some users that are connected to my platform simply don't return the instagram_business_account when I'm requesting /me/accounts.
My request is to https://graph.facebook.com/v10.0/me/accounts with the fields id,name,instagram_business_account{id,biography,ig_id,followers_count,follows_count,media_count,name,profile_picture_url,username,website}.
Here's a sample result where both should return the instagram_business_account, because both are connected to Facebook as a Business Account:
{
"data": [
{
"id": "xxxx",
"name": "xxxxx"
},
{
"id": "xxxxx",
"name": "xxxx",
"instagram_business_account": {
"id": "xxxx",
"biography": "xxxx",
"ig_id": 00000,
"followers_count": 0000,
"follows_count": 0000,
"media_count": 0000,
"name": "xxx",
"profile_picture_url": "xxxx",
"username": "xxxx"
}
}
],
"paging": {
"cursors": {
"before": "xxxx",
"after": "xxxx"
}
}
}
Does anybody have any idea what is the problem happening here?
I figured out the problem. This is a Facebook problem, there's nothing we can do. Instagram is connected on Facebook through instagram_business_account. If this value doesn't exist, that means the account is not connected correctly. The user should reconnect the page https://www.facebook.com/{id}/settings/?tab=instagram_management.
The id value is the one from query result. The second alternative is go to Instagram, go to the profile, click on "Edit Profile" and in "Page", just connect to Facebook again.
With that you will be able to get the correct result.

Creating an eBay fulfilment policy. ("Please select a valid postage service.")

After a day of work with Postman, I have managed to reduce the number of errors down to 1. No idea how to get past it.
Definitely not an authorisation problem. I've been making lots of authorised calls.
URI:
POST https://api.ebay.com/sell/account/v1/fulfillment_policy
Body:
{
"categoryTypes": [
{
"name": "ALL_EXCLUDING_MOTORS_VEHICLES"
}
],
"freightShipping": "false",
"globalShipping": "false",
"handlingTime": {
"unit": "DAY",
"value": "1"
},
"localPickup": "true",
"marketplaceId": "EBAY_AU",
"name": "100 grams",
"shippingOptions": [
{
"costType": "CALCULATED",
"optionType": "DOMESTIC",
"shippingServices": [
{
"shippingCarrierCode": "Australia Post",
"shippingServiceCode": "AU_Regular"
}
]
}
]
}
Output:
{
"errors": [
{
"errorId": 20403,
"domain": "API_ACCOUNT",
"category": "REQUEST",
"message": "Invalid .",
"longMessage": "Please select a valid postage service.",
"inputRefIds": [
"service"
],
"parameters": [
{
"name": "XPATH",
"value": "DomesticItemShippingService[0].shippingService"
}
]
}
]
}
Things I've Tried:
Deleting "shippingOptions": [...] (and everything inside the []s) got rid of the errors and resulted in the successful creation of a new fulfillment policy. However, I wanted to include shipping options in my call.
shippingCarrierCode doesn't seem to do anything. I've changed it to all sorts of sensible and non sensible things, including deleting it entirely. No impact on the output.
Changing shippingServiceCode to anything non-standard (eg "shippingServiceCode": "potato") results in getting the exact same error, but twice instead of once. (See below) How can I get the same error twice with only one shipping option?
Including a domestic and international option, I get the same error twice also. (Same output as below, except the second DomesticItemShippingService[1].shippingService is instead DomesticItemShippingService[0].shippingService)
Making an international option AND a domestic option, BOTH with silly service names results in 3 errors. (I was expecting 4.)
Code:
{
"errors": [
{
"errorId": 20403,
"domain": "API_ACCOUNT",
"category": "REQUEST",
"message": "Invalid .",
"longMessage": "Please select a valid postage service.",
"inputRefIds": [
"service"
],
"parameters": [
{
"name": "XPATH",
"value": "DomesticItemShippingService[0].shippingService"
}
]
},
{
"errorId": 20403,
"domain": "API_ACCOUNT",
"category": "REQUEST",
"message": "Invalid .",
"longMessage": "Please select a valid postage service.",
"inputRefIds": [
"service"
],
"parameters": [
{
"name": "XPATH",
"value": "DomesticItemShippingService[1].shippingService"
}
]
}
]
}
What did I do wrong this time?
I did get an answer to my question. Not here, even though I sent them the link here, but I got the answer (eventually) through official eBay channels.
I'll post that answer here for everyone. I was thinking of adding correct stackoverflow formatting, but decided it would be better to leave the correct answer untouched from the original.
Hello Jonathon ,
Ignore my last message and Apologize for the confusion.
Here is the reason why you are getting the error:
You have to set "localPickup": "false", refer doc for your help:
https://developer.ebay.com/api-docs/sell/account/resources/fulfillment_policy/methods/createFulfillmentPolicy#request.localPickup
And you will get response as:
{ "name": "100 grams", "marketplaceId": "EBAY_AU",
"categoryTypes": [
{
"name": "ALL_EXCLUDING_MOTORS_VEHICLES",
"default": true
} ], "handlingTime": {
"value": 1,
"unit": "DAY" }, "shippingOptions": [
{
"optionType": "DOMESTIC",
"costType": "CALCULATED",
"shippingServices": [
{
"sortOrder": 1,
"shippingCarrierCode": "Australia Post",
"shippingServiceCode": "AU_Regular",
"freeShipping": false,
"buyerResponsibleForShipping": false,
"buyerResponsibleForPickup": false
}
],
"insuranceOffered": false,
"insuranceFee": {
"value": "0.0",
"currency": "AUD"
}
} ], "globalShipping": false, "pickupDropOff": false, "freightShipping": false, "fulfillmentPolicyId": "6104871000",
"warnings": [] }
Let us know if you need further assistance!!!
Best Regards, eBay Developer Support
Check them out here. Make sure you have all the required fields.
pickupDropOff
shippingOptions.shippingServices.shipToLocations.regionIncluded

Autodesk BIM360: Folder Creation returns 400 Bad request

I called the POST-Folder Method via Postman with a JSON body according to this example. But I only receive the message "400 Bad Request" without any explanations. This is what my request looks like:
The service adress:
https://developer.api.autodesk.com/data/v1/projects/b.5823d0b2-0000-0000-00/commands
The HTTP-header
Authorization: Bearer 2_legged_token
Content-Type: application/vnd.api+json
The JSON-Body
{
"jsonapi": {
"version": "1.0"
},
"data": {
"type": "commands",
"attributes": {
"extension": {
"type": "commands:autodesk.core:CreateFolder",
"version": "1.0.0",
"data": {
"requiredAction": "create"
}
}
},
"relationships": {
"resources": {
"data": [
{
"type": "folders",
"id": "1"
}
]
}
}
},
"included": [
{
"type": "folders",
"id": "1",
"attributes": {
"name": "test",
"extension": {
"type": "folders:autodesk.bim360:Folder",
"version": "1.0.0"
}
},
"relationships": {
"parent": {
"data": {
"type": "folders",
"id": "urn:adsk.wipprod:fs.folder:co.Ai*****"
}
}
}
}
]
}
The response
{
"jsonapi": {
"version": "1.0"
},
"errors": [
{
"id": "f1266e76-a37e-400b-bff6-de84b11cdb00",
"status": "400",
"detail": "BadRequest"
}
]
}
What I have found out so far:
The project id is right. When I take a wrong project id I receive a different error.
The Json is also valid.
When I take a (surely) wrong parent-folder-urn I'll receive the same error message. So maybe this is a wrong urn format or something?
As of now, you can create a BIM 360 Docs Folder with commands endpoints, as you pointed out. For that you can use:
3-legged token
2-legged token with x-user-id header, this should contain the Autodesk User ID obtained, for instance, from GET users#me endpoint
"pure" 2-legged token will return bad request (as of August/2017)
Sorry about the documentation, the endpoint to create BIM 360 Docs folder via Commands was released a couple weeks back and we're just finishing to write the documentation.

Facebook graph API obtain a specific users's pictures from that same user

I'm working on an Android application and I'm trying to obtain contact pictures from friends. I'm still testing the graph request on the Facebook Graph API Explorer linkhere I'm going to use afterwards in the code, and I've hit a snag...
After generating an Access Token, and validating it allows me access to the correct fields I'm interested, I'm trying to filter the information I'm obtaining from Facebook.
Using the Facebook Graph API Explorer I'm performing the following request:
< USER_ID>?fields=id,first_name,last_name,location,picture,birthday,photos.limit(3).fields(id,picture,source,from)
I obtain, as expected:
{
"id": "<USER_ID>",
"first_name": "<FIRST>",
"last_name": "<LAST>",
"photos": {
"data": [
{
"id": "<PICTURE1>",
"source": "<PIC1.jpg>",
"from": {
"name": "<OTHER_USER1>",
"id": "<OTHER_USER1_ID>"
},
"created_time": "2013-08-17T11:39:19+0000"
},
{
"id": "<PICTURE2>",
"source": "<PIC2.jpg>",
"from": {
"name": "<OTHER_USER2>",
"id": "<OTHER_USER2_ID>"
},
"created_time": "2013-08-04T14:27:07+0000"
},
{
**"id": "<PICTURE3>"**,
"source": "<PIC3.jpg>",
"from": {
"name": "<USER>",
**"id": "<USER_ID>"**
},
"created_time": "2013-08-03T17:35:20+0000"
}
],
"paging": {
"previous": "<LINK1>",
"next": "<LINK2>"
}
},
"picture": {
"data": {
"url": "<PIC>",
"is_silhouette": false
}
}
}
What I would like is to only obtain the pictures from ... like the third picture or others, is this possible using the graph api?
Thanks for the help.
Marc
PS:
I've tried adding in the end something like &photos.data.from.id=< USER_ID>
but I till get the same data set in response.
I would like to avoid requesting more pictures and filter it programmatically, because You never know how many pictures are associated with a user that where not submitted by that user.
Not possible with the Graph API, but you can use FQL, to query for the photos of the user (not those in which he's tagged in) -
SELECT pid,src FROM photo WHERE owner = me()
Check FQL - Photo to include the required fields in the result.

Graph API only returns page posts

Im using the Graph API to get certain data from my managed pages.
What i need is the likes, checkins and talking_about_count from my pages.
When i add checkins and talking_about_count i get an error that the API doesn't know the fields.
So i removed those and only asked for the likes and id.
What the API returns is a list with the posts from the page and only showing the id, creation date and the likes(if there are any).
I tested with some other fields like about and website, but they give the same error as checkins and talking_about_count, so i can't get basic data from my pages..
The link i use is this:
https://graph.facebook.com/168707433219493/feed?access_token=[Access_Token]&fields=id,likes,checkins,talking_about_count
And the error i get:
{
"error": {
"message": "(#100) Unknown fields: checkins,talking_about_count.",
"type": "OAuthException",
"code": 100
}
}
When i only ask for id and likes i get:
{
"data": [
{
"id": "168707433219493_333476503426186",
"created_time": "2012-11-28T19:38:57+0000"
},
{
"id": "168707433219493_370257573064477",
"created_time": "2012-11-22T08:12:11+0000"
},
{
"id": "168707433219493_423778884356339",
"likes": {
"data": [
{
"name": "Guido van Tricht",
"id": "1117357415"
}
],
"count": 1
},
"created_time": "2012-11-19T22:46:01+0000"
}
],
"paging": {
"previous": "https://graph.facebook.com/168707433219493/feed?fields=id,likes&access_token=[Access_Token]&limit=25&since=1354131537&__previous=1",
"next": "https://graph.facebook.com/168707433219493/feed?fields=id,likes&access_token=[Access_Token]&limit=25&until=1350819853"
}
}
I hope someone knows how to solve my problem, thanks in advance.
talking_about_count should be in the /PAGE_ID, not in the feed.
Why not get this data from:
https://graph.facebook.com/168707433219493?access_token=[Access_Token]