Batches
...
Batches API
Searches
Update Search
4min
update search searches within a batch can be updated by making an http put to the /batches/batch id/search id endpoint (where search id is the id of the search and batch id is the id of the batch the search belongs to) the body can be either x www form urlencoded parameters or a json object the parameters https //docs trajectdata com/scaleserp/search api/overview for updating a search are the same as those used when making a call via the search api https //docs trajectdata com/scaleserp/search api/overview batch status searches can only be updated when the batch they belong to is not running to check whether a batch is currently running use the get batch https //docs trajectdata com/scaleserp/batches api/batches/get endpoint updating multiple searches you should make calls to the update search endpoint sequentially, rather than in parallel, as it is designed to update searches one by one if you make too many concurrent calls you will receive an http 429 error for mass update operations consider deleting and re creating the batch as this is typically quicker example put put /batches/batch id/search id in the example below we update a search with id=abcdefghijklmnop within a batch with id=123456 $ curl x put "https //api scaleserp com/batches/123456/abcdefghijklmnop?api key=demo" \\ d q="altcoin exchange"const axios = require('axios'); const body = { "q" "altcoin exchange" } axios put('https //api scaleserp com/batches/123456/abcdefghijklmnop?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 = { "q" "altcoin exchange" } api result = requests put('https //api scaleserp com/batches/123456/abcdefghijklmnop?api key=demo', json=body) api response = api result json() print "batch updated ", json dumps(api response)$body = http build query(\[ "q" => "altcoin exchange" ]); $ch = curl init('https //api scaleserp com/batches/123456/abcdefghijklmnop?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); echo "batch updated", php eol; scale serp responds with a json object containing details of the search fields that have been updated { "request info" { "success" true }, "search" { "q" "altcoin exchange" } } next steps delete searches https //docs trajectdata com/scaleserp/batches api/searches/delete list searches https //docs trajectdata com/scaleserp/batches api/searches/list