OFAA OAID API v2
This commit is contained in:
@@ -15,15 +15,24 @@ if(!$access_token) {
|
||||
$headers[] = "Accept: application/json";
|
||||
$headers[] = "Authorization: Bearer $access_token";
|
||||
|
||||
$request_url = $ep_list_oaids;
|
||||
$page_size = 500;
|
||||
$page = 1;
|
||||
$page_param = ["_page_size" => $page_size];
|
||||
$last_ref = false;
|
||||
while(1) {
|
||||
$output = getRestUrl($ep_list_oaids, $headers, ["tenant"=> $tenant, "_page" => $page]);
|
||||
if($rest_last_api_request_nexturl) {
|
||||
$request_url = $rest_last_api_request_nexturl;
|
||||
$page_param = [];
|
||||
}
|
||||
|
||||
$output = getRestUrl($request_url, $headers, $page_param);
|
||||
if($output == "__err__401") {
|
||||
$access_token = fetchAccessToken($oauth_url, $client_id, $client_secret, $default_scope);
|
||||
$headers = [];
|
||||
$headers[] = "Accept: application/json";
|
||||
$headers[] = "Authorization: Bearer $access_token";
|
||||
$output = getRestUrl($ep_list_oaids, $headers, ["tenant"=> $tenant, "_page" => $page]);
|
||||
$output = getRestUrl($request_url, $headers, $page_param);
|
||||
}
|
||||
|
||||
$output_values = json_decode($output);
|
||||
@@ -39,12 +48,14 @@ while(1) {
|
||||
|
||||
foreach($output_values as $oaid_obj) {
|
||||
echo $oaid_obj->oaid.";";
|
||||
echo $oaid_obj->external_id.";";
|
||||
echo $oaid_obj->customer_reference.";";
|
||||
echo ";";
|
||||
if($oaid_obj->token != "confirmed") {
|
||||
file_put_contents( "php://stderr", "; ".$oaid_obj->token );
|
||||
}
|
||||
echo "\n";
|
||||
$last_ref = $oaid_obj->customer_reference;
|
||||
//$last_ref = $oaid_obj->oaid;
|
||||
}
|
||||
$page++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user