Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Rollbar : Find and resolve items using the API
$term = 'This resource is not routable';
$read_access_token = '<READ ACCESS TOKEN>';
$write_access_token = '<WRITE ACCESS TOKEN>';
$total = 0;
do {
$items = file_get_contents(''.$read_access_token.'&status=active&query='.urlencode($term));
$items = json_decode($items, true);
echo 'Found '.count($items['result']['items']).' items'.PHP_EOL;
foreach ($items['result']['items'] as $item) {
echo ' > Processing '.$item['id'].' : '.$item['title'].PHP_EOL;
$postdata = http_build_query(['status' => 'resolved']);
$opts = ['http' => [
'method' => 'PATCH',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
$context = stream_context_create($opts);
file_get_contents(''.$item['id'].'?access_token='.$write_access_token, false, $context);
} while (0 !== count($items['result']['items']));
echo PHP_EOL.'Processed '.$total.' items'.PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.