Batches
...
Batches API
Batches

Update Batch

3min
update batch batches can be updated by making an http put to the /batches/batch id endpoint (where batch id is the id of the batch) the body can be either x www form urlencoded parameters or a json object the parameters https //docs trajectdata com/valueserp/batches api/batches/create#parameters for updating a batch are the same as those used when creating https //docs trajectdata com/valueserp/batches api/batches/create a batch example put put /batches/batch id in the example below we update a batch with id=123456 to run weekly, on monday at 8am $ curl x put "https //api valueserp com/batches/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 valueserp com/batches/123456?api key=demo', body) then(response => { const apiresponse = response data; console log('batch 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 valueserp com/batches/123456?api key=demo', json=body) api response = api result json() print "batch 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 valueserp com/batches/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 "batch updated", php eol; ?> value serp responds with a json object containing details of the updated batch a batch can only be updated when it is not running to check whether a batch is currently running use the get batch https //docs trajectdata com/valueserp/batches api/batches/get endpoint next steps start batch https //docs trajectdata com/valueserp/batches api/batches/start get batch https //docs trajectdata com/valueserp/batches api/batches/get