Foursquare API - cannot edit venue I am a manager of - api

I am using the Foursquare API to add/edit venues. I have created a FS user, and created my app. I have done the oAuth token exchange and have my user token.
From here I can make the required API calls to add a venue, get this venue, and then edit this venue. This works brilliantly, like a charm.
I was then made a manager of a different venue. In the FS web front-end, I am able to view this venue, and manage it - i.e. change it's name and so on.
When I then try and change this second venue via the API I get the following response:
{
"meta": {
"code": 403,
"errorType": "not_authorized",
"errorDetail": "User not authorized to edit venue"
},
"response": {}
}
The only difference between the API call that works, and the one that doesn't, is the FS Venue ID (which I know is correct). I'm obviously missing something, but I have no idea what - any thoughts?

The reason seems to be that when you add someone as an owner of the venue via the website, this action only allows this person to manage the Venue via the website. Think of it as the FS website is simply a FS App, like yours or mine.
It might be considered a bit odd if my app could authorise your app to act as manager for one of my users, I suppose.

Related

Http delete request to Google Directory API returning 412 Precondition is not met: location If-Match

I have been using Postman to send http requests to Google's Directory API. The GET request works fine (which shows that the admin token as well works fine) to get info for a user.
But, what I need to do is delete the user, and when I try this, I get the following back:
{
"error": {
"code": 412,
"message": "Precondition is not met.",
"errors": [
{
"message": "Precondition is not met.",
"domain": "global",
"reason": "conditionNotMet",
"location": "If-Match",
"locationType": "header"
}
]
}
}
I was presupposing that I was missing the etag, which is what I added from the user, but it did not work. I also tried adding "*" to the If-Match tag, and that did not work either. Maybe there is a way with a put or patch request?
The API reference is this: https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/delete
The API does not work on Google's reference page either. I have also tried this in multiple domains where I am the super-admin so the error is not related to a specific super-user or domain.
I have also made sure, in multiple tests, that the user I am trying to delete is not an admin of any type.
I am adding images below to show that the GET api works fine. So I just need to know how to format the API request to be able to delete the user.
Ok, after talking directly to Google and even seeing that Jay Lee (author of GAM) ran into the same problem, we found out that you can't delete a user if:
It has a license of some sort
It's an admin
It has a Google Vault retention rule applied
To be able to delete a user from now on, you must remove all these things (licenses, admin privileges, Vault retention rules) or you must transfer the information of that user to another user (along with whatever else Google asks you to remove beforehand).
The "Precondition is not met" is vague and Google should change this, but it means that one of the three things above have not been removed yet.
Below I am adding multiple links to confirm what I mentioned above as well as the APIs you need to use on users before being able to delete them.
https://groups.google.com/g/google-apps-manager/c/83kR-4MoPk0?pli=1
https://github.com/GAM-team/GAM/releases?gam-releases
https://developers.google.com/admin-sdk/data-transfer/reference/rest/v1/transfers#DataTransfer
https://developers.google.com/vault/guides/holds#python
https://developers.google.com/vault/reference/rest/v1/matters.holds.accounts/list

Insufficient Privileges when trying to display user photos on external sites

I have this situation. Im trying to display user photos from an external site, all the configurations about remote sites are already set. I created a connected app in org A and from org B i'm retrieving the users from org A.
All of this works however i cannot show the photos from those users because for that to happen i have to be able to use the ConnectApi.UserProfiles.GetPhoto method which i'm doing right now but i keep getting the "insufficient privileges" error. I tried getting the AccessToken through postman like this
This redirects me to the login site so i can log into my org with my credentials. After that i get an AccessToken.
Next up, i want to be able to get the photos from users from the external site with the AccessToken, However i'm still getting the same error message "Insufficient Priviledges". Am i missing something? thanks in advance
According to: https://sforcenotes.blogspot.com/2015/10/solution-to-display-salesforce-user.html?showComment=1596211057195#c5848226245946017759
The solution is fairly easy but this does not work
I'm bit lost. You have some app that wants to log in to Salesforce and pull images from it? Or do you want to call out from Salesforce and pull images from external app? For first one you likely need "connected app". But you need "remote site settings" or "named credentials" only for calling out.
I'm assuming it's option 1.
There are lots of ways to log in to SF, SOAP API (just username + password), REST API (lots of OAuth2 options, with username+pass or username + JWT or just OAuth2 client id and user logs in to SF interactively, you don't see the password)... Sounds like you're past this stage?
A successful login response will look bit like that (depends on method used):
{"id":"https://login.salesforce.com/id/00Dx0000000BV7z/005x00000012Q9P",
"issued_at":"1278448832702",
"instance_url":"https://yourInstance.salesforce.com/",
"signature":"0CmxinZir53Yex7nE0TD+zMpvIWYGb/bdJh6XfOH6EQ=",
"access_token":"00Dx0000000BV7z!AR8AQAxo9UfVkh8AlV0Gomt9Czx9LjHnSSpwBMmbRcgKFmxOtvxjTrKW19ye6PE3Ds1eQz3z8jr3W7_VbWmEu4Q8TVGSTHxs",
"token_type":"Bearer"}
You're supposed to take from it the access_token (that's your session id. It'll always start with org's id, compare with Setup -> Company information) and instance_url (that's where you're supposed to send any subsequent requests. No more calling the login gateways: login.salesforce.com, test.salesforce.com or mydomain.my.salesforce.com). If you're getting "Insufficient Privileges" I think you didn't change the endpoint.
You can test you logged in OK by sending a GET to the id endpoint you received. It'll give you OpenId info about your user.
Here's my GET to fetch OpenId data with the "Authorization: Bearer " request
So another GET with same header and I have my ugly mug:
If you want somebody else's picture - query similar to /services/data/v48.0/query?q=SELECT SmallPhotoUrl, FullPhotoUrl FROM User WHERE Id = '005...' should work. Check User fields.
{
"totalSize" : 1,
"done" : true,
"records" : [ {
"attributes" : {
"type" : "User",
"url" : "/services/data/v48.0/sobjects/User/(redacted)"
},
"SmallPhotoUrl" : "https://(redacted)/profilephoto/7293L0000008Tfq/T",
"FullPhotoUrl" : "https://(redacted)/profilephoto/7293L0000008Tfq/F"
} ]
}
The key thing is to use the new endpoint and pass the session id in the header. You might even find it easier to use Chatter API to pull photos (also REST-based)

Follow on instagram from android and handle OAuthPermissionsException

i am using this link
https://api.instagram.com/v1/users/[user-id]/relationship?access_token=[ACCESS-TOKEN]
in the above link user_id is the id of the person to whom i want to follow and Access token is created for my app in instagram developer site.
and it give response like
{
"meta":
{
"error_type":"OAuthPermissionsException",
"code":400,
"error_message":"This request requires scope=relationships, but this access token is not authorized with this scope. The user must re-authorize your application with scope=relationships to be granted write permissions."
}
}
i searched on internet and some one told me to add scope=relationships while creating access token i don't know how to do this..
Simple Words
Follow a Instagram user on click of a button .
scope=likes+comments+relationships+basic
use it then you are trying to login
"To request multiple scopes at once, simply separate the scopes by a space. In the url, this equates to an escaped space (“+”)."
https://instagram.com/developer/authentication/

LinkedIn API - get information about my ALL Connections

I have used Facebook API but I am new to Linkedin api.
I need some help on how to get information (name, birthday, etc) about my ALL Connections, and I need help with both the token and the info-related API calls.
As for the token -- in Facebook there is the Facebook Console to generate tokens at runtime and test our API calls... Does LinkedIn have something similar?
Update: I'm able to get list of connections using:
http://api.linkedin.com/v1/people/~/connections?modified=new
... but how can I also get birthdates (if shared publicly)? I've attempted:
http://api.linkedin.com/v1/people/~/connections:(headline,first-name,last-name,date-of-birth)
...however, that shows me the first and last name but NOT the date of birth.
You can use the rest console here: http://developer.linkedin.com/rest-console
There is a template method you can use called "Get My Connections".
I hope this helps.
Update: LinkedIn has restricted their open API access, and this no longer works.
https://apigee.com/console/linkedin
Select OAuth2, click connect, then allow LinkedIn to privede apigee to your LI profile. Then in the left collumn, select Get My Connections. apigee prepares most of params, except format (xml/json), which you can add yourself.
Looks like now no such API available(Looks like depricated by Linkedin). Please let me know if i am wrong and suggest other ways to achieve user's connections.
I am getting this in response
{
"errorCode": 0,
"message": "Access to connections denied",
"requestId": "6Sxxxxxxx",
"status": 403,
"timestamp": 14xxxxxxxxx
}
Please see : https://developer.linkedin.com/support/developer-program-transition
I think what you are looking for, is the Linkedin Connections API. You can look at the documentation provided here -> http://developer.linkedin.com/documents/connections-api
There are also various other APIs for accessing profile, groups, companies, and jobs.
It returns an XML document so, you should be able to generate tokens and test your API calls without any problem.
These APIs are no longer available
2019 still works but with a different approach.
Do this:
You may follow the steps from here:
https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin/consumer/context
1 - Create an APP with r_1st_connections permission
2 - Authorization (STEP 2 from link)
GET https://www.linkedin.com/oauth/v2/authorization
scope should be r_1st_connections (your app must have this permission)
3 - Log in with your username and password
4 - Linkedin will return you code
something like: ?code=QWERTY
5 - Get your Access Token (STEP 3 from link)
POST https://www.linkedin.com/oauth/v2/accessToken
6 - Get your connections
GET https://api.linkedin.com/v2/connections?q=viewer&start=0&count=50
Link: https://learn.microsoft.com/en-us/linkedin/shared/integrations/people/connections-api?context=linkedin/compliance/context

Use google plus API to check availablity of personalized url

How can I use the google plus api to check if a personalized url is taken? Do I need to use OAuth to check this?
I've successfully connected to the G+ api using OAuth but can't find this simple functionality anywhere after checking the documentation.
Google+ does not provide an API for specifically checking the availability of a custom URL; however, you could use the People.get endpoint to specifically query for to check for results for a specific ID, such as "+LarryPage" (response fields limited to id,name):
GET https://www.googleapis.com/plus/v1/people/%2BLarryPage?fields=id%2Cname&key={YOUR_API_KEY}
Which returns:
{
"id": "106189723444098348646",
"name": {
"familyName": "Page",
"givenName": "Larry"
}
}
Or if you try an invalid custom ID, like "+SergeyBatmanBrin", you'd get an HTTP 404 as the response because that ID doesn't exist.
You will need to register a project in the Google APIs Console to register your client and get an API key or OAuth client ID to allow your app to perform these queries.