Collections
...
Collections API
Requests

Create Requests

5min
create requests adding requests to a collection is achieved by making an http put to the /collections/collection id endpoint (where collection id is the id of the collection to add requests to) the body of the request should be a json array of request objects (up to 1000 requests can be added per call) the maximum number of requests per collection is 15,000 (or 100 when adding requests with include html=true set) the /collections/collection id endpoint used for adding requests to a collection is the same endpoint as used when updating a collection https //docs trajectdata com/bluecartapi/collections api/collections/update , we've just listed them seperately in the docs for ease of reference the parameters https //docs trajectdata com/bluecartapi/walmart product data api/requests/parameters/common for creating a request are the same as those used when making a request via the walmart product data api https //docs trajectdata com/bluecartapi/walmart product data api/overview collection status requests can only be added to a collection when the collection is not running to check whether a collection is currently running use the get collection https //docs trajectdata com/bluecartapi/collections api/collections/get endpoint concurrency when creating requests you should make calls to the create request endpoint sequentially, rather than in parallel each call can contain up to 1000 request to add though if you make too many concurrent calls you will receive an http 429 error using include html=true in collections when adding requests with include html=true to a collection the maximum number of requests per collection is 100 (rather than 15,000) because including the html within the response makes the collection result sets much larger the limit is in place to ensure result set files are of a manageable size if you have need to run a large number of requests all with include html=true then simply split the requests across multiple 100 request collections example put put /collections/collection id in the example below we add a new request to a collection with id=123456 custom ids when you add a request to a collection bluecart api assigns it an unique id you can use this id to track the request across multiple result sets bluecart api also lets you specify your own custom id , in addition to the bluecart api assigned id, making it easy to use an id from your app track requests $ curl x put "https //api bluecartapi com/collections/123456?api key=demo" \\ h "content type application/json" \\ d "{\\"requests\\" \[{\\"type\\" \\"product\\",\\"customer zipcode\\" \\"77001\\",\\"item id\\" \\"782866746\\",\\"custom id\\" \\"mycustomid 001\\"}]}"const axios = require('axios'); const body = { requests \[ { "type" "product", "customer zipcode" "77001", "item id" "782866746", "custom id" "mycustomid 001" }]} axios put('https //api bluecartapi com/collections/123456?api key=demo', body) then(response => { const apiresponse = response data; console log('collection updated ' + json stringify(apiresponse, 0, 2)); }) catch(error => { console log(error); });import requests import json body = { "requests" \[ { "type" "product", "customer zipcode" "77001", "item id" "782866746", "custom id" "mycustomid 001" }]} api result = requests put('https //api bluecartapi com/collections/123456?api key=demo', json=body) api response = api result json() print "collection updated ", json dumps(api response)\<?php $body = \[ "requests" => array(\[ "type" => "product", "customer zipcode" => "77001", "item id" => "782866746", "custom id" => "mycustomid 001" ])]; $ch = curl init('https //api bluecartapi com/collections/123456?api key=demo'); 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); curl setopt($ch, curlopt customrequest, "put"); curl setopt($ch, curlopt postfields, json encode($body)); $json = curl exec($ch); curl close($ch); $api result = json decode($json, true); print r($api result); echo "collection updated", php eol; ?> bluecart api responds with the following json confirming the requests have been successfully created note the requests total count now reflects the count of the requests the collection has, including those just added to list the requests in the collection use the list requests https //docs trajectdata com/bluecartapi/collections api/requests/list endpoint { "request info" { "success" true }, "collection" { "id" "123456", "created at" "2020 01 01t00 00 00 000z", "name" "my first collection", "schedule type" "daily", "enabled" true, "status" "idle", "requests total count" 2, "requests page count" 1, "results count" 0, "schedule hours" \[ 9, 17 ], "notification email" "john smith\@example com", "notification as json" false, "notification as jsonlines" false, "notification as csv" false } } next steps update request https //docs trajectdata com/bluecartapi/collections api/requests/update delete request https //docs trajectdata com/bluecartapi/collections api/requests/delete list requests https //docs trajectdata com/bluecartapi/collections api/requests/list