How to make Yammer REST API Call to get authenticated user's profile information?

StackOverflow https://stackoverflow.com/questions/22154403

  •  19-10-2022
  •  | 
  •  

Question

I am trying to call Yammer REST API for getting authenticated user's information using the following code:

$(document).ready(function() {
  $.ajax({
     method: "GET",
    url: "https://www.yammer.com/api/v1/users/current.json",

    contentType: "application/json; charset=utf-8",
    dataType: 'json',
    success: function(data) {
        if (data.Success) {
            alert(data);
        }
    },
    error: function(xhr2, status2) {
        alert(xhr2.status);
    }
});
});

However, it is always going to error method. Can anyone guide me to proceed on this piece?

Pas de solution correcte

Autres conseils

You're not sending the API any authentication information, so how does it know what user it's supposed to be pulling down? You should take a look at the Javascript SDK.

I had the same problem. Change url from "https://www.yammer.com/api/v1/users/current.json" to "users/current.json" solves the issue (it will be going to success method)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top