How to upload files to yammer using REST API? - yammer

I wanted an API to upload files to yammer.
Initially I was using https://www.yammer.com/api/v1/pending_attachments API which now gives DEPRECATED API response.
Then I moved to https://filesng.yammer.com/v4/uploadSmallFile API which was working earlier but now it gives 500 status code.
Can someone please help me on this?

500 status code typically means you have the wrong authentication credentials or you don't have access, and the second API that you've listed requires AAD credentials. Once the correct AAD credentials are established, it should work.

Related

Trying to get downloadable url of the SharePoint file of the attachments shared in the teams/channel chat

We are trying to access the SharePoint url of the attachments shared in the teams/channel chat and for the teams meeting recording.
We have used Oauth2 to retrieve the auth token and using Microsoft graph api to get the downloadable/public url for the same
making a GET request with token in the request header still returns 401 Unauthorised error
Although we are able to get the downloadable url if we use site-id , list-id and item-id in the GET request https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item}/driveitem
But these are not available when our message extension app is invoked from a message
Posting the Answer for better knowledge
Copying from #Saonti comments
Using Graph API explorer are you able to get the drive item with this API graph.microsoft.com/v1.0/sites/%7Bsite-id%7D/lists/… ? Or you are getting error?

Zoho CRM API v2- Current user API (users?type=CurrentUser) returns 403

We are using Zohocrm api v2 for getting currently logged in user. It works fine for most of the logins.
But we are getting 403 for one of the user account.
URL https://www.zohoapis.com/crm/v2/users?type=CurrentUser
HEADERS {Authorization=Zoho-oauthtoken 1000.786ecda99xxxx}
Response
{"code":"NO_PERMISSION","details":{"permissions":["Crm_Implied_Api_Access"]},"message":"permission
denied","status":"error"}
Response Code 403
Note: From the same zoho team other 2 users were able to login.
Please suggest.
Just adding the steps with which I tried in Postman. It works for me.
If at all any of the steps are different from yours, you could try these steps instead.
Add the client to get client secret
Generate auth token giving client id and secret (and scopes)
After this step, oauth permission request page will be shown, asking user to confirm access to Accounts User Profile and CRM users info. Both have to be accepted.
Use the latest generated token in postman
Execute API GET

Outlook API: getting access-token from front-end, how can i use it in web API backend to get Outlook messages

Im writing a application for outlook, front-end Angular, backend Web API.
I'm successfully getting access-token using adal in front-end, sessionStorage is:
adal.access.token.keyxxxxx6b-xxxx-xxxx-xxxx-376xxxx9c09:"Access-token"
adal.error:""
adal.error.description:""
adal.expiration.key:"0"
adal.expiration.keyxxxxx6b-xxxx-xxxx-xxxx-376xxxx9c09:"1482073764"
adal.idtoken:"access-token"
adal.login.error:""
adal.login.request:"http://localhost:8080/"
adal.nonce.idtoken:"xxxxx6b-xxxx-xxxx-xxxx-376xxxx9c09"
adal.session.state:"86xxxxxd-xxxx-480b-xxxx-34923xxxx918"
adal.state.login:"9axxxxxx-xxxx-xxxx-xxxx-360xxxxxx94"
adal.token.keys:"xxxxx6b-xxxx-xxxx-xxxx-376xxxx9c09|"
adal.token.renew.statusxxxxx6b-xxxx-xxxx-xxxx-376xxxx9c09:"Completed"
Now i'm sending access-token to backend, and i want to get messages from outlook API, but how can i do it.
Searched for outlook REST api, and tested using POSTMAN, but not working.(401 error)
Get https://outlook.office.com/api/v2.0/me/messages
Authorization: Bearer access-token
Accept: application/json
Any suggestions on how to do this?
Thanks in advance.
It looks like you are trying to complete the on-behalf-of flow.
This is where a front-end API gets an access token to a middle tier service, which subsequently gets an access token to a back-end API. Let's assume that the token from the front-end to the middle tier has user context. You are able to get a token from the middle tier, to the back-end using the same user context, by requesting a new access token using the original access token.
Here are more details on the flow: Find the section titled Delegated User Identity with OAuth 2.0 On-Behalf-Of Draft Specification
Here is a code sample integrating this flow:
https://github.com/Azure-Samples/active-directory-dotnet-webapi-onbehalfof
Just to note, in this specific case, that the 401 error implies that you do not have the correct permissions for calling and accessing the API you want. Can you make sure you have selected the right permissions for the resource you want to access, for the client that you are accessing it with?
I hope this is what you are looking for!

Yammer /autocomplete/ranked returning 401

If i make a GET request to other api calls like "https://www.yammer.com/api/v1/messages.json", I get results back (this proves the office 365 bearer token i am using works).
If i make a request to Yammer /autocomplete/ranked using the following url:
https://www.yammer.com/api/v1/autocomplete/ranked?prefix=&models=group:10
or
https://api.yammer.com/api/v1/autocomplete/ranked?prefix=&models=group:10
This returns a 401:
Credentials are required to access this resource
Any ideas what might be wrong?
API: https://developer.yammer.com/docs/autocompleteranked
I'm terribly sorry, but at present, this particular endpoint does not support using an O365 bearer token.
We are adding support for O365 credentials to more and more of our endpoints, but in the meantime you can access all of our endpoints using a Yammer-only token, documentation for which can be found here: https://developer.yammer.com/docs/app-registration
Source: I'm an engineer at Yammer and I've worked on these features.

The API returned an error: Error: No access or refresh token is set

I was able to successfully log in using Google Classroom and pull the course data during the trial. This was on my local machine. Now I have moved to my test server. I can still log in via google but can no longer pull the course data. I have already updated my client_secret file (updated the appropriate endpoints) but i get the following error after calling classroom.courses.list
Error: No access or refresh token is set.
Would appreciate anyone's help. I do have Google Classroom API as one of my APIs. Not sure if it's because i'm now on a domain instead of my localhost.
Sadly, I was doing a 2 part registration. The first past, I was setting the token. When the page was submitted again with new details from the user, when I was making the call to google, I hadn't set the token.

Resources