Batches
...
Batches API
Searches

Create Searches

5min
create searches adding searches to a batch is achieved by making an http put to the /batches/batch id endpoint (where batch id is the id of the batch to add searches to) the body of the request should be a json array of search objects (up to 1000 searches can be added per call) the maximum number of searches per batch is 15,000 (or 100 when adding searches with include html=true set) the /batches/batch id endpoint used for adding searches to a batch is the same endpoint as used when updating a batch https //docs trajectdata com/serpwow/batches api/batches/update , we've just listed them seperately in the docs for ease of reference the parameters https //docs trajectdata com/serpwow/search api/overview for creating a search are the same as those used when making a request via the search api https //docs trajectdata com/serpwow/search api/overview batch status searches can only be added to a batch when the batch is not running to check whether a batch is currently running use the get batch https //docs trajectdata com/serpwow/batches api/batches/get endpoint concurrency when creating searches you should make calls to the create search endpoint sequentially, rather than in parallel each call can contain up to 1000 search to add though if you make too many concurrent calls you will receive an http 429 error using include html=true in batches when adding searches with include html=true to a batch the maximum number of searches per batch is 100 (rather than 15,000) because including the html within the response makes the batch 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 searches all with include html=true then simply split the searches across multiple 100 search batches example put put /batches/batch id in the example below we add a new search to a batch with id=123456 custom ids when you add a search to a batch serpwow assigns it an unique id you can use this id to track the search across multiple result sets serpwow also lets you specify your own custom id , in addition to the serpwow assigned id, making it easy to use an id from your app track searches $ curl x put "https //api serpwow\ com/live/batches/123456?api key=demo" \\ h "content type application/json" \\ d "{\\"searches\\" \[{\\"q\\" \\"mcdonalds\\",\\"location\\" \\"united states\\",\\"search type\\" \\"images\\",\\"custom id\\" \\"mycustomid 001\\"}]}"const axios = require('axios'); const body = { searches \[ { "q" "mcdonalds", "location" "united states", "search type" "images", "custom id" "mycustomid 001" }]} axios put('https //api serpwow\ com/live/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 import json body = { "searches" \[ { "q" "mcdonalds", "location" "united states", "search type" "images", "custom id" "mycustomid 001" }]} api result = requests put('https //api serpwow\ com/live/batches/123456?api key=demo', json=body) api response = api result json() print "batch updated ", json dumps(api response)\<?php $body = \[ "searches" => array(\[ "q" => "mcdonalds", "location" => "united states", "search type" => "images", "custom id" => "mycustomid 001" ])]; $ch = curl init('https //api serpwow\ com/live/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, json encode($body)); $json = curl exec($ch); curl close($ch); $api result = json decode($json, true); print r($api result); echo "batch updated", php eol; ?> serpwow responds with the following json confirming the searches have been successfully created note the searches total count now reflects the count of the searches the batch has, including those just added to list the searches in the batch use the list searches https //docs trajectdata com/serpwow/batches api/searches/list endpoint { "request info" { "success" true }, "batch" { "id" "123456", "created at" "2020 01 01t00 00 00 000z", "name" "my first batch", "schedule type" "daily", "enabled" true, "status" "idle", "searches total count" 2, "searches 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 search https //docs trajectdata com/serpwow/batches api/searches/update delete search https //docs trajectdata com/serpwow/batches api/searches/delete list searches https //docs trajectdata com/serpwow/batches api/searches/list