Provide array of URNs to LinkedIn REST API? - rest

I am using the LinkedIn Marketing Development Platform where I am trying to provide a list of company URNs to to the Ad Analytics API. However, when I try to provide a list of company URNs, it fails with status 400.
Analytics Finder endpoint docs
My request:
GET https://api.linkedin.com/v2/adAnalyticsV2?q=analytics&pivot=CAMPAIGN&dateRange.start.day=1&dateRange.start.month=1&dateRange.start.year=2017&timeGranularity=ALL&companies=urn:li:organization:1234,urn:li:organization:5678
Response:
{"message":"Array parameter 'companies' value 'urn:li:organization:1234,urn:li:organization:5678' is invalid. Reason: Deserializing output 'urn:li:organization:1234,urn:li:organization:5678' failed","status":400}
I have also tried URL encoding the URL, and providing the list via the parameter companies[0] as is done in other examples in the docs.
What is the correct way to input arrays to the LinkedIn API?
Edit: Changed accounts to companies

So the Protocol Version actually gave me some useful insight. There are a couple of ways of providing arrays in parameters.
From the docs:
For Restli V1.0 (used by default)
GET GET https://api.linkedin.com/people?ids=1&ids=2&ids=3
For Restli V2.0, which you can use by setting the following header: X-RestLi-Protocol-Version: 2.0.0
Pass parameters in List format.
GET https://api.linkedin.com/v2/people?ids=List(1,2,3,4)
However, I have not managed to get the Analytics Finder API to work with Restli V2.0.

You'll need to provide the list of URL encoded organization URNs to the accounts param. Using your request as an example:
&accounts=List(urn%3Ali%3Aorganization%3A1234,urn%3Ali%3Aorganization%3A5678)

Related

Facebook Insights API not returning store visits data

I am trying to retrieve Store Visits data from the Facebook Insights API. Based on their documentation, these should be available by specifying the following parameters:
store_visit_actions
cost_per_store_visit_actions
When I use store_visit_actions as a parameter, no data is returned. I know data exists because it is displayed through their UI reporting tool.
When I use cost_per_store_visit_actions, I receive a 100 invalid param error:
cost_per_store_visit_actions is not valid for fields param.
These params are listed as "In Development", however, I'm retrieving other development parameters without issue. Is anyone facing the same issue or know how to fix?
this is because the metrics
store_visit_actions
cost_per_store_visit_actions
are deprecated in facebook api v11.0. You can checkout this link:
https://developers.facebook.com/docs/graph-api/changelog/version11.0/

Microsoft Graph API - /drive/root/children always empty, even though I have files in my onedrive

I'm trying to use the Microsoft Graph API to List Children by Getting access without a user
I have built my URL as you would expect:
https://graph.microsoft.com/v1.0/edffcd1c-e5b2-42f2-b554-XXXXXXXXX/drive/root/children
Where edffcd1c-e5b2-42f2-b554-XXXXXXXXX is the user ID of whom I'm trying to list the files.
Yet when I call this I get an empty result every time:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#drive/root/children",
"value": []
}
Why is that?
UPDATE: It seems that this API is only returning files from the Sharepoint account... not the OneDrive account. I already have access to the Sharepoint files from the Sharepoint API's themselves. Is there a way to get OneDrive files from the Microsoft Graph API?
This URL https://dev.onedrive.com/README.htm seems to state that we should be able to do this.
Is there a way to get OneDrive files from the Microsoft Graph API?
Yes, there is: you must use the scope Files.Read.All or Files.ReadWrite.All
then, your requests to /drive/root/children will no longer return an empty array.
I just had a typo in the User:
https://graph.microsoft.com/v1.0/edffcd1c-e5b2-42f2-b554-XXXXXXXXX/drive/root/children
was supposed to be
https://graph.microsoft.com/v1.0/users('edffcd1c-e5b2-42f2-b554-XXXXXXXXX')/drive/root/children
You can also use this endpoint
https://graph.microsoft.com/v1.0/me/drive/root/children
and pass authorization header Bearer Token
There are two things:
1) First check if the user has given the permission for
Files.Read.All or Files.ReadWrite.All
2) The following endpoint didn't work for business account
/drive/root/children
I changed it to
/drives/{drive_id}/root/children
and it worked fine. Please check.

Unable to get ad preview using facebook graph api?

Using the information from this documentation to generate iframe of the ad preview (in Facebook Graph API),
According to the documentation, we need to use the following URL
https://graph.facebook.com/v2.8/{adgroup-id}/previews/ad_format=
Not able to understand how to pass in the ad_format. It is compulsory to pass this parameter.
GET parameters are passed like:
https://graph.facebook.com/v2.8/{adgroup-id}/previews/?ad_format=DESKTOP_FEED_STANDARD
This question is old. But in order to run a preview you need to pass two parameters:
ad_format
There are various types of ad_formats: You generally use them according to your specific use. For basic mobile and desktop testing
DESKTOP_FEED_STANDARD, MOBILE_FEED_BASIC, MOBILE_FEED_STANDARD, MOBILE_FULLWIDTH will work fine
access_token
So your URL will be of the format :
https://graph.facebook.com/v4.0/AD_ID/previews?access_token=ACCESS_TOKEN&ad_format=DESKTOP_FEED_STANDARD

facebook4j post from is null

I am using the Facebook API from Java with Facebook4j.
I have two servers, on the one that uses Facebook 2.3 API when I get the from of a post,
Post post = connection.getFeed().get(0);
post.getFrom();
I get the user, but in the server that uses Facebook 2.4 API, the from is null.
Any idea? I don't see any documented change in the fb API.
As described in the Facebook Platform Changelog, as of v2.4, you now have to manually specify fields if you want them to be retrieved:
To try to improve performance on mobile networks, Nodes and Edges in
v2.4 requires that you explicitly request the field(s) you need for
your GET requests. For example, GET /v2.4/me/feed no longer includes
likes and comments by default, but GET
/v2.4/me/feed?fields=comments,likes will return the data. For more
details see the docs on how to request specific fields.
According to the docs on Post, the relevant field is named from. To request this field in the me feed using Facebook4J, you can use a Reading object, as follows:
facebook.getFeed(new Reading().fields("from"))

Getting Logos from Sites with SiteInfo

We are attempting to get site logos from the Yodlee API. From the SiteInfo data model (using the SOAP API), there are the following methods that appear to retrieve site logos
siteInfo.getDefaultSiteLogo()
siteInfo.getLocalizedSiteLogos()
getDefaultFavIcon()
The issue is that these methods for the sites we are using (all sites with the AU geography) are returning null.
I am pretty sure this is possible to do, since Yodlee's own fastlink does show logos for sites as you are adding them.
Here are the method call signatures
I am using the soap api through java (using axis 1.4, just like in the sample code) and the API signatures are as follows
SiteAccountManagementService has the method getAllSiteAccounts which has the following signature
com.yodlee.soap.collections.core.accountmanagement.ArrayOfSiteAccountInfo getAllSiteAccounts(com.yodlee.soap.common.UserContext userContext).
Then there is also getCctx, which has the following signature
public com.yodlee.soap.common.CobrandContext getCctx()
None of these methods have a request specifier parameter of any sought
I don't think icons will be returned by default. I believe you need to specify this in your request specifier to get icons/image.
getAllSiteAccounts API is to get the details for the Accounts aggregated by a consumer,
while the information you are looking for(the Logos) are site related not consumer related.
You should use getSiteInfo(under SiteTraversal) to get this specific detail and remember to pass value of siteFilter.reqSpecifier as 128.