Is the location field missing on Google+ Search API results? - search

We have a test public post, with public location sharing on. It is here:
https://plus.google.com/117438835632597579589/posts/CrqqvQf4kLx
This has a location tagged in the message, which is shown in the browser.
When we call the API there is no location field shown as the docs suggest there will be (https://developers.google.com/+/api/latest/activities). This is the JSON that is returned:
{u'access': {u'kind': u'plus#acl'},
u'actor': {u'displayName': u'Stuart Battersby',
u'id': u'117438835632597579589',
u'image': {u'url': u'https://lh3.googleusercontent.com/-D3bdMxwKXm4/AAAAAAAAAAI/AAAAAAAADn8/_1qBDTPoAcU/photo.jpg?sz=50'},
u'url': u'https://plus.google.com/117438835632597579589'},
u'etag': u'"G6azxXlXkwWbV_x-oI3I6szOTWs/ZXO3RDThBxUUobZJEK2PL2qeQBI"',
u'id': u'z124whmabknyw1wua230stwiyn2wenk2d',
u'kind': u'plus#activity',
u'object': {u'content': u'Checking out the Google+ app for android...',
u'objectType': u'note',
u'plusoners': {u'selfLink': u'https://www.googleapis.com/plus/v1/activities/z124whmabknyw1wua230stwiyn2wenk2d/people/plusoners',
u'totalItems': 1},
u'replies': {u'selfLink': u'https://www.googleapis.com/plus/v1/activities/z124whmabknyw1wua230stwiyn2wenk2d/comments',
u'totalItems': 0},
u'resharers': {u'selfLink': u'https://www.googleapis.com/plus/v1/activities/z124whmabknyw1wua230stwiyn2wenk2d/people/resharers',
u'totalItems': 0},
u'url': u'https://plus.google.com/117438835632597579589/posts/CrqqvQf4kLx'},
u'provider': {u'title': u'Mobile'},
u'published': u'2013-06-28T08:56:53.110Z',
u'title': u'Checking out the Google+ app for android...',
u'updated': u'2013-06-28T08:56:53.110Z',
u'url': u'https://plus.google.com/117438835632597579589/posts/CrqqvQf4kLx',
u'verb': u'post'}
Does anyone have any suggestions for this?
Thanks

Unfortunately the location information in the Google+ API has been broken for quite a while already... Here's an issue you can star: https://code.google.com/p/google-plus-platform/issues/detail?id=393

Related

Incomplete API response for getUsers

I'm implementing an API integration for DocuSign, and I'm currently hitting the following endpoint: /v2/organizations/{organizationId}/users
The documentaton for this: https://developers.docusign.com/docs/admin-api/reference/users/users/getusers/#response200_docusign.api.organizations.web.models.restapi.v2.response.organizationuserresponse
The documentation is showing a response field, user_status. However, when I call the API, I get a response as follows:
{
"users":[
{
"id":"xxx-xxx-xxx-xxx-xxx",
"user_name":"Xxxx",
"first_name":"",
"last_name":"Xxxx",
"membership_status":"active",
"email":"xxxx#gmail.com",
"membership_created_on":"2021-07-30T02:24:20.243",
"membership_id":"xxxx-xxxx-xxxx-xxxx-xxxx"
},
{
"id":"yyy-yyy-yyy-yyy-yyy",
"user_name":"Yyyyy",
"first_name":"Yyyyy",
"last_name":"2",
"membership_status":"active",
"email":"yyyyyyy#yyy.yyy",
"membership_created_on":"2021-07-30T02:26:59.313",
"membership_id":"yyy-yyy-yyy-yyy-yyy"
},
{
"id":"zzz-zzz-zzz-zzz-zzz",
"user_name":"Zzzzz",
"first_name":"Zzzz",
"last_name":"Zzzz",
"membership_status":"active",
"email":"zzz#zzz-zzz.net",
"membership_created_on":"2021-07-15T04:05:18.803",
"membership_id":"zzz-zzz-zzz-zzz-zzz"
}
],
"paging":{
"result_set_size":3,
"result_set_start_position":0,
"result_set_end_position":2,
"total_set_size":3
}
}
As you can see, we have no user_status. Do we need to send any request parameters, to expand the response, or has this field been removed from the API response without being updated on the API documentation?
Or, could I assume that the user is active, if it appears in the API response, with a membership_status of active?
Thank you very much!
membership_status is probably what you're looking for.
there's no such thing as user_status because a user can be a member of multiple accounts and each membership can have a different status.
Here is a useful diagram:

Cannot get documentid using pnp.sp.search in spfx app

In an older JavaScript app I used keyword-query to search for document properties, and I could add the 'DlcDocID' field (Document id) to be retrieved.
I am currently developing an Spfx version of the app, and use pnp.sp.search to get document data. This way I can get the UniqueId and the DocId, but not the Document Id. How can I have this parameter included in the search results?
Extra:
I am using 1.3.11, and this code
pnp.sp.search(
{
Querytext:query,
RowLimit:rows,
StartRow:start,
SelectProperties: ["DocId"
, "UniqueId"
,"FileType"
,"ServerRedirectedEmbedURL"
, "ServerRedirectedPreviewURL"
,"LastModifiedTime"
,"Write"
,"Size"
,"SPWebUrl"
,"ParentLink"
,"Title"
,"HitHighlightedSummary"
,"Path"
,"Author"
,"LastModifiedTime"
,"DlcDocID"
],
But DlcDocID is never retrieved.
Looking at the docs, DlcDocID should be retrievable (it's queryable and retrievable by default). Have you tried using SearchQueryBuilder and selectProperties?
const q = SearchQueryBuilder().text(yourQuery).
.rowLimit(10).processPersonalFavorites.selectProperties('*', 'DlcDocID');
const results = await sp.search(q);
SearchQueryBuilder reference
The issue was that the pnp
SearchResult interface didn't have the DlcDocID in this version. Adding it solved the problem.

trial period in Checkout session in Stripe

I would like to create trial period to be used with stripe checkout session:
session = stripe.checkout.Session.create(
customer=customer.stripe_id,
payment_method_types=['card'],
line_items=[{
'price': "price_1HjynjHdAhQwSUAK",
'quantity': 1,
'tax_rates': ["txr_1Hkntg4yXtzmX", ],
},
mode='payment',
allow_promotion_codes=True,
success_url=request.build_absolute_uri(reverse('thanks')) + '?session_id=CHECKOUT_SESSION_ID}',
cancel_url=request.build_absolute_uri(reverse('index_payment')),
)
in the tripe.Subscription.create looks like we just need to add trial_end=1605387163, but it doesnt work in checkout session. I cant seem to find the way to do it even though I am pretty sure it is doable as displayed in this demo:
I appreciate if someone can help.
You've got the right idea with trial_end, it just needs to be a child parameter under subscription_data.
// other parameters
subscription_data: {
trial_end=1605387163
}
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data-trial_end
Brendan's answer pointed me in the right direction, for PHP the syntax to add the trial_end would be for example:
$session = \Stripe\Checkout\Session::create([
.......
Your Other parameters
.......
'subscription_data' => ['trial_end' => 1624110173],
]);
Where 1624110173 is unix timestamp for the end of the free period. See this Stripe document for general explanation of checkout process and code:
Stripe Documents

Getting user info, e.g, title, department in onelogin user API

I'm using the Onelogin user API interface to retrieve profile information for use in my application. I require the fields of Department and Title in the response, but this is not returned by default.
I did find a hack to replicate the info in Custom Fields, since all information present under Custom Fields is sent in the response of the API query.
Is there any other way to mention that these required fields need to be sent in the API response?
Sample Response:
'data':[
{
'status':1,
'distinguished_name':None,
'password_changed_at': '2016-09-21T12:09:03.021 Z',
'updated_at': '2016-09-27T08:52:00.179 Z',
'directory_id':None,
'invalid_login_attempts':None,
'locked_until':None,
'openid_name':'ash###',
'id':27046681,
'invitation_sent_at':'2016-08-09T06:53:57.334 Z',
'manager_ad_id':None,
'custom_attributes':{
'city':'San Francisco'
'dept':'Engineering'
},
'role_id':None,
'last_login': '2016-09-27T08:52:00.140 Z',
'email':'ash###########',
'username':'ash###########',
'samaccountname':None,
'firstname':'Ash###',
'lastname':'',
'activated_at': '2016-08-11T06:35:19.147 Z',
'userprincipalname':None,
'phone':'',
'member_of':None,
'created_at': '2016-08-09T06:53:57.360 Z',
'locale_code':None,
'group_id':None,
'external_id':None,
'notes':None
}
Engineering has completed your requested enhancement and these fields should be available now.

Get GitHub avatar from email or name

I'm trying to get the GitHub user picture (avatar) from users of GitHub.
I've found these API:
https://avatars.githubusercontent.com/<username>
https://avatars.githubusercontent.com/u/<userid>
But I can't find a way to get the avatar from the user email or the user display name.
I can't find documentation about that.
Is there some similar URL API to get what I'm looking for?
You can append .png to the URL for the User's profile to get redirected to their avatar. You can add the query param size to specify a size smaller than the default of 460px wide (i.e. it won't allow larger than 460).
Examples:
https://github.com/twbs.png
https://github.com/npm.png?size=200
https://github.com/github.png?size=40
https://developer.github.com/v3/users/#get-a-single-user
Use the /users/:user endpoint. Should be under avatar_url in the returned json.
For example, my avatar_url can be found by hitting this url.
Edit
There is another way I can think of that is kind of roundabout. Since GitHub uses Gravatar, if you know the email associated with the account, do an md5 hash of the lowercase, stripped email address and construct a url like http://www.gravatar.com/avatar/[md5_here].
This is an old post but nobody has proposed Github Search Users API with scope field :
using in:email : https://api.github.com/search/users?q=bmartel+in%3Aemail
using in:username : https://api.github.com/search/users?q=Bertrand+Martel+in%3Ausername
Or using new Graphql API v4 :
{
search(type: USER, query: "in:email bmartel", first: 1) {
userCount
edges {
node {
... on User {
avatarUrl
}
}
}
}
}
Using GraphQL API v4, this will work too
Query (for username)-
{
user(login: "username") {
avatarUrl
}
}
Response -
{
"data": {
"user": {
"avatarUrl": "https://avatars1.githubusercontent.com/u/..."
}
}
}
GitHub avatar can be accessed through https://avatars.githubusercontent.com/u/YOUR_USER_ID
Optionally, you can modify the size at the end like so https://avatars.githubusercontent.com/u/YOUR_USER_ID?s=460

Resources