Collections
...
Collections API
Result Sets

Get Result Set

7min
get result set you can retrieve the results within a result set by making making an http get request to the /collections/collection id/results/result set id endpoint (where collection id is the id of the collection to retrieve results for, and result set id is the id of the result set within that collection) get result set as json get get /collections/collection id/results/result set id in the example below we retrieve a result set with id=1 in collection with id=123456 in json format http https //api rainforestapi com/collections/123456/results/1?api key=demo$ curl "https //api rainforestapi com/collections/123456/results/1?api key=demo"const axios = require('axios'); const params = { api key 'demo' } axios get('https //api rainforestapi com/collections/123456/results/1', { params }) then(response => { const apiresponse = response data; }) catch(error => { console log(error); });import requests params = { 'api key' 'demo' } api result = requests get('https //api rainforestapi com/collections/123456/results/1', params) api response = api result json()\<?php $querystring = http build query(\[ 'api key' => 'demo', ]); $ch = curl init(sprintf('%s?%s', 'https //api rainforestapi com/collections/123456/results/1', $querystring)); curl setopt($ch, curlopt returntransfer, true); curl setopt($ch, curlopt followlocation, true); \# the following options are required if you're using an outdated openssl version \# more details https //www openssl org/blog/blog/2021/09/13/letsencryptrootcertexpire/ curl setopt($ch, curlopt ssl verifyhost, false); curl setopt($ch, curlopt ssl verifypeer, false); curl setopt($ch, curlopt timeout, 180); $json = curl exec($ch); curl close($ch); $api result = json decode($json, true); print r($api result); ?> rainforest api responds with the following json showing the result set details and download links for each page of json files containing the results { "request info" { "success" true }, "collection id" "123456", "result" { "id" 1, "started at" "2019 01 02t00 00 00 000z", "ended at" "2019 01 02t00 00 10 000z", "expires at" "2019 01 08t00 00 10 000z", "results page count" 1, "requests completed" 1, "requests failed" 0, "requests total" 1, "download links" { "pages" \[ "https //results rainforestapi com/collection results 123456 1 page 1 json" ], "all pages" "https //results rainforestapi com/collection results 123456 1 all pages zip" }, "webhook status" { "status" "ok", "log" \[ { "date time" "2020 01 01t00 00 00 000z", "text" "webhook post completed successfully " } ] }, "destination status" { "destination id" { "status" "ok", "log" \[ { "date time" "2020 01 01t00 00 00 000z", "text" "destination upload completed successfully " } ] } } } } get result set as json lines get get /collections/collection id/results/result set id/jsonlines in the example below we retrieve a result set with id=1 in collection with id=123456 in json lines format http https //api rainforestapi com/collections/123456/results/1/jsonlines?api key=demo$ curl "https //api rainforestapi com/collections/123456/results/1/jsonlines?api key=demo"const axios = require('axios'); const params = { api key 'demo' } axios get('https //api rainforestapi com/collections/123456/results/1/jsonlines', { params }) then(response => { const apiresponse = response data; }) catch(error => { console log(error); });import requests params = { 'api key' 'demo' } api result = requests get('https //api rainforestapi com/collections/123456/results/1/jsonlines', params) api response = api result json()$querystring = http build query(\[ 'api key' => 'demo', ]); $ch = curl init(sprintf('%s?%s', 'https //api rainforestapi com/collections/123456/results/1/jsonlines', $querystring)); curl setopt($ch, curlopt returntransfer, true); curl setopt($ch, curlopt followlocation, true); \# the following options are required if you're using an outdated openssl version \# more details https //www openssl org/blog/blog/2021/09/13/letsencryptrootcertexpire/ curl setopt($ch, curlopt ssl verifyhost, false); curl setopt($ch, curlopt ssl verifypeer, false); curl setopt($ch, curlopt timeout, 180); $json = curl exec($ch); curl close($ch); $api result = json decode($json, true); rainforest api responds with the following json showing the result set details and download links for each page of json lines files containing the results { "request info" { "success" true }, "collection id" "123456", "result" { "id" 1, "started at" "2019 01 02t00 00 00 000z", "ended at" "2019 01 02t00 00 10 000z", "expires at" "2019 01 08t00 00 10 000z", "results page count" 1, "requests completed" 1, "requests failed" 0, "requests total" 1, "download links" { "pages" \[ "https //results rainforestapi com/collection results 123456 1 page 1 jsonl" ], "all pages" "https //results rainforestapi com/collection results 123456 1 all pages jsonlines zip" }, "webhook status" { "status" "ok", "log" \[ { "date time" "2020 01 01t00 00 00 000z", "text" "webhook post completed successfully " } ] }, "destination status" { "destination id" { "status" "ok", "log" \[ { "date time" "2020 01 01t00 00 00 000z", "text" "destination upload completed successfully " } ] } } } } get result set as csv get get /collections/collection id/results/result set id/csv we provide a further endpoint, /collections/collection id/results/result set id/csv , to retrieve the result set in csv format when using this endpoint you can supply a csv fields querystring parameter to determine the fields that are included in the csv file the csv fields parameter should be specified as a comma seperated list of fields (in nested field, dot notation, format) for more information see the csv fields reference https //docs trajectdata com/rainforestapi/product data api/reference/csv fields in the example below we retrieve a result set with id=1 in collection with id=123456 in csv format http https //api rainforestapi com/collections/123456/results/1/csv?api key=demo$ curl "https //api rainforestapi com/collections/123456/results/1/csv?api key=demo"const axios = require('axios'); const params = { api key 'demo' } axios get('https //api rainforestapi com/collections/123456/results/1/csv', { params }) then(response => { const apiresponse = response data; }) catch(error => { console log(error); });import requests params = { 'api key' 'demo' } api result = requests get('https //api rainforestapi com/collections/123456/results/1/csv', params) api response = api result json()$querystring = http build query(\[ 'api key' => 'demo', ]); $ch = curl init(sprintf('%s?%s', 'https //api rainforestapi com/collections/123456/results/1/csv', $querystring)); curl setopt($ch, curlopt returntransfer, true); curl setopt($ch, curlopt followlocation, true); \# the following options are required if you're using an outdated openssl version \# more details https //www openssl org/blog/blog/2021/09/13/letsencryptrootcertexpire/ curl setopt($ch, curlopt ssl verifyhost, false); curl setopt($ch, curlopt ssl verifypeer, false); curl setopt($ch, curlopt timeout, 180); $json = curl exec($ch); curl close($ch); $api result = json decode($json, true); rainforest api responds with the following json showing the result set details and download links for each page of csv files containing the results { "request info" { "success" true }, "collection id" "123456", "result" { "id" 1, "started at" "2019 01 02t00 00 00 000z", "ended at" "2019 01 02t00 00 10 000z", "expires at" "2019 01 08t00 00 10 000z", "results page count" 1, "requests completed" 1, "requests failed" 0, "requests total" 1, "download links" { "pages" \[ "https //results rainforestapi com/collection results 123456 1 page 1 csv" ], "all pages" "https //results rainforestapi com/collection results 123456 1 all pages 246f6e2e561c90958384aa76e455e2bc95ad3a01 csv" }, "webhook status" { "status" "ok", "log" \[ { "date time" "2020 01 01t00 00 00 000z", "text" "webhook post completed successfully " } ] }, "destination status" { "destination id" { "status" "ok", "log" \[ { "date time" "2020 01 01t00 00 00 000z", "text" "destination upload completed successfully " } ] } } } }