Linkedin Group API call get profile URL of the commented member - linkedin

I am using Linkedin REST API with PHP.
I am trying to get posts of a particular discussion group.
The API call is
http://api.linkedin.com/v1/groups/2417328/posts:(creation-timestamp,summary,title,type,comments,id,creator:(picture-url,last-name,headline,id,first-name,site-standard-profile-request))?count=100&start=0&modified-since=1312441200000
I would like to fetch the profile URL of the members who commented on each post also. Is it possible to do this with the above mentioned call?

Yes, it is possible - in the API call, specify the comment creator fields you would like to return from the list of available Profile Fields. To return the comment creator's profile URL, replace the comments Group Field with comments:(creator:(site-standard-profile-request)). You can specify other profile fields in there as needed.

Related

Wordpress ACF Google maps field API Key

I have a Wordpress project with Advanced Custom Fields Pro 5.3.5 plugin, where for one of my post types I set an address field using the Google Map field type. When I go to the admin page to add/edit a post this Google Maps field shows the map but in "For development purposes only" mode.
It's probably missing an API key. I'm trying to set it as described in their documentation:
// Method 1: Filter.
function my_acf_google_map_api( $api ){
$api['key'] = 'xxx';
return $api;
}
add_filter('acf/fields/google_map/api', 'my_acf_google_map_api');
// Method 2: Setting.
function my_acf_init() {
acf_update_setting('google_api_key', 'xxx');
}
add_action('acf/init', 'my_acf_init');
I tried both methods in the functions.php of my theme and none work. I made sure that the API Key I'm using is valid and it is, I can use it on Postman to make API keys without any problem.
I've seen similar questions here on StackOverflow and basically the answer is what I'm already trying. What else I'm missing?
Thanks for any help
I've just had similar issues and hopefully my solution/steps will help.
As mentioned in the comments by #evan multiple API's must be enabled in the Google Console otherwise you will get errors.
Read the Error/Console message(s)! It will point you to either Billing or which API is not available/active.
Troubleshooting
Must have Google Console Project hooked up to a billing account
Must enable multiple APIs
(optional) can restrict key to certain domain/IPs
and also restrict to certain API
For the admin to work I required Maps Javascript API, Places API and also Geolocation API to be 'Enabled'
With those enabled my Admin could lookup and correctly assign Map lat/lng fields to the ACF field and saved correctly.

How to make WordPress Rest API parameters accessible without authentication?

How can I make certain parameters of the WordPress Rest API accessible to anyone without first being authenticated – for example, the page parameter doesn't work (where blog is a custom post type) in this query:
mysite.com/wp-json/wp/v2/blog?page=2&per_page=20
I've seen that in the past it's been possible to make these params available, for instance :
add_filter( 'json_query_vars', function( $valid_vars ) {
$valid_vars[] = 'offset';
return $valid_vars;
});
Is there any way to do something similar with today's version of the API?
For anyone who has the same problem, I've solved it. The page parameter is actually publicly available, offset is the one you need authentication for.
The reason the API didn't paginate was because the request url didn't have the paged query string set. Every time I tried to add it with the params option of the WordPress Node API, it didn't work:
wpapi.getNews().params('paged', 'paged').perPage( perPage ).page( pageNumber ).then(data=>
It didn't work because the request url created by the API seemed to always put the page parameter before the paged one, which resulted in paged being ignored when the query actually runs.
So in the end, I created a custom query (bit of a hacked way to do it, but it worked) like so:
Register the route:
wpapi.getNews = wpapi.registerRoute('wp/v2', '/news/(?P<customQuery>)');
Usage:
wpapi.getNews().customQuery('?paged&per_page=20&page='+pageNumber).then(data =>
Using the above, you can build any query, in any order you want. This helped me get the correctly paginated result. Also, we see 'getNews' here because I registered a route for accessing my custom post type called news.

How can I attach a custom form to a Workfront user with the API?

I have a requirement to insert new Workfront users through the API, which I am able to do. However, I need to update a Custom Form item with an employee id. With a new user, the Custom Form must be attached before the employee id can be update. I am using the following url to attach the form:
https://<url>/attask/api/user/<userguid>?sessionID=<sessionid>&updates={'objectCategories':[{'categoryID': '225845d1800010d52527455df2a27f0fe2','categoryOrder':0,'objCode':'CTGY'}]}&method=put
The result is a HTTP Error 400: Bad Request
Is it even possible to attach a Custom Form to a user? Or is there another way that it can be done through the API?
For reference, I had to work through the exact same question. You are correct in your update that you need to use the most recent version of the API (as of this post, that would be 6.0) but for others who are wondering, the syntax is as follows:
https://<url>/attask/api/v6.0/USER/<userID>?apiKey=<key>&updates={"objectCategories":[{"categoryID":"<customFormID>","categoryOrder":0,"objCode":"CTGY"}]}&method=put

How to get a LinkedIn Group Post "content" through API, not just the title

When starting a Group Discussion through the LinkedIn website you can enter a postTitle and (optional) postText
However when querying this post through the LinkedIn API only the "title" is returned.
https://api.linkedin.com/v1/posts/{post-id}
Tested from https://apigee.com/console/linkedin to confirm it wasn't just my script with issues.
Is there an extra parameter I can pass to the API to get this "text" field on a Group Discussion post?
Thanks
You need to use the field selectors to specify the particular fields that you want returned from your call.
For example:
https://api.linkedin.com/v1/groups/12345:(id,name,site-group-url,posts:(id,summary,creator))
Please also note that as of May 12th, 2015, the API endpoint for Groups will no longer be publicly available. See the following blog post for more details: https://developer.linkedin.com/blog/posts/2015/developer-program-changes

How does one associate Google Analytics with a particular authenticated user?

What method would you use to associate tracking information in Google Analytics with a particular named user?
I want to be able to do custom reports, and ultimately drill down on usage by user.
EDIT
I was thinking that perhaps the EventTracking API would be able to help somehow.
Also, referring to this documentation.
You could add the user's username as a tracking/segmentation) variable...
pageTracker._setVar(username);
You can only use one _setVar per page, though...
http://www.google.com/support/analytics/bin/answer.py?answer=57045
http://groups.google.com/group/analytics-help-basics/browse_thread/thread/07e29dc610050971
Since Google Analytics isn't aware of users who are logged into your site you'd have to do that sort of tracking within your site's software itself. If there isn't some sort of plugin or extension out there already you'll probably have to write one yourself that keeps track of what your users do when their logged in.
I think you want Google Analytics - Custom Variables. You can set five variables per page, and there is support for variables you set persisting over session and cookie (aka "visitor") lifetime. Take note of the rules for overwriting previous values based upon slot and scope; the documentation explains this with some examples. You should probably include something in a click-wrapped privacy policy about tracking individual users this way; it's somewhat invasive, depending on the purpose of your website.
_gaq.push(['_setCustomVar',
1, // Slot number: [1-5], inclusive. Required.
'Username', // Custom variable name. Required.
username, // Custom variable value. Required.
2 // Scope:
// 1 = visitor/cookie-level, 2 = session-level, 3 = page-level.
// Optional, default=3.
]);
http://www.highlyrelevant.com/2011/03/25/how-to-add-edit-google-analytics-users-to-your-account/
This post was really helpful for me and my team. Not only does it show how to add users, but it also tells you how to edit existing users that aren't setup correctly.
Thanks!
Phil

Resources