Collections
...
Collections API
Requests
List Requests
8min
list requests you can list the requests for a collection by making making a http get request to the /collections/collection id/requests/page endpoint (where collection id is the id of the collection to get requests for, and page is the page of requests to get) the /collections/collection id/requests/page endpoint returns the requests for a collection in pages of 1000 requests per page pages start at 1 you can find out how many pages a collection has by inspecting the requests page count field returned from the get collection https //docs trajectdata com/bluecartapi/collections api/collections/get endpoint bluecart api also provides two more endpoints to allow you to retrieve a download link for all requests in a collection, in either json or csv format list requests by page get get /collections/collection id/requests/page in the example below we list page 1 of the requests for the collection with id=123456 http https //api bluecartapi com/collections/123456/requests/1?api key=demo$ curl "https //api bluecartapi com/collections/123456/requests/1?api key=demo"const axios = require('axios'); const params = { api key 'demo' } axios get('https //api bluecartapi com/collections/123456/requests/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 bluecartapi com/collections/123456/requests/1', params) api response = api result json()\<?php $querystring = http build query(\[ 'api key' => 'demo', ]); $ch = curl init(sprintf('%s?%s', 'https //api bluecartapi com/collections/123456/requests/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); ?> bluecart api responds with the following json showing all the requests on page 1 of the collection { "request info" { "success" true }, "collection id" "123456", "requests page current" 1, "requests page count" 1, "requests" \[ { "type" "product", "customer zipcode" "77001", "item id" "782866746", "custom id" "mycustomid 001", "id" "abcdefghijklmnop" } ] } get json download links get get /collections/collection id/requests/json in the example below we retrieve download links for all requests for collection with id=123456 in json format http https //api bluecartapi com/collections/123456/requests/json?api key=demo$ curl "https //api bluecartapi com/collections/123456/requests/json?api key=demo"const axios = require('axios'); const params = { api key 'demo' } axios get('https //api bluecartapi com/collections/123456/requests/json', { params }) then(response => { const apiresponse = response data; }) catch(error => { console log(error); });import requests params = { 'api key' 'demo' } api result = requests get('https //api bluecartapi com/collections/123456/requests/json', params) api response = api result json()\<?php $querystring = http build query(\[ 'api key' => 'demo', ]); $ch = curl init(sprintf('%s?%s', 'https //api bluecartapi com/collections/123456/requests/json', $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); ?> bluecart api responds with the following json detailing the total number of requests requests total count , the total number of pages requests page count and a json file download link for each page { "request info" { "success" true }, "collection id" "123456", "requests total count" 1, "requests page count" 1, "download links" { "pages" \[ "https //requests bluecartapi com/collection requests 123456 page 1 json" ] } } get csv download links get get /collections/collection id/requests/csv in the example below we retrieve download links for all requests for collection with id=123456 in csv format http https //api bluecartapi com/collections/123456/requests/csv?api key=demo$ curl "https //api bluecartapi com/collections/123456/requests/csv?api key=demo"const axios = require('axios'); const params = { api key 'demo' } axios get('https //api bluecartapi com/collections/123456/requests/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 bluecartapi com/collections/123456/requests/csv', params) api response = api result json()\<?php $querystring = http build query(\[ 'api key' => 'demo', ]); $ch = curl init(sprintf('%s?%s', 'https //api bluecartapi com/collections/123456/requests/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); print r($api result); ?> bluecart api responds with the following json detailing the total number of requests requests total count , the total number of pages requests page count and a csv file download link for each page { "request info" { "success" true }, "collection id" "123456", "requests total count" 1, "requests page count" 1, "download links" { "pages" \[ "https //requests bluecartapi com/collection requests 123456 page 1 csv" ] } } next steps listing result sets https //docs trajectdata com/bluecartapi/collections api/results/list getting result sets https //docs trajectdata com/bluecartapi/collections api/results/get