API Reference
/api/v1/search/posts
/api/v1/search/comments
Search for Reddit posts and comments programmatically.
Query parameters:
- 'query' - the search query. Has the same format as the query in the Search webpage.
- 'after' - the API call returns a value in the 'sort_key' field. You can use that value as an argument in following calls to further paginate through results.
- 'order_by' - sets the ordering of returned data. Can be 'top', 'oldest', or 'newest' (default).
- Keys can be generated from the My API page in your account.
Results: The data returned contains information about the posts and comments matching a given Reddit query. The results' fields match ones seen in the Datasets page.
Examples
curl "https://socialgrep.com/api/v1/search/posts?query=graphical%2Cbefore%3A2015-05-05" -H "Accept: application/json" -H "Authorization: Bearer YOUR_KEY"
{ "type":"post", "total_count":9398, "data": [ { "type":"post", "id":"34yzf3", "subreddit": { "id":"2tv9f", "name":"computercraft", "nsfw":false }, "created_utc":1430852120, "permalink":"https:\/\/old.reddit.com\/r\/ComputerCraft\/comments\/34yzf3\/graphical_gaugedial_programcode\/", "domain":"self.computercraft", "title":"Graphical Gauge\/Dial program\/code?", "selftext":"So I'm building a functional scale model of a 1960s power station in Feed the Beast (Direwolf20 1.7.10) and one of the biggest things I need is a Graphical Gauge\/Dial program\/code.\n\nSomething that looks like this: http:\/\/i.imgur.com\/lUo9dvN.png but can take a numerical input and can display that on a dial with specified min\/max values.\n\nAnyone know if there's a program out there that exists with this kind of thing? Ideally it would need to fit within one monitor.", "url":null, "score":2 }, ... ], "query":"graphical,before:2015-05-05,after:2015-05-04", "sort_key":[[1430798127000]] }
curl "https://socialgrep.com/api/v1/search/comments?query=graphical%2Cbefore%3A2015-05-05%2Cafter%3A2015-05-04&after=1430860867000" -H "Accept: application/json" -H "Authorization: Bearer YOUR_KEY"
{ "type": "comment", "total_count": 165371, "data": [ { "type":"comment", "id":"cqzir6l", "subreddit": { "id":"2rnve", "name":"buildapc", "nsfw":false }, "created_utc":1430860672, "permalink":"https:\/\/old.reddit.com\/r\/buildapc\/comments\/34zeyt\/build_help_help_me_fine_tune_my_first_build\/cqzir6l\/", "body":"Actually, if gaming, I'd go Intel rather than AMD. Their CPUs consistently beat out the FX series for gaming performance ([benchmark](http:\/\/www.anandtech.com\/bench\/CPU\/1107) - note how the i3-4360 beats an overclocked FX-9390!) Also, no graphics card in your build?\n\nThis build sits comfortably in your price range, and can easily play modern games on ultra\/max graphical settings at 1080p.\n\n[PCPartPicker part list](http:\/\/pcpartpicker.com\/p\/bbz6Vn) \/ [Price breakdown by merchant](http:\/\/pcpartpicker.com\/p\/bbz6Vn\/by_merchant\/)\n\nType|Item|Price\n:----|:----|:----\n**CPU** | [Intel Core i5-4460 3.2GHz Quad-Core Processor](http:\/\/pcpartpicker.com\/part\/intel-cpu-bx80646i54460) | $167.99 @ SuperBiiz \n**Motherboard** | [MSI H81M-E34 Micro ATX LGA1150 Motherboard](http:\/\/pcpartpicker.com\/part\/msi-motherboard-h81me34) | $49.99 @ SuperBiiz \n**Memory** | [\\*Team Elite Plus 8GB (1 x 8GB) DDR3-1600 Memory](http:\/\/pcpartpicker.com\/part\/team-memory-tpd38g1600c1101) | $47.99 @ Newegg \n**Storage** | [Crucial BX100 250GB 2.5" Solid State Drive](http:\/\/pcpartpicker.com\/part\/crucial-internal-hard-drive-ct250bx100ssd1) | $94.99 @ NCIX US \n**Storage** | [\\*Seagate Barracuda 1TB 3.5" 7200RPM Internal Hard Drive](http:\/\/pcpartpicker.com\/part\/seagate-internal-hard-drive-st1000dm003) | $48.45 @ OutletPC \n**Video Card** | [Gigabyte GeForce GTX 970 4GB WINDFORCE 3X Video Card](http:\/\/pcpartpicker.com\/part\/gigabyte-video-card-gvn970wf3oc4gd) | $329.99 @ SuperBiiz \n**Case** | [Cooler Master N200 MicroATX Mid Tower Case](http:\/\/pcpartpicker.com\/part\/cooler-master-case-nse200kkn1) | $40.99 @ NCIX US \n**Power Supply** | [XFX 550W 80+ Bronze Certified ATX Power Supply](http:\/\/pcpartpicker.com\/part\/xfx-power-supply-p1550sxxb9) | $51.99 @ Newegg \n | *Prices include shipping, taxes, rebates, and discounts* |\n | **Total** | **$832.38**\n | \\*Lowest price parts chosen from parametric criteria |\n | Generated by [PCPartPicker](http:\/\/pcpartpicker.com) 2015-05-05 17:17 EDT-0400 |\n\n", "sentiment":0.5093, "score":1 }, ... ], "query":"graphical,before:2015-05-05,after:2015-05-04", "sort_key":[[1430853807000]] }