Collections
...
Collections API
Collections

Update Collection

3min
update collection collections can be updated by making an http put to the /collections/collection id endpoint (where collection id is the id of the collection) the body can be either x www form urlencoded parameters or a json object the parameters https //docs trajectdata com/bluecartapi/collections api/collections/create#parameters for updating a collection are the same as those used when creating https //docs trajectdata com/bluecartapi/collections api/collections/create a collection example put put /collections/collection id in the example below we update a collection with id=123456 to run weekly, on monday at 8am $ curl x put "https //api bluecartapi com/collections/123456?api key=demo" \\ d schedule type="weekly" \\ d schedule days of week="1" \\ d schedule hours="8"const axios = require('axios'); const body = { schedule type 'weekly', schedule days of week '1', schedule hours '8', } 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 body = { 'schedule type' 'weekly', 'schedule days of week' '1', 'schedule hours' '8', } 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 = http build query(\[ 'schedule type' => 'weekly', 'schedule days of week' => '1', 'schedule hours' => '8', ]); $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, $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 a json object containing details of the updated collection a collection can only be updated when it 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 next steps start collection https //docs trajectdata com/bluecartapi/collections api/collections/start get collection https //docs trajectdata com/bluecartapi/collections api/collections/get