I compared your code with a working example from a recent implementation -
From that I see a couple small things off in your code:
contentType header is set differently.
You needlessly stringify the payload
resp.content needs to be stringified and parsed.
All these things are "formal" errors, which don't apply to POSTMan, so that would be ...
The _BusinessUnitUnsubscribes Data View is a very convenient source for obtaining the unsubscribe reason, but records will only appear in this data view for BUs that have the 'Subscribers will be unsubscribed from this business unit only' option enabled in Business Unit setup.
As an alternative, you can extract the unsubscribe reason from the unsubscribe ...
Script activities do have timeouts.
Large data volume, especially stuff like refreshing data extensions, is generally something that you want to process with SQL, not ssjs.
The problem is in the general approach, looking into WSProxy will probably just change details (a few hundred / thousand records more or less until it times out).
With that disclaimer ...
If you're not logging unsubscribe events like a stock preference center would, then you should expect this data view to be empty.
Toggling the status in the Subscriber object will not trigger the unsubscribe in tracking or the data views.
Here's an example of a custom one-click unsubscribe page that will result in the proper recording of the event.
Here's the sargable method that I typically use to get yesterday's records:
from _open o
o.eventdate >= convert(date, getDate()-1)
and o.eventdate < convert(date, getDate())
and o.isunique = 1
Converting to date effectively resets time portion to midnight and using a range captures all times between midnights.
as per your last comment / screenshot -
EazyE's original reply is correct, but your screenshot shows a misinterpretation of what was suggested. I'll try and elaborate.
ID_MKT_Cloud__c apparently is a field in your target DE.
The error tells you that in your target DE, it is in fact a mandatory field, so nothing can write data into the target without ...
This is actually easier to do then you might think. Like @EazyE stated, you would extract the file, use a file transfer to push it to the FTP then use another File Trasfer to unzip it. Once you have the csv files that were in the zip file onto the FTP server you can then import them.
Step 1: Create Data Extract - You already seem to know this, so will skip ...