{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","settings":"","results":{"codes":[]},"params":[]},"next":{"description":"","pages":[]},"title":"Step 3: API Requests","type":"basic","slug":"api-requests-1","excerpt":"","body":"The Yammer REST API enables message posting, feed access, and many other capabilities. It supports both [Yammer OAuth 2 (legacy)](https://developer.yammer.com/docs/oauth-2) and [Azure Active Directory (AAD) tokens](https://techcommunity.microsoft.com/t5/yammer-blog/yammer-api-with-aad-tokens-postman-collection/ba-p/857923). Azure Active Directory tokens are recommended over using Yammer OAuth 2 (Legacy) tokens.\n\n[block:api-header]\n{\n  \"title\": \"Use Postman with the Yammer API\"\n}\n[/block]\nYou can use the Yammer Postman collection to get started with Yammer APIs in minutes. Download the [Postman Collection here](https://github.com/Sameer-MSFT/YammerAPIPostman) and follow [these directions and set it up](https://techcommunity.microsoft.com/t5/yammer-blog/yammer-api-with-aad-tokens-postman-collection/ba-p/857923).\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/48639c9-Postman.png\",\n        \"Postman.png\",\n        2680,\n        1672,\n        \"#333\"\n      ],\n      \"caption\": \"Yammer API in Postman.\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Authentication\"\n}\n[/block]\nOnce you have a valid access token, your app can make requests to the Yammer API to push and pull data by sending the access token as a \"Bearer\" token in the \"Authorization\" request header.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /api/v1/messages/messages.json HTTP/1.1\\nHost: www.yammer.com\\nAuthorization: Bearer abcDefGhi\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nFor more detail on the “Bearer” token refer to: http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-23\n\nIf the access token expires, or the user de-authorizes your app, the API request will return an HTTP 401 with the following error in the body of the response. [Learn more](https://developer.yammer.com/docs/oauth-2) about authenticating to the Yammer API.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"response\\\": {\\n    \\\"message\\\": \\\"Token not found.\\\",\\n    \\\"code\\\": 16,\\n    \\\"stat\\\": \\\"fail\\\"\\n  }\\n}\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nSee all the Yammer V1 REST API endpoints [here.](https://developer.yammer.com/docs/rest-api-rate-limits)","updates":[],"order":3,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"6058ed7fbed337006cd71277","createdAt":"2021-03-22T19:18:23.465Z","user":"5cd352a0d05b5a000f225f36","category":{"sync":{"isSync":false,"url":""},"pages":["545137a814af501a00b50cff","5451389e14af501a00b50d11","5451384514af501a00b50d04","546b8edb62515a14007ebc39","546b9214b47b5d1400109efa","546b922862515a14007ebc4f","546b9234b47b5d1400109efc","546b924762515a14007ebc51","546b925662515a14007ebc53","546fdac1691dc8080089521d","547374bd007eb108007e0380"],"title":"Getting Started","slug":"documentation","order":0,"from_sync":false,"reference":false,"_id":"545137a814af501a00b50cfd","project":"545137a814af501a00b50cf9","version":"545137a814af501a00b50cfc","createdAt":"2014-10-29T18:53:28.598Z","__v":11},"version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["545137a814af501a00b50cfd","545138eaa66f020800dbab4a","546b9072b47b5d1400109edf","546b9082b47b5d1400109ee0","546b9088b47b5d1400109ee1","546b909462515a14007ebc43","546b90a0b47b5d1400109ee2","546ced235884600e007a92f6","5481008eea7fd40b00cd7c2b","573b9d83ee2b3b220042291f","57be1efa15efc70e006a5f99","5ee004f52c97b4004c7a5876"],"_id":"545137a814af501a00b50cfc","project":"545137a814af501a00b50cf9","__v":12,"createdAt":"2014-10-29T18:53:28.525Z","releaseDate":"2014-10-29T18:53:28.525Z"},"project":"545137a814af501a00b50cf9","__v":0,"parentDoc":null}

Step 3: API Requests


The Yammer REST API enables message posting, feed access, and many other capabilities. It supports both [Yammer OAuth 2 (legacy)](https://developer.yammer.com/docs/oauth-2) and [Azure Active Directory (AAD) tokens](https://techcommunity.microsoft.com/t5/yammer-blog/yammer-api-with-aad-tokens-postman-collection/ba-p/857923). Azure Active Directory tokens are recommended over using Yammer OAuth 2 (Legacy) tokens. [block:api-header] { "title": "Use Postman with the Yammer API" } [/block] You can use the Yammer Postman collection to get started with Yammer APIs in minutes. Download the [Postman Collection here](https://github.com/Sameer-MSFT/YammerAPIPostman) and follow [these directions and set it up](https://techcommunity.microsoft.com/t5/yammer-blog/yammer-api-with-aad-tokens-postman-collection/ba-p/857923). [block:image] { "images": [ { "image": [ "https://files.readme.io/48639c9-Postman.png", "Postman.png", 2680, 1672, "#333" ], "caption": "Yammer API in Postman." } ] } [/block] [block:api-header] { "title": "Authentication" } [/block] Once you have a valid access token, your app can make requests to the Yammer API to push and pull data by sending the access token as a "Bearer" token in the "Authorization" request header. [block:code] { "codes": [ { "code": "GET /api/v1/messages/messages.json HTTP/1.1\nHost: www.yammer.com\nAuthorization: Bearer abcDefGhi", "language": "text" } ] } [/block] For more detail on the “Bearer” token refer to: http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer-23 If the access token expires, or the user de-authorizes your app, the API request will return an HTTP 401 with the following error in the body of the response. [Learn more](https://developer.yammer.com/docs/oauth-2) about authenticating to the Yammer API. [block:code] { "codes": [ { "code": "{\n \"response\": {\n \"message\": \"Token not found.\",\n \"code\": 16,\n \"stat\": \"fail\"\n }\n}", "language": "text" } ] } [/block] See all the Yammer V1 REST API endpoints [here.](https://developer.yammer.com/docs/rest-api-rate-limits)