facebook graph api fields not returning - facebook

We've recently noticed responses changing a call to calls like:
/me?fields=adaccounts.fields(age,capabilities,currency)
Previously, we would get a response with the requested fields filled in, but now they are coming back with a response similar to:
{
"id": "XXXXXXXXXX",
"adaccounts": {
"data": [
{
"account_id": "XXXXXXXXXXXX",
"id": "XXXXXXXXXXX"
},
{
"account_id": "XXXXXXXXXXX",
"id": "XXXXXXXXXXXXX"
}
],
"paging": {
"cursors": {
"after": "NjAwMjIwMTIyNzM4OA==",
"before": "NjAwMjk2ODQ2OTc1OQ=="
}
}
}
}
Has something changes there? We've been making calls via the api directly and on the Graph API Explorer tool.
Thanks for any help!
UPDATE:
Getting the details for adaccounts fields now requires hitting another endpoint:
/me/adaccounts?fields=age,capabilities,currency

There's no need for multiple calls, you can simply do:
/me/adaccounts?fields=age,capabilities,currency

On October 2nd Facebook made changes to the ads API that requires you to specify what fields you want returned from all the end points. This includes ad account, campaign, group and creative. You must now issue the query with fields=fieldname,fieldname,fieldname with all the fields you want returned when performing a get request. Officially these changes were forced on for applications Friday Oct 4th.
A link with details about the Oct 2nd breaking changes can be found here: http://developers.facebook.com/roadmap/
Hope that helps!
Thanks,
Erick

Related

Microsoft Graph; Create calendar event; how to set ICalUId so that later I can find the event via the ICalUId

I am trying to create events via the MS Graph API (with Powershell but using the REST API).
So far I can create events without problems. All the properties I want to set are correctly set - except I don't seem to manage to set the IcalUId - as I cannot find such created events via
"/users/$UPNofMBX/calendar/events?`$filter=iCalUId eq '$appointment_UID'"
($Appointment_UID = the desired identifier for later finding the event - It is coming from an external - commercial solution)
If I import via Outlook an ICS file with a specific value in the "UID:" field, the above Graph query finds the event which carries the searched for value in the ICalUId field.
If I set it at creation time via graph with the below body, the above search query line does not find the event.
The body of the REST call looks like this:
$Body = #"
{
"subject": "$appointment_Subject",
"iCalUId": "$appointment_uid",
"body": {
"contentType": "HTML",
"content": "$appointment_Body"
},
"start": {
"dateTime": "$appointment_Time_Start",
"timeZone": "Europe/Berlin"
},
"end": {
"dateTime": "$appointment_Time_End",
"timeZone": "Europe/Berlin"
},
"location":{
"displayName":"$appointment_Location"
},
"attendees": [
{
"emailAddress": {
"address":"$UPNofMBX",
"name": "Ressource"
},
"type": "required"
}
],
"allowNewTimeProposals": false,
"transactionId":"$(New-Guid)"
}
Unfortunately, in none of the examples # Microsoft is the use of the ICalId explained when creating an event. Also I didn't find any examples on the net.
Hint: If I use Microsoft.Exchange.WebServices.Data within a C# app, I can set the iCalUId.
The goal is to set a reference UID / ID / anything in the to-be-created event so that I can find this event later via this reference in order to update or delete it. The only reference information I have is the UID (iCalUId) from an (update/delete) ICS file from the external commercial solution.
I would prefer to not build a translation table between the UIDs from the commercial solution when they arrive via ICS and the IDs of the newly created events when they are given back in the REST call # creation time so I can find them later if necessary.
Any insight what I am doing wrong or a solution is greatly appreciated.

Strongloop REST Connector - connecting to non-REST remote resources

We have an existing web application which has an API not based on REST. We'd like to put a REST API in front of it, using Strongloop, however, getting lost in the documentation and not sure if this can be achieved.
Example:
Want to configure an endpoint in Strongloop which looks like;
localhost:3000/api/DataObject/Orders?StartDate=01/01/2016&EndDate=31/01/2016
A GET on this end point should service the request from our existing web application, where the URL would like;
localhost:4000/wh?Page=ObjectBuilder&Name=Orders&StartDate=01/01/2016&EndDate=31/01/2016
i.e. take Orders from the API request and insert into the remote URL, along with the remaining parameters.
I could code this using express.js, but was wondering if this is possible using configuration in Strongloop?
Thanks!
I think you might be able to use the built-in REST connector even though your legacy API is not REST per se (although you don't get all the benefits of the built-in mapping to find, create, destroy, etc). The connector simply translates URLs into model methods. That said, I think you do need to have the old API spit out JSON... does it do that? If not, then you basically just have to write a full translator.
This is not working code, but might help you get part of the way there.
In your server/datasources.json file:
"old-service": {
"name": "old-service",
"connector": "rest",
"operations": [{
"template": {
"method": "GET",
"url": "http://localhost:4000/wh",
"headers": {
// whatever you might need to send...
},
"query": {
"Page": "ObjectBuilder",
"Name": "{name}",
"StartDate": "{start}",
"EndDate": "{end}"
},
"responsePath": "$.results.theObject" // be sure to custom ize this
},
"functions": {
"buildObject": ["name", "start", "end"]
}
}]
}
In your server/model-config.json be sure too map your DataObject model to this datasource:
{
// ...
"DataObject": {
"public": true,
"dataSource": "old-service"
},
}
And in your model itself (common/models/DataObject.js) you can now call the buildObject() method:
DataObject.buildObject('Order', '01/01/2016', '31/01/2016', function(err, result, response) {
if (err) { ... }
// otherwise look at the result or response...
});
Now that you can call this method, you could put it into a remoteMethod or even override the default find method for this model.
Good luck, but in many of these cases you simply have to write the "conversion" code yourself. Might be easier to rewrite the API from scratch. ;)

Facebook API not working sometime for some URL

I'm getting number of shares and comment of blog posts using facebook graph api for my blog, but sometimes it do not return shares and comment.
Following URL is not giving number of share and comments.
http://graph.facebook.com/?id=http://www.lehedonist.com/jeans-is-the-new-whiskey-2001
BUT it is working for this URL:
Example: http://graph.facebook.com/?id=http://www.lehedonist.com/spring-slam-fashion-war-ss16-1965
I somehow wonder why it's even working to request these URLs without an access token to be honest.
See
https://developers.facebook.com/docs/graph-api/reference/v2.5/url
It only gives a result if there no version info in the URL. To do this in the v2.5 way properly, you'd have to use
https://graph.facebook.com/v2.5/?access_token={access_token}&fields=id,og_object,share&id=http://www.lehedonist.com/spring-slam-fashion-war-ss16-1965
where {access_token} is an actual access token.
Results will look like
{
"id": "http://www.lehedonist.com/spring-slam-fashion-war-ss16-1965",
"og_object": {
"id": "987675524635070",
"description": "Not your usual fashion post, we decode styles best suited to your personality and what should you be sporting next summer",
"title": "Spring Summer 16 fashion: The clash of fashion personalities",
"type": "article",
"updated_time": "2015-10-08T11:24:32+0000",
"url": "http://www.lehedonist.com/spring-slam-fashion-war-ss16-1965"
},
"share": {
"comment_count": 2,
"share_count": 81
}
}

How to get people who have shared specific FB post?

It's easy to get people who have liked post: https://graph.facebook.com/19292868552_10150189643478553/likes
How can I get people who have shared this post ?
Using the Graph Explorer with a post that has shares:
https://graph.facebook.com/20531316728_10151733211311729?fields=shares
The output is:
{
"shares": {
"count": 1806
},
"id": "20531316728_10151733211311729",
"created_time": "2013-02-10T12:59:25+0000"
}
Of course if you remove the fields parameter you see all the fields associated with that object.
EDIT: The post on Facebook - https://www.facebook.com/photo.php?fbid=10151733211231729&set=a.376995711728.190761.20531316728&type=1

How do I get the permalink of a specific Facebook Social Plugin Comment through the Graph API?

Consider the following piece of dummy data returned from the Graph API for Facebook's Commenting Social Plugin:
{
"id": "387539086359_14842802",
"from": {
"name": "Manja Elis",
"id": "1168990251"
},
"message": "http://www.facebook.com/pages/Manja-Elis/151029671610040",
"created_time": "2010-11-24T07:06:06+0000",
"comments": {
"data": [
{
"id": "494442921359",
"from": {
"name": "J Reigy T II",
"id": "100001234540335"
},
"message": "~ www.jareta.name ~",
"created_time": "2011-01-30T00:04:30+0000"
}
],
"count": 1
}
}
How can I generate the permalink to this specific comment so that it can be bumped to the top of the discussion?
I know that the first id# "387539086359_14842802" is the ID of the comment thread as a whole, but now I need the specific ID of the actual first comment so that I can properly link to it. The problem is, that 3rd piece of ID information is nowhere to be found.
What I find funny is that the reply comment with id# "494442921359" is the correct ID for that reply, but there is no equivalent offered for the original post - why??? Worse yet, Facebook ignores links to any comments that aren't the first in a new sub-thread so linking to the reply instead is useless to me.
So to clarify:
Comment id of first post in the thread is : 387539086359_14842802_????
Comment id of the reply to this post would be: 387539086359_14842802_494442921359 but unfortunately FB ignores reply IDs so it is useless to me.
Can anyone tell me how I programatically get this ???? ID for permalink generation purposes?