The request is something similar to the following with 20000 items:
I’ve tried the 3 examples below:
# Update request with remove mode
batch_data = [
{'entity_id': 123456,
'entity_type': 'PublishedFile',
'request_type': 'update',
'data': {
'sg_multi_entity_field_1': [
{'id': 123, 'type': 'CustomEntity99'},
{'id': 124, 'type': 'CustomEntity99'},
{'id': 125, 'type': 'CustomEntity99'}],
'sg_multi_entity_field_2': [
{'id': 123, 'type': 'CustomEntity99'},
{'id': 124, 'type': 'CustomEntity99'},
{'id': 125, 'type': 'CustomEntity99'}],
},
'multi_entity_update_modes':{'sg_multi_entity_field_1': 'remove', 'sg_multi_entity_field_2': 'remove'}
},
},
{'entity_id': 123457,
'entity_type': 'PublishedFile',
'request_type': 'update',
'data': {
'sg_multi_entity_field_1': [
{'id': 123, 'type': 'CustomEntity99'},
{'id': 124, 'type': 'CustomEntity99'},
{'id': 125, 'type': 'CustomEntity99'}],
'sg_multi_entity_field_2': [
{'id': 123, 'type': 'CustomEntity99'},
{'id': 124, 'type': 'CustomEntity99'},
{'id': 125, 'type': 'CustomEntity99'}],
},
'multi_entity_update_modes':{'sg_multi_entity_field_1': 'remove', 'sg_multi_entity_field_2': 'remove'}
},
},
{'entity_id': 123458,
'entity_type': 'PublishedFile',
'request_type': 'update',
'data': {
'sg_multi_entity_field_1': [
{'id': 123, 'type': 'CustomEntity99'},
{'id': 124, 'type': 'CustomEntity99'},
{'id': 125, 'type': 'CustomEntity99'}],
'sg_multi_entity_field_2': [
{'id': 123, 'type': 'CustomEntity99'},
{'id': 124, 'type': 'CustomEntity99'},
{'id': 125, 'type': 'CustomEntity99'}],
},
'multi_entity_update_modes':{'sg_multi_entity_field_1': 'remove', 'sg_multi_entity_field_2': 'remove'}
},
},
...
]
sg.batch(batch_data)
# Update request with set mode
batch_data = [
{'entity_id': 123456,
'entity_type': 'PublishedFile',
'request_type': 'update',
'data': {
'sg_multi_entity_field_1': [],
'sg_multi_entity_field_2': [],
},
'multi_entity_update_modes':{'sg_multi_entity_field_1': 'set', 'sg_multi_entity_field_2': 'set'}
},
},
{'entity_id': 123457,
'entity_type': 'PublishedFile',
'request_type': 'update',
'data': {
'sg_multi_entity_field_1': [],
'sg_multi_entity_field_2': [],
},
'multi_entity_update_modes':{'sg_multi_entity_field_1': 'set', 'sg_multi_entity_field_2': 'set'}
},
},
{'entity_id': 123458,
'entity_type': 'PublishedFile',
'request_type': 'update',
'data': {
'sg_multi_entity_field_1': [],
'sg_multi_entity_field_2': [],
},
'multi_entity_update_modes':{'sg_multi_entity_field_1': 'set', 'sg_multi_entity_field_2': 'set'}
},
},
...
]
sg.batch(batch_data)
# Update request with no mode
batch_data = [
{'entity_id': 123456,
'entity_type': 'PublishedFile',
'request_type': 'update',
'data': {
'sg_multi_entity_field_1': [],
'sg_multi_entity_field_2': [],
},
},
},
{'entity_id': 123457,
'entity_type': 'PublishedFile',
'request_type': 'update',
'data': {
'sg_multi_entity_field_1': [],
'sg_multi_entity_field_2': [],
},
},
},
{'entity_id': 123458,
'entity_type': 'PublishedFile',
'request_type': 'update',
'data': {
'sg_multi_entity_field_1': [],
'sg_multi_entity_field_2': [],
},
},
},
...
]
sg.batch(batch_data)