You can use data.d.__next
property and recursive calls to fetch more than 5000 items from SharePoint list like:
var url = _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('DocumentList')/items?$select=customerID&$top=5000";
var response = response || []; // this variable is used for storing list items
function GetListItems(){
return $.ajax({
url: url,
method: "GET",
headers: {
"Accept": "application/json; odata=verbose"
},
success: function(data){
response = response.concat(data.d.results);
if (data.d.__next) {
url = data.d.__next;
GetListItems();
}
$.each(response, function(index, item) {
arrayCustomerID[index] = item.customerID;
});
},
error: function(error){
}
});
}
Similar thread: Rest to read more than 5000 items from document library