{"action":"created","issue":{"url":"https://api.github.com/repos/trevorsenior/snoocore/issues/77","labels_url":"https://api.github.com/repos/trevorsenior/snoocore/issues/77/labels{/name}","comments_url":"https://api.github.com/repos/trevorsenior/snoocore/issues/77/comments","events_url":"https://api.github.com/repos/trevorsenior/snoocore/issues/77/events","html_url":"https://github.com/trevorsenior/snoocore/issues/77","id":53942492,"number":77,"title":"POST /api/site_admin doesn't seem to work","user":{"login":"tamadra","id":7299481,"avatar_url":"https://avatars.githubusercontent.com/u/7299481?v=3","gravatar_id":"","url":"https://api.github.com/users/tamadra","html_url":"https://github.com/tamadra","followers_url":"https://api.github.com/users/tamadra/followers","following_url":"https://api.github.com/users/tamadra/following{/other_user}","gists_url":"https://api.github.com/users/tamadra/gists{/gist_id}","starred_url":"https://api.github.com/users/tamadra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamadra/subscriptions","organizations_url":"https://api.github.com/users/tamadra/orgs","repos_url":"https://api.github.com/users/tamadra/repos","events_url":"https://api.github.com/users/tamadra/events{/privacy}","received_events_url":"https://api.github.com/users/tamadra/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/trevorsenior/snoocore/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-01-10T03:24:07Z","updated_at":"2015-01-10T14:58:32Z","closed_at":"2015-01-10T06:45:46Z","body":"I'm trying to use snoocore to update the sidebar text (aka, \"description\") in my subreddit. However, I can't seem to get it to work.\r\n\r\nThe API in question: https://www.reddit.com/dev/api#POST_api_site_admin\r\n\r\nMy code, roughly:\r\n\r\n```javascript\r\n// fetch the edit.json for my-subreddit\r\nreddit.login().then(reddit('/r/my-subreddit/about/edit.json').get().then(function(result){\r\n\r\n  // change the description of my-subreddit slightly\r\n  result.data.description += \"some text appended at the end\";\r\n\r\n  // now submit the json object back to reddit\r\n  reddit.login().then(reddit('/api/site_admin').post(result).done()).done();\r\n\r\n})).done();\r\n```\r\n\r\nAny help? Thanks."},"comment":{"url":"https://api.github.com/repos/trevorsenior/snoocore/issues/comments/69458529","html_url":"https://github.com/trevorsenior/snoocore/issues/77#issuecomment-69458529","issue_url":"https://api.github.com/repos/trevorsenior/snoocore/issues/77","id":69458529,"user":{"login":"trevorsenior","id":1592403,"avatar_url":"https://avatars.githubusercontent.com/u/1592403?v=3","gravatar_id":"","url":"https://api.github.com/users/trevorsenior","html_url":"https://github.com/trevorsenior","followers_url":"https://api.github.com/users/trevorsenior/followers","following_url":"https://api.github.com/users/trevorsenior/following{/other_user}","gists_url":"https://api.github.com/users/trevorsenior/gists{/gist_id}","starred_url":"https://api.github.com/users/trevorsenior/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trevorsenior/subscriptions","organizations_url":"https://api.github.com/users/trevorsenior/orgs","repos_url":"https://api.github.com/users/trevorsenior/repos","events_url":"https://api.github.com/users/trevorsenior/events{/privacy}","received_events_url":"https://api.github.com/users/trevorsenior/received_events","type":"User","site_admin":false},"created_at":"2015-01-10T14:58:32Z","updated_at":"2015-01-10T14:58:32Z","body":"It would have to be a configuration option similar to PRAW, with the default being disabled.\r\n\r\nIt *is* possible to blindly decode the entire reddit response before parsing the JSON response. This is how PRAW handles the situation. https://github.com/praw-dev/praw/blob/v2.1.19/praw/__init__.py#L387\r\n\r\n- - -\r\n\r\nAs of now, Snoocore is very high level & does not dive into *specific* endpoints and never will - someone can write a wrapper for Snoocore for this type of functionality. The only exception is authentication and listing support because that can be hard to handle correctly. However even listing support is high level because it works for all listings, and is not specific to any one listing.\r\n\r\nFor listings, my other project [trevorsenior/snooform](https://github.com/trevorsenior/snooform) parses the reddit api determines if an endpoint is a listing and adds [an attribute](https://github.com/trevorsenior/snooform/blob/0.1.1/build.js#L215) `isListing`. Snoocore uses the output from the generated api so it knows which endpoints are listings without any performance hits.\r\n\r\nThis works because in the documentation Reddit clearly defines what a listing is so I can search for the attributes (`'before', 'after', 'limit', 'count', 'show'`) in an endpoint, and if they exist mark it as a listing! Sadly this is not the case for `/about/edit.json` - there is no way to determine what needs to be decoded.\r\n\r\n- - -\r\n\r\nI think blindly decoding every response it a bit much (how PRAW goes about it) and would prefer something more specific.\r\n\r\nIf it were to be supported globally (PRAW-like), the configuration would gain an extra value:\r\n\r\n```javascript\r\nvar reddit = new Snooroce({\r\n  userAgent: 'test',\r\n  oauth: { /* ... */ },\r\n  decodeHtmlEntities: true // default false\r\n});\r\n```\r\n\r\nAnother way to handle this is expanding the *per call* options. Currently there is only one, [`bypassAuth`](https://github.com/trevorsenior/snoocore/blob/2.1.0/Snoocore.js#L193) ([docs]**(http://tsenior.com/snoocore/advancedUsage.html)) that allows you to skip authentication for a single call, but it can support `decodeHtmlEntities`:\r\n\r\n```javascript\r\nreddit('/about/edit.json').get({created: true}, {decodeHtmlEntities: true}).then(/* */)\r\n```\r\n\r\nBy handling it on a per call basis, we don't have any performance hits of decoding every call blindly even if there is nothing to decode.\r\n\r\nThoughts?\r\n\r\n<sub>** probably going to move the `bypassAuth` documentation into a \"per call\" configuration page if `decodeHtmlEntities` is added in. Making this note in case link provided breaks at a later date.</sub>\r\n\r\n "}}