#!/usr/bin/php 1) { $oaid = $argv[1]; } if(!$oaid) { die("OAID name required\n"); } if(!$access_token) { $access_token = fetchAccessToken($oauth_url, $client_id, $client_secret, $default_scope); if(!$access_token) { die("Error getting access token"); } } $headers = [ "Authorization: Bearer $access_token", "Accept: application/json", "Content-type: application/json", ]; $confirm_url = str_replace("{oaid}", $oaid, $ep_confirm_oaid); $out = patchRestUrl($confirm_url, $headers, ["token" => "confirmed"], "application/json"); if($out == "__err__401") { $access_token = fetchAccessToken($oauth_url, $client_id, $client_secret, $default_scope); $headers = [ "Authorization: Bearer $access_token", "Accept: application/json", "Content-type: application/json", ]; $out = patchRestUrl($confirm_url, $headers, ["token" => "confirmed"], "application/json"); } echo "$oaid confirmed.\n";