{"_id":"550ada9e921b7d0d00228884","category":{"_id":"55246f72ccc28a0d0062c560","version":"550ada9d921b7d0d00228876","__v":1,"pages":["55356d8ee3f0920d004f5c54"],"project":"550a379f635c660d00527fd8","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-04-07T23:59:46.143Z","from_sync":false,"order":3,"slug":"general-usage","title":"General Usage"},"user":"550a378e635c660d00527fd7","__v":25,"project":"550a379f635c660d00527fd8","version":{"_id":"550ada9d921b7d0d00228876","forked_from":"550a3b2542fff40d00ae5ffb","project":"550a379f635c660d00527fd8","__v":3,"createdAt":"2015-03-19T14:18:05.245Z","releaseDate":"2015-03-19T14:18:05.245Z","categories":["550ada9d921b7d0d00228877","550ada9d921b7d0d00228878","550ada9d921b7d0d00228879","550ada9d921b7d0d0022887a","550ada9d921b7d0d0022887b","550ada9d921b7d0d0022887c","550ada9d921b7d0d0022887d","5523e61e71c0542100993493","55246f72ccc28a0d0062c560"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"3.0.0","version":"3.0.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-03-19T02:52:22.560Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Adjust the following default options as necessary when initializing Snoocore. Configuration options get passed in when initializing an instance:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var configOptions = {\\n  userAgent: 'myScript v1.2.3 /u/username',\\n  // other configuration options\\n};\\n\\nvar reddit = new Snoocore(configOptions);\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n## Possible configuration options\n\n - [User Agent](#section-user-agent) (**Required**)\n - [OAuth](#section-oauth) (**Required** _unless using browser cookies_)\n - [Use Browser Cookies](#section-use-browser-cookies)\n - [Throttle](#section-throttle)\n - [Decode HTML entities](#section-decode-html-entities)\n - [Retry Attempts](#section-retry-attempts)\n - [Retry Delay](#section-retry-delay)\n - [Request Timeout](#section-request-timeout)\n - [API Type](#seciton-api-type)\n - [Servers](#section-servers)\n\n### User Agent\n\n`userAgent: <string>`\n\n**REQUIRED**\n\nUniquely identify your application.\n\nReddit has a [set of API rules](https://github.com/reddit/reddit/wiki/API#wiki-rules) that outline how to identify an app using a `User-Agent` string.\n\n### OAuth\n\n**REQUIRED** _unless using browser cookies_\n\nOption needed when interacting with OAuth.\n\nSee the [OAuth Overview](oauth-overview) section for more information.\n\n### Use Browser Cookies\n\n`useBrowserCookies: <bool>`\n\n```\nDefault: false\n```\n\nUse browser cookies when injecting Snoocore into a page?\n\nSee the [Using Browser Cookies](doc:using-existing-browser-cookies) section for more information.\n\n### Throttle\n\n`throttle: <int>`\n\nMilliseconds to throttle requests at. The default wait is 1 request per second (`1000`). Set to `0` to disable (See [Throttle Options](doc:throttle)).\n\n### Decode HTML Entities\n\n`decodeHtmlEntities: <boolean>`\n\n```\nDefault: false\n```\n\nGlobally decode html entities from reddits response.\n\n\n### Retry Attempts\n\n`retryAttempts: <int>`\n\n```\nDefault: 60\n```\n\nNumber of times to retry an endpoint when reddit's servers error on a call.\n\n### Retry Delay\n\n`retryDelay: <int>`\n\n```\nDefault: 5000\n```\n\nNumber of milliseconds to wait between each retry attempt.\n\n\n### Request Timeout\n\n`requestTimeout: <int>`\n\n```\nDefault: 20000\n```\n\nNumber of milliseconds a call has to complete a request to the reddit servers.\n\n### API Type\n\n`apiType: <string>`\n\n```\nDefault: \"json\"\n```\n\nAuto fill the `api_type` parameter with this value. This option will rarely need to be changed. Set to `false` to not auto-fill this parameter.\n\n### Servers\n\nIt is possible to change which servers Snoocore uses for calls.\n\n`apiServerUri: <string: domain>`\n`authServerUri: <string: domain>`\n\n```\nDefaults:\napiServerUri = \"oauth.reddit.com\"\nauthServerUri = \"www.reddit.com\"\n```\n\nIf `useBrowserCookies` is set to `true`, the `apiServerUri` defaults to `www.reddit.com`. \n\nSetting these values explicitly will override any defaults set.","excerpt":"","slug":"configuration-options","type":"basic","title":"Configuration Options"}

Configuration Options


Adjust the following default options as necessary when initializing Snoocore. Configuration options get passed in when initializing an instance: [block:code] { "codes": [ { "code": "var configOptions = {\n userAgent: 'myScript v1.2.3 /u/username',\n // other configuration options\n};\n\nvar reddit = new Snoocore(configOptions);", "language": "javascript" } ] } [/block] ## Possible configuration options - [User Agent](#section-user-agent) (**Required**) - [OAuth](#section-oauth) (**Required** _unless using browser cookies_) - [Use Browser Cookies](#section-use-browser-cookies) - [Throttle](#section-throttle) - [Decode HTML entities](#section-decode-html-entities) - [Retry Attempts](#section-retry-attempts) - [Retry Delay](#section-retry-delay) - [Request Timeout](#section-request-timeout) - [API Type](#seciton-api-type) - [Servers](#section-servers) ### User Agent `userAgent: <string>` **REQUIRED** Uniquely identify your application. Reddit has a [set of API rules](https://github.com/reddit/reddit/wiki/API#wiki-rules) that outline how to identify an app using a `User-Agent` string. ### OAuth **REQUIRED** _unless using browser cookies_ Option needed when interacting with OAuth. See the [OAuth Overview](oauth-overview) section for more information. ### Use Browser Cookies `useBrowserCookies: <bool>` ``` Default: false ``` Use browser cookies when injecting Snoocore into a page? See the [Using Browser Cookies](doc:using-existing-browser-cookies) section for more information. ### Throttle `throttle: <int>` Milliseconds to throttle requests at. The default wait is 1 request per second (`1000`). Set to `0` to disable (See [Throttle Options](doc:throttle)). ### Decode HTML Entities `decodeHtmlEntities: <boolean>` ``` Default: false ``` Globally decode html entities from reddits response. ### Retry Attempts `retryAttempts: <int>` ``` Default: 60 ``` Number of times to retry an endpoint when reddit's servers error on a call. ### Retry Delay `retryDelay: <int>` ``` Default: 5000 ``` Number of milliseconds to wait between each retry attempt. ### Request Timeout `requestTimeout: <int>` ``` Default: 20000 ``` Number of milliseconds a call has to complete a request to the reddit servers. ### API Type `apiType: <string>` ``` Default: "json" ``` Auto fill the `api_type` parameter with this value. This option will rarely need to be changed. Set to `false` to not auto-fill this parameter. ### Servers It is possible to change which servers Snoocore uses for calls. `apiServerUri: <string: domain>` `authServerUri: <string: domain>` ``` Defaults: apiServerUri = "oauth.reddit.com" authServerUri = "www.reddit.com" ``` If `useBrowserCookies` is set to `true`, the `apiServerUri` defaults to `www.reddit.com`. Setting these values explicitly will override any defaults set.